Swagger-core: Howto add resource description using 1.5 @Api annotation

Created on 9 Mar 2017  路  5Comments  路  Source: swagger-api/swagger-core

I'm currently in the process of updating from 1.3 to 1.5.

While most things are working now, I was unable to figure out how to set the description of a resource using the @Api annotation in 1.5. With 1.3 I was using

@Api(value = "My Swagger Resource", description = "Meaningful stuff in here")

For 1.5 I modified this to

@Api(tags = { "My Swagger Resource" }, description = "Meaningful stuff in here")

But the description attribute is deprecated and obviously not used anymore. I already tried to find examples on how to set this using the tags but was unable to find any resources on this.

I assume adding a resource description is still possible in 1.5, but how?

Most helpful comment

@dpr-rec but it's not working for me.

All 5 comments

Ah, now I figured out how this is working. This would be the 1.5 equivalent of an 1.3 @Api annotation with description.

@Api(tags = { "My Swagger Resource" })
@SwaggerDefinition(tags = { @Tag(name = "My Swagger Resource", description = "Meaningful stuff in here") })

I think this definitively should be mentioned in the migration guide!

@dpr-rec but it's not working for me.

On trying to use the @ApiAnnotation or anything related to @api annotation , i am being asked to create it . how do i do that could you help me with that ?

capture
How to add in this can anyone help me ?

Was this page helpful?
0 / 5 - 0 ratings