SwaggerDefinition annotation does not work
See original GitHub issueFollowing https://github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X#swagger-definition I created an interface ‘ApiConfig’ with no method in it and put it the interface in the package that swagger will scan.
I am using jersey 2.15 and swagger-jersey2-jaxrs version is 1.5.10. I also tried swagger-jersey2-jaxrs 1.5.14 with no luck.
This is the interface I created.
@SwaggerDefinition(
info = @Info(
description = "my apis",
version = "1.0.0",
title = "my apis"
),
schemes = {SwaggerDefinition.Scheme.HTTP},
tags = {@Tag(name = "mytag", description = "test tag")},
securityDefinition = @SecurityDefinition(
oAuth2Definitions = {
@OAuth2Definition(
key = "testoauth",
description = "MES OAuth",
authorizationUrl = "http://www.example.com/",
tokenUrl = "",
scopes = {
@Scope(
name = "test",
description = "testscope"
),
@Scope(
name = "general:save",
description = "save operation"
),
@Scope(
name = "general:update",
description = "update operation"
)
},
flow = OAuth2Definition.Flow.IMPLICIT
)
}
)
)
public interface ApiConfig {
}
But the result ‘swagger.json’ does not contain anything I specified in the annotation(I hit ‘swagger.json’ in chrome and searched ‘securityDefinition’ and got nothing). Then I added @Path("")
to the interface, and restarted web server, it worked as expected. What did I do wrong?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
Issue in adding Annotation SwaggerDefinition at class level
When the migration is complete, you will access your Teams at stackoverflowteams.com, and they will no longer appear in the left sidebar on ......
Read more >data in @SwaggerDefinition doesn't go to html and json ...
The main objective for SwaggerDefinition annotation is to specify base path for my JAX-RS ... v 1.5.3) but when I run swagger-maven-plugin on...
Read more >SwaggerDefinition (swagger-annotations 1.5.0 API)
Annotation Type SwaggerDefinition ... consumes for this swagger definition. These will be added to all api definitions that don't have local overrides -...
Read more >How to force swagger.json file to be generated using UTF-8?
I'm trying to implement WSO2 for an API that will be publically opened, ... charset=utf-8" }" on @SwaggerDefinition, but nothing changes.
Read more >Spring Boot and Swagger: Documenting RESTful Services
You can filter out APIs you do not want to document with Swagger. Exposing Meta API Information Using @SwaggerDefinition. You can also expose ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got it to work, you should add
@Provider
annotation on the interface, otherwise it will not be picked up by Jersey containerdoesn’t work for me, because I use msf4j, not Jersey