/** * Builds the body parameter section * * @param operation the Swagger Operation * @return a list of inlined types. */ private List<ObjectType> buildBodyParameterSection(MarkupDocBuilder markupDocBuilder, PathOperation operation) { List<ObjectType> inlineDefinitions = new ArrayList<>(); bodyParameterComponent.apply(markupDocBuilder, BodyParameterComponent.parameters( operation, inlineDefinitions )); return inlineDefinitions; }
@Test public void testBodyParameterComponent() throws URISyntaxException { //Given Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI()); Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder().withFlatBody().build(); Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(file).withConfig(config).build(); Swagger swagger = converter.getContext().getSwagger(); io.swagger.models.Path path = swagger.getPaths().get("/pets"); List<PathOperation> pathOperations = PathUtils.toPathOperationsList("/pets", path); Swagger2MarkupConverter.Context context = converter.getContext(); MarkupDocBuilder markupDocBuilder = context.createMarkupDocBuilder(); //When markupDocBuilder = new BodyParameterComponent(converter.getContext(), new DefinitionDocumentResolverFromOperation(context)) .apply(markupDocBuilder, BodyParameterComponent.parameters(pathOperations.get(0), new ArrayList<>())); markupDocBuilder.writeToFileWithoutExtension(outputDirectory, StandardCharsets.UTF_8); //Then Path expectedFile = getExpectedFile(COMPONENT_NAME); DiffUtils.assertThatFileIsEqual(expectedFile, outputDirectory, getReportName(COMPONENT_NAME)); } }
/** * Builds the body parameter section * * @param operation the Swagger Operation * @return a list of inlined types. */ private List<ObjectType> buildBodyParameterSection(MarkupDocBuilder markupDocBuilder, PathOperation operation) { List<ObjectType> inlineDefinitions = new ArrayList<>(); bodyParameterComponent.apply(markupDocBuilder, BodyParameterComponent.parameters( operation, inlineDefinitions )); return inlineDefinitions; }
/** * Builds the body parameter section * * @param operation the Swagger Operation * @return a list of inlined types. */ private List<ObjectType> buildBodyParameterSection(MarkupDocBuilder markupDocBuilder, PathOperation operation) { List<ObjectType> inlineDefinitions = new ArrayList<>(); bodyParameterComponent.apply(markupDocBuilder, BodyParameterComponent.parameters( operation, inlineDefinitions )); return inlineDefinitions; }