swagger-api / swagger-api/swagger-codegen
Generate SwaggerDocumentationConfig with security definition
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I am using springfox with swagger-codegen-maven-plugin and swagger version 2.0 , in
swagger yaml I defined security section, but when code is generated, SwaggerDocumentationConfig class doesn't contain security related code.
Swagger-codegen version
swagger-codegen-maven-plugin:2.4.19
Swagger declaration file content or url
swagger: '2.0'
securityDefinitions:
OauthSecurity:
type: oauth2
flow: implicit
authorizationUrl: 'http://xxxxxxxxxxxxx:8080/auth/realms/master/protocol/openid-connect/auth'
scopes:
te: te
security:
- OauthSecurity:
- te
(I pasted only security related section)
this was generated after running maven build
@Configuration
public class SwaggerDocumentationConfig {
ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("xxxxx")
.description("xxxx")
.license("")
.licenseUrl("http://unlicense.org")
.termsOfServiceUrl("")
.version("1.0")
.contact(new Contact("","", ""))
.build();
}
@Bean
public Docket customImplementation(){
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.api"))
.build()
.directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
.directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class)
.apiInfo(apiInfo());
}
}
I am expecting the above class to have security related configuration
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 with swagger-codegen-maven-plugin:2.4.19 and the SwaggerDocumentationConfig generation path, using the supplied Swagger 2.0 YAML as input. Check how securityDefinitions and security are handled during generation and compare the generated Java class with the expected security configuration. Done means the generated class includes the requested security-related configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100