Deprecated items
OpenAPI allows adding deprecated: true
at several places. openapi-processor-spring translates them to Java’s @Deprecated
annotation.
deprecated endpoint
OpenAPI
/foo:
get:
deprecated: true (1)
Java
@Deprecated (2)
@GetMapping("/foo")
/*...*/ getFoo();
1 | a deprecated endpoint |
2 | the generated endpoint method with a @Deprecated annotation |
deprecated parameter
OpenAPI
/foo:
get:
parameters:
- name: bar
deprecated: true (1)
in: query
schema:
type: string
Java
@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
Bar:
type: object
deprecated: true (1)
properties:
foobar:
type: string
Java
@Deprecated (2)
public class Bar {
/* ... */
}
1 | a deprecated schema |
2 | the generated model class with a @Deprecated annotation. |
deprecated schema property
OpenAPI
Bar:
type: object
properties:
foobar:
deprecated: true (1)
type: string
Java
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. (the annotated property may be a bit too much… ) |