Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Server codegen - swagger-2.0 basePath not generated #3720

Closed
tdhancii opened this issue Sep 5, 2016 · 3 comments
Closed

Spring Server codegen - swagger-2.0 basePath not generated #3720

tdhancii opened this issue Sep 5, 2016 · 3 comments

Comments

@tdhancii
Copy link

tdhancii commented Sep 5, 2016

Description

@RequestMapping annotation is not generated in spring server code generation.
basePath is properly defined in swagger.yaml file.

Swagger-codegen version

Swagger codegen version :
swagger-codegen-maven-plugin: 2.2.1 and also tired with 2.2.2-SNAPSHOT

Swagger declaration file content or url

https://gist.github.com/tdhancii/1d0dde04413b6d98a76598a549a68985

Command line used for generation

Used Maven plugin to generate code
<plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.2.1</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>src/main/resources/swagger.yaml</inputSpec> <apiPackage>co.test.swagger.api</apiPackage> <modelPackage>co.test.swagger.model</modelPackage> <language>spring</language> <environmentVariables> <models></models> <apis></apis> <supportingFiles>HomeController.java,SwaggerDocumentationConfig.java</supportingFiles> </environmentVariables> </configuration> </execution> </executions> </plugin>

Steps to reproduce

just generate the code using maven plugin and check the DomainApi.java class. You will see that there is not path mapping annotation for basePath: v1 defined in the swagger spec

@wing328
Copy link
Contributor

wing328 commented Sep 8, 2016

The context Path (e.g. v1, v2) should be set in application.properties, e.g. https://github.com/swagger-api/swagger-codegen/blob/master/samples/server/petstore/springboot/src/main/resources/application.properties

@tdhancii
Copy link
Author

tdhancii commented Sep 8, 2016

Thanks for the update

@ShortyFR
Copy link

ShortyFR commented Mar 7, 2018

How can the context v1 or v2 (which can both be contained in the same Spring instance) be set in application.properties (which is common to all endpoints in the Spring instance) ?
And what if the same Spring instance handles other URLs than just the Swagger-managed API ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants