swagger-api / swagger-api/swagger-codegen
[JAVA] Generate JSON or YAML api specs from Maven plugin
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Actually we have to specify in Maven plugin "swagger-codegen-maven-plugin" an "inputSpec" value in plugin execution configuration. I didn't find a way to dynamically generate it from REST resources Spring class instead of a static file or an uri. It supposed that the server is already running to have the specs in v2/api-docs
It would be nice if we can build the server jar and the relative REST client jar.
So consumers of this REST API are always aware (in a SNAPSHOT case) of specs evolution on the server.
Swagger-codegen version
2.3.0
Suggest a fix/enhancement
Something like this could be useful in the server pom.xml, in an assembler profile for instance :
``
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${swagger.codegen.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>native</inputSpec>
<scanPackages>
<package>com.myproject.restdomain1</package>
<package>com.myproject.restdomain2</package>
<scanPackages>
<language>java</language>
<configOptions>
<sourceFolder>src/gen/java/main</sourceFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the swagger-codegen-maven-plugin configuration, its inputSpec handling, and the server pom.xml or assembler profile described in the issue. Determine whether the plugin can discover Spring REST resources and generate JSON or YAML specs during the build; done means the server and REST client jars can be built together without a static inputSpec or running server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design, build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100