Skip to content

Add failing test case for enum collection parameter issue #2001 #2002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
}
}
}
}