File tree Expand file tree Collapse file tree
src/testInt/resources/params-enum Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66package generated .api ;
77
8+ import generated .model .Bar ;
89import generated .model .Foo ;
910import org .springframework .http .ResponseEntity ;
1011import 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}
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 1313 - name : foo
1414 description : enum parameter
1515 in : query
16+ required : true
1617 schema :
1718 type : string
1819 enum :
2223 - name : bar
2324 description : enum parameter
2425 in : query
26+ required : true
2527 schema :
2628 $ref : ' #/components/schemas/Bar'
2729 responses :
You can’t perform that action at this time.
0 commit comments