/**
  * Builds inline schema definitions
  *
  * @param definitions all inline definitions to display
  * @param uniquePrefix unique prefix to prepend to inline object names to enforce unicity
  * @param docBuilder the docbuilder do use for output
  */
 private void inlineDefinitions(
     List<ObjectType> definitions, String uniquePrefix, MarkupDocBuilder docBuilder) {
   if (CollectionUtils.isNotEmpty(definitions)) {
     for (ObjectType definition : definitions) {
       addInlineDefinitionTitle(definition.getName(), definition.getUniqueName(), docBuilder);
       List<ObjectType> localDefinitions =
           buildPropertiesTable(
               definition.getProperties(),
               uniquePrefix,
               new DefinitionDocumentResolverFromDefinition(),
               docBuilder);
       for (ObjectType localDefinition : localDefinitions)
         inlineDefinitions(
             Collections.singletonList(localDefinition),
             localDefinition.getUniqueName(),
             docBuilder);
     }
   }
 }
  /**
   * Builds the type informations of a definition
   *
   * @param definitionName name of the definition to display
   * @param model model of the definition to display
   * @param docBuilder the docbuilder do use for output
   * @return a list of inlined types.
   */
  private List<ObjectType> typeSection(
      String definitionName, Model model, MarkupDocBuilder docBuilder) {
    List<ObjectType> inlineDefinitions = new ArrayList<>();
    Type modelType =
        ModelUtils.resolveRefType(
            ModelUtils.getType(
                model,
                globalContext.getSwagger().getDefinitions(),
                new DefinitionDocumentResolverFromDefinition()));

    if (!(modelType instanceof ObjectType)) {
      modelType =
          createInlineType(
              modelType, definitionName, definitionName + " " + "inline", inlineDefinitions);
    }

    if (modelType instanceof ObjectType) {
      ObjectType objectType = (ObjectType) modelType;
      MarkupDocBuilder typeInfos = copyMarkupDocBuilder();
      switch (objectType.getPolymorphism().getNature()) {
        case COMPOSITION:
          typeInfos
              .italicText(POLYMORPHISM_COLUMN)
              .textLine(COLON + POLYMORPHISM_NATURE.get(objectType.getPolymorphism().getNature()));
          break;
        case INHERITANCE:
          typeInfos
              .italicText(POLYMORPHISM_COLUMN)
              .textLine(COLON + POLYMORPHISM_NATURE.get(objectType.getPolymorphism().getNature()));
          typeInfos
              .italicText(DISCRIMINATOR_COLUMN)
              .textLine(COLON + objectType.getPolymorphism().getDiscriminator());
          break;
        case NONE:
          if (ALWAYS_DISPLAY_DISCRIMINATOR) {
            if (StringUtils.isNotBlank(objectType.getPolymorphism().getDiscriminator()))
              typeInfos
                  .italicText(DISCRIMINATOR_COLUMN)
                  .textLine(COLON + objectType.getPolymorphism().getDiscriminator());
          }

        default:
          break;
      }

      String typeInfosString = typeInfos.toString();
      if (StringUtils.isNotBlank(typeInfosString)) docBuilder.paragraph(typeInfosString, true);

      inlineDefinitions.addAll(
          buildPropertiesTable(
              ((ObjectType) modelType).getProperties(),
              definitionName,
              new DefinitionDocumentResolverFromDefinition(),
              docBuilder));
    } else if (modelType != null) {
      MarkupDocBuilder typeInfos = copyMarkupDocBuilder();
      typeInfos.italicText(TYPE_COLUMN).textLine(COLON + modelType.displaySchema(docBuilder));

      docBuilder.paragraph(typeInfos.toString());
    }

    return inlineDefinitions;
  }