You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenAPI allows adding `deprecated: true` at several places. openapi-processor-spring translates them to Java's `@Deprecated` annotation.
4
+
5
+
6
+
== deprecated endpoint
7
+
8
+
9
+
[cols="2*",grid=row,frame=none]
10
+
|===
11
+
a|OpenAPI
12
+
a|Java Code
13
+
14
+
a|[source,yaml]
15
+
----
16
+
/foo:
17
+
get:
18
+
deprecated: true # <1>
19
+
----
20
+
21
+
a|[source,java]
22
+
----
23
+
@Deprecated // <2>
24
+
@GetMapping("/foo")
25
+
/*...*/ getFoo();
26
+
----
27
+
|===
28
+
29
+
<1> a deprecated endpoint
30
+
<2> the generated endpoint method with a `@Deprecated` annotation
31
+
32
+
== deprecated parameter
33
+
34
+
35
+
[cols="2*",grid=row,frame=none]
36
+
|===
37
+
a|OpenAPI
38
+
a|Java Code
39
+
40
+
41
+
a|[source,yaml]
42
+
----
43
+
/foo:
44
+
get:
45
+
parameters:
46
+
- name: bar
47
+
deprecated: true # <1>
48
+
in: query
49
+
schema:
50
+
type: string
51
+
----
52
+
a|[source,java]
53
+
----
54
+
@GetMapping("/foo")
55
+
/* ... */ getFoo(@Deprecated String bar); // <2>
56
+
----
57
+
|===
58
+
59
+
<1> a deprecated parameter
60
+
<2> the generated endpoint method with a `@Deprecated` annotation on the `bar` parameter.
61
+
62
+
== deprecated schema
63
+
64
+
[cols="2*",grid=row,frame=none]
65
+
|===
66
+
a|OpenAPI
67
+
a|Java Code
68
+
69
+
a|[source,yaml]
70
+
----
71
+
Bar:
72
+
type: object
73
+
deprecated: true # <1>
74
+
properties:
75
+
foobar:
76
+
type: string
77
+
78
+
----
79
+
80
+
a|[source,java]
81
+
----
82
+
@Deprecated // <2>
83
+
public class Bar {
84
+
/* ... */
85
+
}
86
+
87
+
----
88
+
|===
89
+
90
+
<1> a deprecated schema
91
+
<2> the generated model class with a `@Deprecated` annotation.
92
+
93
+
== deprecated schema property
94
+
95
+
[cols="2*",grid=row,frame=none]
96
+
|===
97
+
a|OpenAPI
98
+
a|Java Code
99
+
100
+
a|[source,yaml]
101
+
----
102
+
Bar:
103
+
type: object
104
+
properties:
105
+
foobar:
106
+
deprecated: true # <1>
107
+
type: string
108
+
----
109
+
110
+
a|[source,java]
111
+
----
112
+
public class Bar {
113
+
114
+
@Deprecated // <2>
115
+
@JsonProperty("foobar")
116
+
private String foobar;
117
+
118
+
@Deprecated // <2>
119
+
public String getFoobar() {
120
+
return foobar;
121
+
}
122
+
123
+
@Deprecated // <2>
124
+
public void setFoobar(String foobar) {
125
+
this.foobar = foobar;
126
+
}
127
+
128
+
}
129
+
130
+
----
131
+
|===
132
+
133
+
<1> a deprecated schema property
134
+
<2> the generated model class with `@Deprecated` annotations at the property, getter and setter. (hmm, the annotated property may be a bit too much... )
0 commit comments