Skip to content

Commit af9c4a1

Browse files
committed
1 parent a0674c3 commit af9c4a1

File tree

28 files changed

+91
-3
lines changed

28 files changed

+91
-3
lines changed

openapi-processor-core/src/test/groovy/io/openapiprocessor/core/writer/java/MethodWriterGSpec.groovy

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class MethodWriterGSpec extends Specification {
4646

4747
then:
4848
target.toString () == """\
49+
@Status
4950
@CoreMapping
5051
void getFoo();
5152
"""
@@ -65,6 +66,7 @@ class MethodWriterGSpec extends Specification {
6566
then:
6667
target.toString () == """\
6768
@Deprecated
69+
@Status
6870
@CoreMapping
6971
void getFoo();
7072
"""
@@ -168,6 +170,7 @@ class MethodWriterGSpec extends Specification {
168170
169171
then:
170172
target.toString () == """\
173+
@Status
171174
@CoreMapping
172175
void getFoo(@Parameter String foo);
173176
"""
@@ -200,6 +203,7 @@ class MethodWriterGSpec extends Specification {
200203
201204
then:
202205
target.toString () == """\
206+
@Status
203207
@CoreMapping
204208
void getFoo(String foo);
205209
"""
@@ -222,6 +226,7 @@ class MethodWriterGSpec extends Specification {
222226
223227
then:
224228
target.toString () == """\
229+
@Status
225230
@CoreMapping
226231
void getFoo(@Parameter @Foo String foo);
227232
"""
@@ -246,6 +251,7 @@ class MethodWriterGSpec extends Specification {
246251
247252
then:
248253
target.toString () == """\
254+
@Status
249255
@CoreMapping
250256
void getFoo(@Parameter @Foo("bar") String foo);
251257
"""
@@ -271,6 +277,7 @@ class MethodWriterGSpec extends Specification {
271277
272278
then:
273279
target.toString () == """\
280+
@Status
274281
@CoreMapping
275282
void getFoo(@Parameter @Foo(foo = "bar", oof = "rab") String foo);
276283
"""
@@ -288,6 +295,7 @@ class MethodWriterGSpec extends Specification {
288295
289296
then:
290297
target.toString () == """\
298+
@Status
291299
@CoreMapping
292300
void getFOOooBARrr();
293301
"""
@@ -306,6 +314,7 @@ class MethodWriterGSpec extends Specification {
306314
307315
then:
308316
target.toString () == """\
317+
@Status
309318
@CoreMapping
310319
void getBar();
311320
"""
@@ -329,6 +338,7 @@ class MethodWriterGSpec extends Specification {
329338
330339
then:
331340
target.toString () == """\
341+
@Status
332342
@CoreMapping
333343
void getFoo(@Parameter String foO);
334344
"""
@@ -353,6 +363,7 @@ class MethodWriterGSpec extends Specification {
353363
354364
then:
355365
target.toString () == """\
366+
@Status
356367
@CoreMapping
357368
ResultWrapper<Void> getFoo();
358369
"""

openapi-processor-core/src/test/kotlin/io/openapiprocessor/core/support/ApiOptions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fun parseOptions(
1919
targetDir: String = "defaultTargetDir",
2020
version: String =
2121
"""
22-
|openapi-processor-mapping: v9
22+
|openapi-processor-mapping: v13
2323
|
2424
""",
2525
options: String =

openapi-processor-core/src/test/kotlin/io/openapiprocessor/core/writer/java/MethodWriterAnnotationSpec.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class MethodWriterAnnotationSpec: StringSpec ({
6363
// then:
6464
target.toString () shouldBe
6565
"""
66+
| @Status
6667
| @CoreMapping
6768
| void getFoo(@Parameter @Bar(bar = rab) Foo foo);
6869
|
@@ -97,6 +98,7 @@ class MethodWriterAnnotationSpec: StringSpec ({
9798
// then:
9899
target.toString () shouldBe
99100
"""
101+
| @Status
100102
| @CoreMapping
101103
| void getFoo(@Parameter @Bar(bar = rab) Foo foo);
102104
|
@@ -129,6 +131,7 @@ class MethodWriterAnnotationSpec: StringSpec ({
129131
// then:
130132
target.toString () shouldBe
131133
"""
134+
| @Status
132135
| @CoreMapping
133136
| void getFoo(@Parameter @Bar(bar = rab) Foo foo);
134137
|
@@ -168,6 +171,7 @@ class MethodWriterAnnotationSpec: StringSpec ({
168171
// then:
169172
target.toString () shouldBe
170173
"""
174+
| @Status
171175
| @CoreMapping
172176
| void getFoo(@Parameter @Bar(bar = rab) MappedFoo foo);
173177
|

openapi-processor-core/src/test/kotlin/io/openapiprocessor/core/writer/java/MethodWriterSpec.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class MethodWriterSpec: StringSpec({
5757
// then:
5858
target.toString () shouldBe
5959
"""
60+
| @Status
6061
| @CoreMapping
6162
| void getFoo(@Parameter @NotNull String foo);
6263
|
@@ -146,6 +147,7 @@ class MethodWriterSpec: StringSpec({
146147
// then:
147148
target.toString () shouldBe
148149
"""
150+
| @Status
149151
| @CoreMapping
150152
| void getFoo(@Parameter FooX foo);
151153
|
@@ -172,6 +174,7 @@ class MethodWriterSpec: StringSpec({
172174
// then:
173175
target.toString () shouldBe
174176
"""
177+
| @Status
175178
| @CoreMapping
176179
| void getFoo(@Parameter FooX body);
177180
|
@@ -229,6 +232,7 @@ class MethodWriterSpec: StringSpec({
229232
// then:
230233
target.toString () shouldBe
231234
"""
235+
| @Status
232236
| @CoreMapping
233237
| void getFoo(@Parameter Map<String, Collection<String>> foo);
234238
|
@@ -287,6 +291,7 @@ class MethodWriterSpec: StringSpec({
287291
// then:
288292
target.toString () shouldBe
289293
"""
294+
| @Status
290295
| @CoreMapping
291296
| void getFoo(@Parameter Bar<?> foo);
292297
|
@@ -313,7 +318,7 @@ class MethodWriterSpec: StringSpec({
313318
}
314319

315320
writer.write (target, endpoint, endpoint.endpointResponses.first ())
316-
321+
317322
target.toString () shouldBe
318323
"""
319324
| @Status

openapi-processor-core/src/testInt/resources/tests/bean-validation-iterable/outputs/api/Api.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import annotation.Mapping;
44
import annotation.Parameter;
5+
import annotation.Status;
56
import generated.model.Foo;
67
import generated.model.FooL;
78
import generated.support.Generated;
@@ -10,9 +11,11 @@
1011
@Generated(value = "openapi-processor-core", version = "test")
1112
public interface Api {
1213

14+
@Status("204")
1315
@Mapping("/foo")
1416
void postFoo(@Parameter @Valid Foo body);
1517

18+
@Status("204")
1619
@Mapping("/fooL")
1720
void postFooL(@Parameter @Valid FooL body);
1821

openapi-processor-core/src/testInt/resources/tests/bean-validation-jakarta/outputs/api/Api.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
import annotation.Mapping;
44
import annotation.Parameter;
5+
import annotation.Status;
56
import generated.model.Foo;
67
import generated.support.Generated;
78
import jakarta.validation.Valid;
89

910
@Generated(value = "openapi-processor-core", version = "test")
1011
public interface Api {
1112

13+
@Status("204")
1214
@Mapping("/foo")
1315
void getFoo(@Parameter @Valid Foo body);
1416

openapi-processor-core/src/testInt/resources/tests/bean-validation/inputs/mapping.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
openapi-processor-mapping: v4
1+
openapi-processor-mapping: v13
22

33
options:
44
package-name: generated

openapi-processor-core/src/testInt/resources/tests/bean-validation/outputs/api/EndpointApi.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import annotation.Mapping;
44
import annotation.Parameter;
5+
import annotation.Status;
56
import generated.model.Obj1;
67
import generated.support.Generated;
78
import javax.validation.Valid;
@@ -15,17 +16,20 @@
1516
@Generated(value = "openapi-processor-core", version = "test")
1617
public interface EndpointApi {
1718

19+
@Status("204")
1820
@Mapping("/endpoint/required")
1921
void getEndpointRequired(
2022
@Parameter String requiredFalse,
2123
@Parameter @NotNull String requiredTrue);
2224

25+
@Status("204")
2326
@Mapping("/endpoint/length")
2427
void getEndpointLength(
2528
@Parameter @Size(min = 2) String minLength,
2629
@Parameter @Size(max = 4) String maxLength,
2730
@Parameter @Size(min = 2, max = 4) String minMaxLength);
2831

32+
@Status("204")
2933
@Mapping("/endpoint/minmax")
3034
void getEndpointMinmax(
3135
@Parameter @DecimalMin(value = "10") Integer min,
@@ -35,18 +39,22 @@ void getEndpointMinmax(
3539
@Parameter @DecimalMin(value = "10") @DecimalMax(value = "20") Integer minMax,
3640
@Parameter @DecimalMin(value = "10", inclusive = false) @DecimalMax(value = "20", inclusive = false) Integer minMaxEx);
3741

42+
@Status("204")
3843
@Mapping("/endpoint/items")
3944
void getEndpointItems(
4045
@Parameter @Size(min = 2) String[] min,
4146
@Parameter @Size(max = 4) String[] max,
4247
@Parameter @Size(min = 2, max = 4) String[] minMax);
4348

49+
@Status("204")
4450
@Mapping("/endpoint/obj")
4551
void postEndpointObj(@Parameter @Valid Obj1 body);
4652

53+
@Status("204")
4754
@Mapping("/endpoint/pattern")
4855
void getEndpointPattern(@Parameter @Pattern(regexp = ".*\\.\\\\") String anything);
4956

57+
@Status("204")
5058
@Mapping("/endpoint/email")
5159
void getEndpointEmail(@Parameter @Email String anything);
5260

openapi-processor-core/src/testInt/resources/tests/endpoint-exclude/outputs/api/Api.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import annotation.Mapping;
44
import annotation.Parameter;
5+
import annotation.Status;
56
import generated.support.Generated;
67

78
@Generated(value = "openapi-processor-core", version = "test")
89
public interface Api {
910

11+
@Status("204")
1012
@Mapping("/endpoint/{foo}")
1113
void getEndpointFoo(@Parameter String foo);
1214

openapi-processor-core/src/testInt/resources/tests/endpoint-exclude/outputs/api/ExcludedApi.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import annotation.Mapping;
44
import annotation.Parameter;
5+
import annotation.Status;
56
import generated.support.Generated;
67

78
@Generated(value = "openapi-processor-core", version = "test")
89
public interface ExcludedApi {
910

11+
@Status("204")
1012
@Mapping("/endpoint-exclude/{foo}")
1113
void getEndpointExcludeFoo(@Parameter String foo);
1214

0 commit comments

Comments
 (0)