Skip to content

Commit 189dcdc

Browse files
committed
corrected expected output
1 parent 7a6ba78 commit 189dcdc

4 files changed

Lines changed: 45 additions & 7 deletions

File tree

src/testInt/resources/params-enum/generated/api/EnumApi.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55

66
package generated.api;
77

8+
import generated.model.Bar;
89
import generated.model.Foo;
910
import org.springframework.http.ResponseEntity;
1011
import org.springframework.web.bind.annotation.GetMapping;
11-
import org.springframework.web.bind.annotation.PathVariable;
12+
import org.springframework.web.bind.annotation.RequestParam;
1213

13-
public interface EndpointApi {
14+
public interface EnumApi {
1415

1516
@GetMapping(path = "/endpoint")
16-
ResponseEntity<void> getEndpointFoo(@PathVariable(name = "foo") Foo foo);
17+
ResponseEntity<void> getEndpoint(@RequestParam(name = "foo") Foo foo, @RequestParam(name = "bar") Bar bar);
1718

1819
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* This class is auto generated by https://github.com/hauner/openapi-generatr-spring.
3+
* DO NOT EDIT.
4+
*/
5+
6+
package generated.model;
7+
8+
public enum Bar {
9+
10+
BAR("bar"),
11+
BAR_2("bar-2"),
12+
BAR_BAR("bar-bar");
13+
14+
private final String value;
15+
16+
private Bar(String value) {
17+
this.value = value;
18+
}
19+
20+
@JsonValue
21+
public String getValue() {
22+
return this.value;
23+
}
24+
25+
@JsonCreator
26+
public static Bar fromValue(String value) {
27+
for (Bar val: Bar.values()) {
28+
if (val.value.equals(value)) {
29+
return val;
30+
}
31+
}
32+
throw new IllegalArgumentException(value);
33+
}
34+
35+
}

src/testInt/resources/params-enum/generated/model/Foo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* DO NOT EDIT.
44
*/
55

6-
package generated.api;
6+
package generated.model;
77

8-
public static enum Foo {
8+
public enum Foo {
99

1010
FOO("foo"),
11-
BAR("bar"),
12-
FOO_BAR("foo-bar");
11+
FOO_2("foo-2"),
12+
FOO_FOO("foo-foo");
1313

1414
private final String value;
1515

src/testInt/resources/params-enum/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ paths:
1313
- name: foo
1414
description: enum parameter
1515
in: query
16+
required: true
1617
schema:
1718
type: string
1819
enum:
@@ -22,6 +23,7 @@ paths:
2223
- name: bar
2324
description: enum parameter
2425
in: query
26+
required: true
2527
schema:
2628
$ref: '#/components/schemas/Bar'
2729
responses:

0 commit comments

Comments
 (0)