How to annotate a field as deprecated in OpenAPI (Swagger) 2.0?

I have the following schema definition:

swagger: '2.0'
...
definitions:
  Service:
    type: object
    properties:
      serviceId:
        type: string
        description: Device or service identification number
        example: 1111111111      
      location:
        type: string
        description: Location of the service
        example: '400 Street name, City State postcode, Country'

I would like to do annotate the location field as deprecated. Is there a way to do this?


The possibility to mark schemas and schema properties as deprecated was added in OpenAPI 3.0:

openapi: 3.0.1
...
components:
  schemas:
    Service:
      type: object
      properties:
        location:
          type: string
          description: Location of the service
          example: '400 Street name, City State postcode, Country'
          deprecated: true    # <---------

If you use OpenAPI 2.0 (Swagger 2.0), the only thing you can do is document the deprecation verbally in the property description.


according to documentation it is enough to use deprecated attribute

/pet/findByTags:
get:
  deprecated: true