How to show an api operation as deprecated in the swagger docs

20,696 views
Skip to first unread message

shenoy tinny

unread,
Oct 21, 2015, 1:02:01 PM10/21/15
to Swagger
Hello,

I would like to mark a couple of API operations as deprecated. I used the @Deprecated annotation, but this doesn't help in displaying that the method is deprecated in the docs.

I was wondering if the @ApiOperation annotation has a deprecated property that I can set. As far as I looked around, I didn't find @ApiOperation having such a property.

Thanks

Ron

unread,
Oct 21, 2015, 6:28:57 PM10/21/15
to Swagger
Assuming you're using the latest version of swagger-core, @Deprecated should work well.
Can you check the swagger.json to see if that operation is marked deprecated?
Which docs are you actually referring to when you say you don't see it? Where exactly do you look?

shenoy tinny

unread,
Oct 22, 2015, 12:06:05 PM10/22/15
to Swagger
I am using swagger-core 1.5.3 version.Is this fixed in 1.5.4?

Ron

unread,
Oct 25, 2015, 11:06:13 PM10/25/15
to Swagger
It works well in 1.5.3 but you can try 1.5.4.

If it doesn't, please take a look at the previous questions I presented and provide answer to them. Without those we won't be able to proceed.

shenoy tinny

unread,
Oct 27, 2015, 3:53:31 PM10/27/15
to Swagger
I actually don't see the operation deprecated in the swagger.json file. By docs, I mean the page that lists all the operations. something like this -



This is how I have specified the operation to be deprecated.
@Get
@Deprecated
@Path("/about")
public string getAbout()
{....}

Ron

unread,
Oct 27, 2015, 7:16:32 PM10/27/15
to Swagger
Can you share your swagger.json?

Mike Cobbett

unread,
Sep 1, 2017, 6:41:31 AM9/1/17
to Swagger

https://swagger.io/docs/specification/paths-and-operations/
The tag is detailed in the "Deprecated Operations" section.
/pet/findByTags:
  get:
    deprecated: true
Reply all
Reply to author
Forward
0 new messages