Skip to content

Commit 96dc93a

Browse files
committed
update docs
1 parent 75eff54 commit 96dc93a

File tree

3 files changed

+139
-5
lines changed

3 files changed

+139
-5
lines changed

docs/modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
** xref:processor/parameter.adoc[Parameter]
88
** xref:processor/requestbody.adoc[Request Body]
99
** xref:processor/response.adoc[Responses]
10+
** xref:processor/deprecated.adoc[Deprecated]
1011
** xref:processor/identifier.adoc[Identifier]
1112
* xref:mapping/index.adoc[Type Mapping]
1213
** xref:mapping/structure.adoc[Type Mapping Structure]

docs/modules/ROOT/pages/index.adoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ correct code for an endpoint. That way the processor can still be used for all t
8686

8787
- the generated code does not use swagger annotations. There is no need to generate the
8888
documentation from the code when the code originates from the documentation (i.e. an openapi.yaml).
89-
+
90-
NOTE: The generated source code has to be included in a project to compile it. This is easily done
91-
with the xref:gradle::index.adoc[openapi-processor-gradle] plugin. See xref:gradle.adoc[Using Gradle].
9289

93-
- gradle support via xref:gradle::index.adoc[openapi-processor-gradle] plugin (the plugin is
94-
currently the only option to run the processor).
90+
- *maven & gradle support* The plugin docs show how to run a processor and how to add the generated sources to the build.
91+
92+
** xref:maven::index.adoc[openapi-processor-maven] plugin.
93+
** xref:gradle::index.adoc[openapi-processor-gradle] plugin.
9594

9695
== Releases
9796

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
= Deprecated items
2+
3+
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

Comments
 (0)