-
-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'repro/rest-enum-array-param' of https://github.com/Park…
…erM/springdoc-openapi into ParkerM-repro/rest-enum-array-param
- Loading branch information
Showing
4 changed files
with
286 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
springdoc-openapi-data-rest/src/test/java/test/org/springdoc/api/app36/EnumFieldHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* | ||
* * Copyright 2019-2022 the original author or authors. | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * https://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package test.org.springdoc.api.app36; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.Id; | ||
|
||
@Entity | ||
public class EnumFieldHolder { | ||
|
||
public enum EnumField { | ||
|
||
FOO, BAR; | ||
|
||
} | ||
|
||
@Id | ||
@GeneratedValue | ||
private Long id; | ||
|
||
private EnumField enumField; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public EnumField getEnumField() { | ||
return enumField; | ||
} | ||
|
||
public void setEnumField(EnumField enumField) { | ||
this.enumField = enumField; | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
...enapi-data-rest/src/test/java/test/org/springdoc/api/app36/EnumFieldHolderRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* | ||
* * Copyright 2019-2022 the original author or authors. | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * https://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package test.org.springdoc.api.app36; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.repository.Repository; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.data.rest.core.annotation.RepositoryRestResource; | ||
import org.springframework.data.util.Streamable; | ||
|
||
@RepositoryRestResource | ||
public interface EnumFieldHolderRepository extends Repository<EnumFieldHolder, Long> { | ||
|
||
Streamable<EnumFieldHolder> findAllByEnumField(@Param("enumField") EnumFieldHolder.EnumField enumField); | ||
|
||
Streamable<EnumFieldHolder> findAllByEnumFieldIn(@Param("enumFields") List<EnumFieldHolder.EnumField> enumFields); | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...gdoc-openapi-data-rest/src/test/java/test/org/springdoc/api/app36/SpringDocApp36Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* | ||
* * Copyright 2019-2022 the original author or authors. | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * https://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package test.org.springdoc.api.app36; | ||
|
||
import test.org.springdoc.api.AbstractSpringDocTest; | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
public class SpringDocApp36Test extends AbstractSpringDocTest { | ||
|
||
@SpringBootApplication | ||
static class SpringDocTestApp { | ||
|
||
} | ||
|
||
} |
167 changes: 167 additions & 0 deletions
167
springdoc-openapi-data-rest/src/test/resources/results/app36.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "OpenAPI definition", | ||
"version": "v0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "http://localhost", | ||
"description": "Generated server url" | ||
} | ||
], | ||
"paths": { | ||
"/enumFieldHolders/search/findAllByEnumField": { | ||
"get": { | ||
"tags": [ | ||
"enum-field-holder-search-controller" | ||
], | ||
"operationId": "executeSearch-enumfieldholder-get", | ||
"parameters": [ | ||
{ | ||
"name": "enumField", | ||
"in": "query", | ||
"schema": { | ||
"type": "string", | ||
"enum": [ | ||
"FOO", | ||
"BAR" | ||
] | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"application/hal+json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/CollectionModelEntityModelEnumFieldHolder" | ||
} | ||
} | ||
} | ||
}, | ||
"404": { | ||
"description": "Not Found" | ||
} | ||
} | ||
} | ||
}, | ||
"/enumFieldHolders/search/findAllByEnumFieldIn": { | ||
"get": { | ||
"tags": [ | ||
"enum-field-holder-search-controller" | ||
], | ||
"operationId": "executeSearch-enumfieldholder-get_1", | ||
"parameters": [ | ||
{ | ||
"name": "enumFields", | ||
"in": "query", | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"enum": [ | ||
"FOO", | ||
"BAR" | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"application/hal+json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/CollectionModelEntityModelEnumFieldHolder" | ||
} | ||
} | ||
} | ||
}, | ||
"404": { | ||
"description": "Not Found" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"CollectionModelEntityModelEnumFieldHolder": { | ||
"type": "object", | ||
"properties": { | ||
"_embedded": { | ||
"type": "object", | ||
"properties": { | ||
"enumFieldHolders": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/components/schemas/EntityModelEnumFieldHolder" | ||
} | ||
} | ||
} | ||
}, | ||
"_links": { | ||
"$ref": "#/components/schemas/Links" | ||
} | ||
} | ||
}, | ||
"EntityModelEnumFieldHolder": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"format": "int64" | ||
}, | ||
"enumField": { | ||
"type": "string", | ||
"enum": [ | ||
"FOO", | ||
"BAR" | ||
] | ||
}, | ||
"_links": { | ||
"$ref": "#/components/schemas/Links" | ||
} | ||
} | ||
}, | ||
"Link": { | ||
"type": "object", | ||
"properties": { | ||
"deprecation": { | ||
"type": "string" | ||
}, | ||
"href": { | ||
"type": "string" | ||
}, | ||
"hreflang": { | ||
"type": "string" | ||
}, | ||
"name": { | ||
"type": "string" | ||
}, | ||
"profile": { | ||
"type": "string" | ||
}, | ||
"templated": { | ||
"type": "boolean" | ||
}, | ||
"title": { | ||
"type": "string" | ||
}, | ||
"type": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"Links": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/components/schemas/Link" | ||
} | ||
} | ||
} | ||
} | ||
} |