Forum Discussion

flohof's avatar
New Contributor
2 years ago

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
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!