Skip to content
Open
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
Expand Up @@ -439,7 +439,7 @@ private TypeAndTypeAnnotations resolveTypeAndTypeAnnotationsForParameter(MethodP
&& delegatingMethodParameter.getField() != null) {
AnnotatedType annotated = delegatingMethodParameter.getField().getAnnotatedType();
Type type = GenericTypeResolver.resolveType(annotated.getType(), methodParameter.getContainingClass());
return new TypeAndTypeAnnotations(type, annotationsFromAnnotatedTypeArguments(annotated));
return new TypeAndTypeAnnotations(type, annotationsFromAnnotatedType(annotated));
}

Type type = GenericTypeResolver.resolveType(methodParameter.getGenericParameterType(), methodParameter.getContainingClass());
Expand All @@ -462,6 +462,20 @@ private TypeAndTypeAnnotations resolveTypeAndTypeAnnotationsForParameter(MethodP
private record TypeAndTypeAnnotations(Type type, Annotation[] typeAnnotations) {
}

/**
* Collects annotations declared on the type itself and on each type argument of an
* {@link AnnotatedParameterizedType}.
*
* @param annotatedType the annotated type
* @return a new array, possibly empty
*/
private static Annotation[] annotationsFromAnnotatedType(AnnotatedType annotatedType) {
return Stream.concat(
Arrays.stream(annotatedType.getAnnotations()),
Arrays.stream(annotationsFromAnnotatedTypeArguments(annotatedType)))
.toArray(Annotation[]::new);
}

/**
* Collects annotations declared on each type argument of an {@link AnnotatedParameterizedType}.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
*
* *
* * *
* * * *
* * * * *
* * * * * * Copyright 2019-2026 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.v31.app175;

import org.springdoc.core.annotations.ParameterObject;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
class HelloController {

@GetMapping("/vets")
public void find(@ParameterObject SearchCriteria searchCriteria) {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
*
* *
* * *
* * * *
* * * * *
* * * * * * Copyright 2019-2026 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.v31.app175;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.TYPE_USE)
@Retention(RetentionPolicy.RUNTIME)
@interface Nullable {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
*
* *
* * *
* * * *
* * * * *
* * * * * * Copyright 2019-2026 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.v31.app175;

import io.swagger.v3.oas.annotations.Parameter;

class SearchCriteria {

@Parameter(description = "Statuses to filter by.")
private Status @Nullable [] status;

public Status[] getStatus() {
return status;
}

public void setStatus(Status[] status) {
this.status = status;
}

enum Status {

ACTIVE,

INACTIVE

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
*
* *
* * *
* * * *
* * * * *
* * * * * * Copyright 2019-2026 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.v31.app175;

import test.org.springdoc.api.v31.AbstractSpringDocTest;

import org.springframework.boot.autoconfigure.SpringBootApplication;

class SpringDocApp175Test extends AbstractSpringDocTest {

@SpringBootApplication
static class SpringDocTestApp {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"openapi": "3.1.0",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "http://localhost",
"description": "Generated server url"
}
],
"paths": {
"/vets": {
"get": {
"tags": [
"hello-controller"
],
"operationId": "find",
"parameters": [
{
"name": "status",
"in": "query",
"description": "Statuses to filter by.",
"required": false,
"schema": {
"type": [
"array",
"null"
],
"items": {
"type": "string",
"enum": [
"ACTIVE",
"INACTIVE"
]
}
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"components": {}
}