Unable to make use of 'swaggerhub-maven-plugin' or 'swagger-maven-plugin'
vthanikachalam opened this issue · 5 comments
Plugin generates an incomplete JSON schema, more details as follows
Please note as part of Enterprise automation we would like to build the JSON specification during build lifecycle, I tried using swagger-maven-plugin to generate JSON file.. plugin configuration is as follows...
<plugin>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>2.0.5</version>
<configuration>
<outputFileName>registrationAPI-2</outputFileName>
<outputPath>${basedir}/target/</outputPath>
<outputFormat>JSON</outputFormat>
<resourcePackages>
<resourcePackage>com.altais.registration.controller</resourcePackage>
</resourcePackages>
<prettyPrint>true</prettyPrint>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>resolve</goal>
</goals>
</execution>
</executions>
</plugin>
when I ran the build, it generates 'registrationAPI-1.json' with a header element. It's incomplete does not have anything.. attached the file for reference
please advice to proceed further.
@vthanikachalam Can you provide us with more information about your Java project? Which framework do you use for your API? Is it JAX-RS based or Spring based?
It's Spring boot application, after running the application we could able to generate REST API documentation/schema by hitting/launching the URL http://localhost:port/application-context/v2/api-docs in the browser
But we would like to generate the REST API documentation/schema without running the application, we want to make use of the swagger-maven-plugin
Followed the step provided in the URL https://github.com/SmartBear/swaggerhub-maven-plugin but it did not work, it generates a kind of empty file
Please provide your support
https://github.com/SmartBear/swaggerhub-maven-plugin (this project) is intended to interact with SwaggerHub using existing files or files that are being generated during the build process. It does not generate an API definition from your code.
The swagger-maven-plugin
that's mentioned in the documentation, and what you shared above, only works with JAX-RS based APIs and not Spring ones. We do not provide a solution for Spring-based APIs ourselves. Depending on the library you use in Spring (whether it's Springfox or Springdocs) and depending on the version, there may be other solutions out there for compile-time generation of the API definition. Unfortunately, it is out of scope for what we provide.
Closing issue as it is not related to the swaggerhub-maven-plugin
project.
It is a question for swagger-maven-plugin
:
https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-maven-plugin