Deprecated items

OpenAPI allows adding deprecated: true at several places. openapi-processor-spring translates them to Java’s @Deprecated annotation.

deprecated endpoint

OpenAPI

Java Code

/foo:
  get:
    deprecated: true (1)
@Deprecated (2)
@GetMapping("/foo")
/*...*/ getFoo();
1 a deprecated endpoint
2 the generated endpoint method with a @Deprecated annotation

deprecated parameter

OpenAPI

Java Code

/foo:
  get:
    parameters:
      - name: bar
        deprecated: true (1)
        in: query
        schema:
          type: string
@GetMapping("/foo")
/* ... */ getFoo(@Deprecated String bar); (2)
1 a deprecated parameter
2 the generated endpoint method with a @Deprecated annotation on the bar parameter.

deprecated schema

OpenAPI

Java Code

Bar:
  type: object
  deprecated: true (1)
  properties:
    foobar:
      type: string
@Deprecated (2)
public class Bar {
    /* ... */
}
1 a deprecated schema
2 the generated model class with a @Deprecated annotation.

deprecated schema property

OpenAPI

Java Code

Bar:
  type: object
  properties:
    foobar:
      deprecated: true (1)
      type: string
public class Bar {

    @Deprecated  (2)
    @JsonProperty("foobar")
    private String foobar;

    @Deprecated (2)
    public String getFoobar() {
        return foobar;
    }

    @Deprecated (2)
    public void setFoobar(String foobar) {
        this.foobar = foobar;
    }

}
1 a deprecated schema property
2 the generated model class with @Deprecated annotations at the property, getter and setter. (hmm, the annotated property may be a bit too much…​ )