Ask a Question

one property as deprecated for a non-deprecated type/component

flohof
New Contributor

one property as deprecated for a non-deprecated type/component

I naivly use the deprecated for moving a property, but this does mark the component/schema as deprecated. I'm generating the API Spec from Java code. The idea:

 

@Schema(description = "status blabla.")
class Status {}
class A {
   @Schema(description = "status blabla. Deprecated, now on B::status", deprecated = true)
   @Deprecated Status status; // old place
}
class B {
   @Schema(description = "status blabla.")
   Status status; // new place
}

 

This results in the whole class Status to be deprecated, as following.

 

{... , 
  "components": {
    "schemas": [
      "Status": {
        "deprecated": true, 
        ...
      },
      "A": {
        "properties": [
          "status": {
            "$ref": "#/components/schemas/Status"
          }, ...
        ], ...
      }, ...
    ]
  }
}

 

I now understand that the @Schema is for the whole type, not per property. I still search a solution to have Status and B::status not be deprecated, only A::status as depcrecated.

Is it possible to achive this? Sibling attributes are ignored according to https://swagger.io/docs/specification/using-ref/#sibling
Are there other solutions? Generally speaking, is it possible to have other attributes, like the description, to be specific for a property? Thanks for propositions!

1 REPLY 1
flohof
New Contributor

Siblings are possible since OpenAPI 3.1 according to https://github.com/Redocly/redoc/issues/2042#issuecomment-1155294637

For my usage, I open a feature request at the used tool https://github.com/springdoc/springdoc-openapi/issues/1853

 

cancel
Showing results for 
Search instead for 
Did you mean: