jsonspring-bootyamlspringdoc-openapi-maven-plugin

How to tell springdoc-openapi-maven-plugin to generate YAML instead of JSON?


I am using the springdoc-maven-openapi-plugin this way:

        <plugin>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-maven-plugin</artifactId>
            <version>1.1</version>
            <executions>
                <execution>
                    <id>integration-test</id>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <apiDocsUrl>http://localhost:9090/v3/api-docs</apiDocsUrl>
                <outputDir>${project.build.directory}/my_open_api_specification/</outputDir>
                <outputFileName>my_open_api_specification.yml</outputFileName>
                <skip>false</skip>
            </configuration>
        </plugin>

This results in an OpenAPI doc in the target folder with a name having a suffix ".yml" but in fact it is a JSON.

How can I tell the plugin to effectively create the doc in YAML format?


Solution

  • http://localhost:9090/v3/api-docs is the default api-url, which generates JSON. To create YAML just use http://localhost:9090/v3/api-docs.YAML