Skip to content

Commit e5039ff

Browse files
committed
Merge branch 'repro/rest-enum-array-param' of https://github.com/ParkerM/springdoc-openapi into ParkerM-repro/rest-enum-array-param
2 parents 78e136e + 42d3dbd commit e5039ff

File tree

4 files changed

+286
-0
lines changed

4 files changed

+286
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
*
3+
* * Copyright 2019-2022 the original author or authors.
4+
* *
5+
* * Licensed under the Apache License, Version 2.0 (the "License");
6+
* * you may not use this file except in compliance with the License.
7+
* * You may obtain a copy of the License at
8+
* *
9+
* * https://www.apache.org/licenses/LICENSE-2.0
10+
* *
11+
* * Unless required by applicable law or agreed to in writing, software
12+
* * distributed under the License is distributed on an "AS IS" BASIS,
13+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* * See the License for the specific language governing permissions and
15+
* * limitations under the License.
16+
*
17+
*/
18+
19+
package test.org.springdoc.api.app36;
20+
21+
import javax.persistence.Entity;
22+
import javax.persistence.GeneratedValue;
23+
import javax.persistence.Id;
24+
25+
@Entity
26+
public class EnumFieldHolder {
27+
28+
public enum EnumField {
29+
30+
FOO, BAR;
31+
32+
}
33+
34+
@Id
35+
@GeneratedValue
36+
private Long id;
37+
38+
private EnumField enumField;
39+
40+
public Long getId() {
41+
return id;
42+
}
43+
44+
public EnumField getEnumField() {
45+
return enumField;
46+
}
47+
48+
public void setEnumField(EnumField enumField) {
49+
this.enumField = enumField;
50+
}
51+
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
*
3+
* * Copyright 2019-2022 the original author or authors.
4+
* *
5+
* * Licensed under the Apache License, Version 2.0 (the "License");
6+
* * you may not use this file except in compliance with the License.
7+
* * You may obtain a copy of the License at
8+
* *
9+
* * https://www.apache.org/licenses/LICENSE-2.0
10+
* *
11+
* * Unless required by applicable law or agreed to in writing, software
12+
* * distributed under the License is distributed on an "AS IS" BASIS,
13+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* * See the License for the specific language governing permissions and
15+
* * limitations under the License.
16+
*
17+
*/
18+
19+
package test.org.springdoc.api.app36;
20+
21+
import java.util.List;
22+
23+
import org.springframework.data.repository.Repository;
24+
import org.springframework.data.repository.query.Param;
25+
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
26+
import org.springframework.data.util.Streamable;
27+
28+
@RepositoryRestResource
29+
public interface EnumFieldHolderRepository extends Repository<EnumFieldHolder, Long> {
30+
31+
Streamable<EnumFieldHolder> findAllByEnumField(@Param("enumField") EnumFieldHolder.EnumField enumField);
32+
33+
Streamable<EnumFieldHolder> findAllByEnumFieldIn(@Param("enumFields") List<EnumFieldHolder.EnumField> enumFields);
34+
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
*
3+
* * Copyright 2019-2022 the original author or authors.
4+
* *
5+
* * Licensed under the Apache License, Version 2.0 (the "License");
6+
* * you may not use this file except in compliance with the License.
7+
* * You may obtain a copy of the License at
8+
* *
9+
* * https://www.apache.org/licenses/LICENSE-2.0
10+
* *
11+
* * Unless required by applicable law or agreed to in writing, software
12+
* * distributed under the License is distributed on an "AS IS" BASIS,
13+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* * See the License for the specific language governing permissions and
15+
* * limitations under the License.
16+
*
17+
*/
18+
19+
package test.org.springdoc.api.app36;
20+
21+
import test.org.springdoc.api.AbstractSpringDocTest;
22+
23+
import org.springframework.boot.autoconfigure.SpringBootApplication;
24+
25+
public class SpringDocApp36Test extends AbstractSpringDocTest {
26+
27+
@SpringBootApplication
28+
static class SpringDocTestApp {
29+
30+
}
31+
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
{
2+
"openapi": "3.0.1",
3+
"info": {
4+
"title": "OpenAPI definition",
5+
"version": "v0"
6+
},
7+
"servers": [
8+
{
9+
"url": "http://localhost",
10+
"description": "Generated server url"
11+
}
12+
],
13+
"paths": {
14+
"/enumFieldHolders/search/findAllByEnumField": {
15+
"get": {
16+
"tags": [
17+
"enum-field-holder-search-controller"
18+
],
19+
"operationId": "executeSearch-enumfieldholder-get",
20+
"parameters": [
21+
{
22+
"name": "enumField",
23+
"in": "query",
24+
"schema": {
25+
"type": "string",
26+
"enum": [
27+
"FOO",
28+
"BAR"
29+
]
30+
}
31+
}
32+
],
33+
"responses": {
34+
"200": {
35+
"description": "OK",
36+
"content": {
37+
"application/hal+json": {
38+
"schema": {
39+
"$ref": "#/components/schemas/CollectionModelEntityModelEnumFieldHolder"
40+
}
41+
}
42+
}
43+
},
44+
"404": {
45+
"description": "Not Found"
46+
}
47+
}
48+
}
49+
},
50+
"/enumFieldHolders/search/findAllByEnumFieldIn": {
51+
"get": {
52+
"tags": [
53+
"enum-field-holder-search-controller"
54+
],
55+
"operationId": "executeSearch-enumfieldholder-get_1",
56+
"parameters": [
57+
{
58+
"name": "enumFields",
59+
"in": "query",
60+
"schema": {
61+
"type": "array",
62+
"items": {
63+
"type": "string",
64+
"enum": [
65+
"FOO",
66+
"BAR"
67+
]
68+
}
69+
}
70+
}
71+
],
72+
"responses": {
73+
"200": {
74+
"description": "OK",
75+
"content": {
76+
"application/hal+json": {
77+
"schema": {
78+
"$ref": "#/components/schemas/CollectionModelEntityModelEnumFieldHolder"
79+
}
80+
}
81+
}
82+
},
83+
"404": {
84+
"description": "Not Found"
85+
}
86+
}
87+
}
88+
}
89+
},
90+
"components": {
91+
"schemas": {
92+
"CollectionModelEntityModelEnumFieldHolder": {
93+
"type": "object",
94+
"properties": {
95+
"_embedded": {
96+
"type": "object",
97+
"properties": {
98+
"enumFieldHolders": {
99+
"type": "array",
100+
"items": {
101+
"$ref": "#/components/schemas/EntityModelEnumFieldHolder"
102+
}
103+
}
104+
}
105+
},
106+
"_links": {
107+
"$ref": "#/components/schemas/Links"
108+
}
109+
}
110+
},
111+
"EntityModelEnumFieldHolder": {
112+
"type": "object",
113+
"properties": {
114+
"id": {
115+
"type": "integer",
116+
"format": "int64"
117+
},
118+
"enumField": {
119+
"type": "string",
120+
"enum": [
121+
"FOO",
122+
"BAR"
123+
]
124+
},
125+
"_links": {
126+
"$ref": "#/components/schemas/Links"
127+
}
128+
}
129+
},
130+
"Link": {
131+
"type": "object",
132+
"properties": {
133+
"deprecation": {
134+
"type": "string"
135+
},
136+
"href": {
137+
"type": "string"
138+
},
139+
"hreflang": {
140+
"type": "string"
141+
},
142+
"name": {
143+
"type": "string"
144+
},
145+
"profile": {
146+
"type": "string"
147+
},
148+
"templated": {
149+
"type": "boolean"
150+
},
151+
"title": {
152+
"type": "string"
153+
},
154+
"type": {
155+
"type": "string"
156+
}
157+
}
158+
},
159+
"Links": {
160+
"type": "object",
161+
"additionalProperties": {
162+
"$ref": "#/components/schemas/Link"
163+
}
164+
}
165+
}
166+
}
167+
}

0 commit comments

Comments
 (0)