DefinitionComponent extends MarkupComponent<DefinitionComponent.Parameters> { public DefinitionComponent(Swagger2MarkupConverter.SwaggerContext context, DocumentResolver definitionsDocumentResolver) { super(context); this.definitions = context.getSchema().getDefinitions(); this.definitionsDocumentResolver = definitionsDocumentResolver; POLYMORPHISM_NATURE = new HashMap<ObjectTypePolymorphism.Nature, String>() {{ put(ObjectTypePolymorphism.Nature.COMPOSITION, labels.getLabel(POLYMORPHISM_NATURE_COMPOSITION)); put(ObjectTypePolymorphism.Nature.INHERITANCE, labels.getLabel(POLYMORPHISM_NATURE_INHERITANCE)); }}; propertiesTableComponent = new PropertiesTableComponent(context, definitionsDocumentResolver); } DefinitionComponent(Swagger2MarkupConverter.SwaggerContext context,
                               DocumentResolver definitionsDocumentResolver); static DefinitionComponent.Parameters parameters(String definitionName,
                                                            Model model,
                                                            int titleLevel); @Override MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, Parameters params);  }
@Test public void testDefinitionComponent() throws URISyntaxException { Path file = Paths.get(DefinitionComponentTest.class.getResource("/yaml/swagger_petstore.yaml").toURI()); Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(file).build(); Swagger swagger = converter.getContext().getSchema(); Model petModel = swagger.getDefinitions().get("Pet"); Swagger2MarkupConverter.SwaggerContext context = converter.getContext(); MarkupDocBuilder markupDocBuilder = context.createMarkupDocBuilder(); markupDocBuilder = new DefinitionComponent(context, new DefinitionDocumentResolverFromDefinition(context)) .apply(markupDocBuilder, DefinitionComponent.parameters("Pet", petModel, 2)); markupDocBuilder.writeToFileWithoutExtension(outputDirectory, StandardCharsets.UTF_8); Path expectedFile = getExpectedFile(COMPONENT_NAME); DiffUtils.assertThatFileIsEqual(expectedFile, outputDirectory, getReportName(COMPONENT_NAME)); }