Skip to content

Commit

Permalink
Merge branch 'repro/rest-enum-array-param' of https://github.com/Park…
Browse files Browse the repository at this point in the history
…erM/springdoc-openapi into ParkerM-repro/rest-enum-array-param
  • Loading branch information
bnasslahsen committed Dec 15, 2022
2 parents 78e136e + 42d3dbd commit e5039ff
Show file tree
Hide file tree
Showing 4 changed files with 286 additions and 0 deletions.
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;
}

}
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);

}
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 springdoc-openapi-data-rest/src/test/resources/results/app36.json
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"
}
}
}
}
}

0 comments on commit e5039ff

Please sign in to comment.