getConditionsToMatch(ConditionType conditionType, GroupConf
* Is filter condition boolean.
*
* @param operationPath the operation path
- * @param produces the produces
- * @param consumes the consumes
- * @param headers the headers
+ * @param produces the produces
+ * @param consumes the consumes
+ * @param headers the headers
* @return the boolean
*/
private boolean isFilterCondition(String operationPath, String[] produces, String[] consumes, String[] headers) {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/api/ErrorMessage.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/api/ErrorMessage.java
index 35c9d48a9..034d96972 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/api/ErrorMessage.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/api/ErrorMessage.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.api;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/api/OpenApiResourceNotFoundException.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/api/OpenApiResourceNotFoundException.java
index 10d77eea4..cff51003c 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/api/OpenApiResourceNotFoundException.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/api/OpenApiResourceNotFoundException.java
@@ -3,29 +3,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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.api;
/**
* The type Open api resource not found exception.
+ *
* @author bnasslahsen
*/
public class OpenApiResourceNotFoundException extends RuntimeException {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/ParameterObject.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/ParameterObject.java
index 0fe189eb3..6693bb7c6 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/ParameterObject.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/ParameterObject.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.annotations;
@@ -31,6 +33,7 @@
/**
* The interface Parameter object.
+ *
* @author bnasslahsen
*/
@Target({ ElementType.PARAMETER, ElementType.TYPE })
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/RouterOperation.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/RouterOperation.java
index cb7364ea2..0a8540d50 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/RouterOperation.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/RouterOperation.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.annotations;
@@ -48,6 +50,7 @@
/**
* The path mapping URIs (e.g. {@code "/profile"}).
* Path mapping URIs may contain placeholders (e.g. "/${profile_path}").
+ *
* @return the string
*/
String path() default "";
@@ -55,6 +58,7 @@
/**
* The HTTP request methods to map to, narrowing the primary mapping:
* GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE, TRACE.
+ *
* @return the request method [ ]
*/
RequestMethod[] method() default {};
@@ -68,6 +72,7 @@
* consumes = {"text/plain", "application/*"}
* consumes = MediaType.TEXT_PLAIN_VALUE
*
+ *
* @return the string [ ]
*/
String[] consumes() default {};
@@ -84,6 +89,7 @@
* produces = MediaType.TEXT_PLAIN_VALUE
* produces = "text/plain;charset=UTF-8"
*
+ *
* @return the string [ ]
*/
String[] produces() default {};
@@ -93,6 +99,7 @@
* Same format for any environment: a sequence of "My-Header=myValue" style
* expressions, with a request only mapped if each such header is found
* to have the given value.
+ *
* @return the string [ ]
*/
String[] headers() default {};
@@ -101,24 +108,28 @@
* The parameters of the mapped request, narrowing the primary mapping.
* Same format for any environment: a sequence of "myParam=myValue" style expressions,
* with a request only mapped if each such parameter is found to have the given value.
+ *
* @return the string [ ]
*/
String[] params() default {};
/**
* The class of the Handler bean.
+ *
* @return the class of the Bean
*/
Class> beanClass() default Void.class;
/**
* The method of the handler Bean.
+ *
* @return The method of the handler Bean.
*/
String beanMethod() default "";
/**
* The parameters of the handler method.
+ *
* @return The parameters of the handler method.
*/
Class>[] parameterTypes() default {};
@@ -126,6 +137,7 @@
/**
* The swagger operation description
* Alias for {@link Operation}.
+ *
* @return The operation
*/
Operation operation() default @Operation();
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/RouterOperations.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/RouterOperations.java
index 175a76916..f2241a337 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/RouterOperations.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/annotations/RouterOperations.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.annotations;
@@ -36,7 +38,7 @@
* Container for repeatable {@link RouterOperation} annotation
*
* @author bnasslahsen
- * @see RouterOperation
+ * @see RouterOperation
*/
@Target({ METHOD, ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/CacheOrGroupedOpenApiCondition.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/CacheOrGroupedOpenApiCondition.java
index 79497ccdc..b4d95e0ff 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/CacheOrGroupedOpenApiCondition.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/CacheOrGroupedOpenApiCondition.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.conditions;
@@ -35,6 +37,7 @@
/**
* The type Cache or grouped open api condition.
+ *
* @author bnasslahsen
*/
public class CacheOrGroupedOpenApiCondition extends AnyNestedCondition {
@@ -48,6 +51,7 @@ public class CacheOrGroupedOpenApiCondition extends AnyNestedCondition {
/**
* The type On multiple open api support condition.
+ *
* @author bnasslahsen
*/
@Conditional(MultipleOpenApiSupportCondition.class)
@@ -55,6 +59,7 @@ static class OnMultipleOpenApiSupportCondition {}
/**
* The type On cache disabled.
+ *
* @author bnasslahsen
*/
@ConditionalOnProperty(name = SPRINGDOC_CACHE_DISABLED)
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/MultipleOpenApiGroupsCondition.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/MultipleOpenApiGroupsCondition.java
index 63a1ab686..27123ae9a 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/MultipleOpenApiGroupsCondition.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/MultipleOpenApiGroupsCondition.java
@@ -3,27 +3,31 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.conditions;
+import java.util.Collection;
+
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
@@ -34,6 +38,7 @@
/**
* The type Multiple open api support condition.
+ *
* @author bnasslahsen
*/
public class MultipleOpenApiGroupsCondition extends AnyNestedCondition {
@@ -47,6 +52,7 @@ public class MultipleOpenApiGroupsCondition extends AnyNestedCondition {
/**
* The type On grouped open api bean.
+ *
* @author bnasslahsen
*/
@ConditionalOnBean(GroupedOpenApi.class)
@@ -54,9 +60,15 @@ static class OnGroupedOpenApiBean {}
/**
* The type On group config property.
+ *
* @author bnasslahsen
*/
@ConditionalOnProperty(name = GROUP_CONFIG_FIRST_PROPERTY)
static class OnGroupConfigProperty {}
+ /**
+ * The type On list grouped open api bean.
+ */
+ @ConditionalOnBean(value = GroupedOpenApi.class, parameterizedContainer = Collection.class)
+ static class OnListGroupedOpenApiBean {}
}
\ No newline at end of file
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/MultipleOpenApiSupportCondition.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/MultipleOpenApiSupportCondition.java
index bf2136c0b..77239a9f0 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/MultipleOpenApiSupportCondition.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/MultipleOpenApiSupportCondition.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.conditions;
@@ -34,6 +36,7 @@
/**
* The type Multiple open api support condition.
+ *
* @author bnasslashen
*/
public class MultipleOpenApiSupportCondition extends AnyNestedCondition {
@@ -47,6 +50,7 @@ public class MultipleOpenApiSupportCondition extends AnyNestedCondition {
/**
* The type On multiple open api support condition.
+ *
* @author bnasslahsen
*/
@Conditional(MultipleOpenApiGroupsCondition.class)
@@ -54,6 +58,7 @@ static class OnMultipleOpenApiSupportCondition {}
/**
* The type On actuator different port.
+ *
* @author bnasslashen
*/
@ConditionalOnManagementPort(ManagementPortType.DIFFERENT)
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/SpecPropertiesCondition.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/SpecPropertiesCondition.java
index f7bc019fd..def8a40d9 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/SpecPropertiesCondition.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/conditions/SpecPropertiesCondition.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.conditions;
/**
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocConfiguration.java
index 3a51f92e2..15dcd9014 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocConfiguration.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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.
* * * *
* * *
* *
- *
+ *
*/
@@ -31,6 +33,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.querydsl.core.types.Predicate;
@@ -54,7 +57,6 @@
import org.springdoc.core.converters.ResponseSupportConverter;
import org.springdoc.core.converters.SchemaPropertyDeprecatingConverter;
import org.springdoc.core.converters.WebFluxSupportConverter;
-import org.springdoc.core.customizers.ActuatorOpenApiCustomizer;
import org.springdoc.core.customizers.ActuatorOperationCustomizer;
import org.springdoc.core.customizers.DataRestRouterOperationCustomizer;
import org.springdoc.core.customizers.DelegatingMethodParameterCustomizer;
@@ -63,6 +65,8 @@
import org.springdoc.core.customizers.OpenApiBuilderCustomizer;
import org.springdoc.core.customizers.OpenApiCustomizer;
import org.springdoc.core.customizers.OperationCustomizer;
+import org.springdoc.core.customizers.OperationIdCustomizer;
+import org.springdoc.core.customizers.ParameterObjectNamingStrategyCustomizer;
import org.springdoc.core.customizers.PropertyCustomizer;
import org.springdoc.core.customizers.QuerydslPredicateOperationCustomizer;
import org.springdoc.core.customizers.RouterOperationCustomizer;
@@ -72,7 +76,6 @@
import org.springdoc.core.filters.GlobalOpenApiMethodFilter;
import org.springdoc.core.filters.OpenApiMethodFilter;
import org.springdoc.core.models.GroupedOpenApi;
-import org.springdoc.core.parsers.ReturnTypeParser;
import org.springdoc.core.properties.SpringDocConfigProperties;
import org.springdoc.core.providers.ActuatorProvider;
import org.springdoc.core.providers.CloudFunctionProvider;
@@ -131,6 +134,7 @@
/**
* The type Spring doc configuration.
+ *
* @author bnasslahsen
*/
@Lazy(false)
@@ -269,13 +273,13 @@ PolymorphicModelConverter polymorphicModelConverter(ObjectMapperProvider objectM
/**
* Open api builder open api builder.
*
- * @param openAPI the open api
- * @param securityParser the security parser
+ * @param openAPI the open api
+ * @param securityParser the security parser
* @param springDocConfigProperties the spring doc config properties
- * @param propertyResolverUtils the property resolver utils
+ * @param propertyResolverUtils the property resolver utils
* @param openApiBuilderCustomisers the open api builder customisers
- * @param serverBaseUrlCustomisers the server base url customisers
- * @param javadocProvider the javadoc provider
+ * @param serverBaseUrlCustomisers the server base url customisers
+ * @param javadocProvider the javadoc provider
* @return the open api builder
*/
@Bean
@@ -305,9 +309,9 @@ ModelConverterRegistrar modelConverterRegistrar(Optional> m
/**
* Operation builder operation service.
*
- * @param parameterBuilder the parameter builder
- * @param requestBodyService the request body service
- * @param securityParser the security parser
+ * @param parameterBuilder the parameter builder
+ * @param requestBodyService the request body service
+ * @param securityParser the security parser
* @param propertyResolverUtils the property resolver utils
* @return the operation service
*/
@@ -323,8 +327,8 @@ OperationService operationBuilder(GenericParameterService parameterBuilder, Requ
/**
* Property resolver utils property resolver utils.
*
- * @param factory the factory
- * @param messageSource the message source
+ * @param factory the factory
+ * @param messageSource the message source
* @param springDocConfigProperties the spring doc config properties
* @return the property resolver utils
*/
@@ -337,7 +341,8 @@ PropertyResolverUtils propertyResolverUtils(ConfigurableBeanFactory factory, Mes
/**
* Request body builder request body builder.
*
- * @param parameterBuilder the parameter builder
+ * @param parameterBuilder the parameter builder
+ * @param propertyResolverUtils the property resolver utils
* @return the request body builder
*/
@Bean
@@ -360,34 +365,23 @@ SecurityService securityParser(PropertyResolverUtils propertyResolverUtils) {
return new SecurityService(propertyResolverUtils);
}
- /**
- * Generic return type parser return type parser.
- *
- * @return the return type parser
- */
- @Bean
- @Lazy(false)
- ReturnTypeParser genericReturnTypeParser() {
- return new ReturnTypeParser() {};
- }
-
/**
* Parameter builder generic parameter builder.
*
- * @param propertyResolverUtils the property resolver utils
- * @param optionalDelegatingMethodParameterCustomizer the optional delegating method parameter customizer
- * @param optionalWebConversionServiceProvider the optional web conversion service provider
- * @param objectMapperProvider the object mapper provider
- * @param javadocProvider the javadoc provider
+ * @param propertyResolverUtils the property resolver utils
+ * @param optionalDelegatingMethodParameterCustomizers the optional list delegating method parameter customizer
+ * @param optionalWebConversionServiceProvider the optional web conversion service provider
+ * @param objectMapperProvider the object mapper provider
+ * @param javadocProvider the javadoc provider
* @return the generic parameter builder
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
GenericParameterService parameterBuilder(PropertyResolverUtils propertyResolverUtils,
- Optional optionalDelegatingMethodParameterCustomizer,
+ Optional> optionalDelegatingMethodParameterCustomizers,
Optional optionalWebConversionServiceProvider, ObjectMapperProvider objectMapperProvider, Optional javadocProvider) {
- return new GenericParameterService(propertyResolverUtils, optionalDelegatingMethodParameterCustomizer,
+ return new GenericParameterService(propertyResolverUtils, optionalDelegatingMethodParameterCustomizers,
optionalWebConversionServiceProvider, objectMapperProvider, javadocProvider);
}
@@ -412,14 +406,13 @@ GlobalOpenApiCustomizer propertiesResolverForSchema(OpenAPIService openAPIServic
/**
* Spring doc providers spring doc providers.
*
- * @param actuatorProvider the actuator provider
- * @param springCloudFunctionProvider the spring cloud function provider
- * @param springSecurityOAuth2Provider the spring security o auth 2 provider
+ * @param actuatorProvider the actuator provider
+ * @param springCloudFunctionProvider the spring cloud function provider
+ * @param springSecurityOAuth2Provider the spring security o auth 2 provider
* @param repositoryRestResourceProvider the repository rest resource provider
- * @param routerFunctionProvider the router function provider
- * @param springWebProvider the spring web provider
- * @param webConversionServiceProvider the web conversion service provider
- * @param objectMapperProvider the object mapper provider
+ * @param routerFunctionProvider the router function provider
+ * @param springWebProvider the spring web provider
+ * @param objectMapperProvider the object mapper provider
* @return the spring doc providers
*/
@Bean
@@ -427,10 +420,10 @@ GlobalOpenApiCustomizer propertiesResolverForSchema(OpenAPIService openAPIServic
@Lazy(false)
SpringDocProviders springDocProviders(Optional actuatorProvider, Optional springCloudFunctionProvider, Optional springSecurityOAuth2Provider,
Optional repositoryRestResourceProvider, Optional routerFunctionProvider,
- Optional springWebProvider, Optional webConversionServiceProvider,
+ Optional springWebProvider,
ObjectMapperProvider objectMapperProvider) {
objectMapperProvider.jsonMapper().registerModule(new SpringDocRequiredModule());
- return new SpringDocProviders(actuatorProvider, springCloudFunctionProvider, springSecurityOAuth2Provider, repositoryRestResourceProvider, routerFunctionProvider, springWebProvider, webConversionServiceProvider, objectMapperProvider);
+ return new SpringDocProviders(actuatorProvider, springCloudFunctionProvider, springSecurityOAuth2Provider, repositoryRestResourceProvider, routerFunctionProvider, springWebProvider, objectMapperProvider);
}
/**
@@ -448,6 +441,7 @@ ObjectMapperProvider springdocObjectMapperProvider(SpringDocConfigProperties spr
/**
* The type Spring doc web mvc actuator configuration.
+ *
* @author bnasslashen
*/
@ConditionalOnClass(WebEndpointProperties.class)
@@ -457,7 +451,7 @@ static class SpringDocActuatorConfiguration {
/**
* Springdoc bean factory post processor 3 bean factory post processor.
*
- * @param groupedOpenApis the grouped open apis
+ * @param groupedOpenApis the grouped open apis
* @return the bean factory post processor
*/
@Bean
@@ -481,23 +475,11 @@ GlobalOperationCustomizer actuatorCustomizer(SpringDocConfigProperties springDoc
return new ActuatorOperationCustomizer(springDocConfigProperties);
}
- /**
- * Actuator customizer OpenAPI customiser.
- *
- * @param webEndpointProperties the web endpoint properties
- * @return the OpenAPI customiser
- */
- @Bean
- @Lazy(false)
- @ConditionalOnManagementPort(ManagementPortType.SAME)
- GlobalOpenApiCustomizer actuatorOpenApiCustomizer(WebEndpointProperties webEndpointProperties) {
- return new ActuatorOpenApiCustomizer(webEndpointProperties);
- }
-
}
/**
* The type Web conversion service configuration.
+ *
* @author bnasslashen
*/
@ConditionalOnClass(WebConversionService.class)
@@ -576,6 +558,7 @@ WebFluxSupportConverter webFluxSupportConverter(ObjectMapperProvider objectMappe
/**
* The type Open api resource advice.
+ *
* @author bnasslashen
*/
@RestControllerAdvice
@@ -597,25 +580,26 @@ public ResponseEntity handleNoHandlerFound(OpenApiResourceNotFound
/**
* Spring doc customizers spring doc customizers.
*
- * @param openApiCustomizers the open api customizers
- * @param operationCustomizers the operation customizers
- * @param routerOperationCustomizers the router operation customizers
+ * @param openApiCustomizers the open api customizers
+ * @param operationCustomizers the operation customizers
+ * @param routerOperationCustomizers the router operation customizers
* @param dataRestRouterOperationCustomizers the data rest router operation customizers
- * @param methodFilters the method filters
- * @param globalOpenApiCustomizers the global open api customizers
- * @param globalOperationCustomizers the global operation customizers
- * @param globalOpenApiMethodFilters the global open api method filters
+ * @param methodFilters the method filters
+ * @param globalOpenApiCustomizers the global open api customizers
+ * @param globalOperationCustomizers the global operation customizers
+ * @param globalOpenApiMethodFilters the global open api method filters
* @return the spring doc customizers
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
- public SpringDocCustomizers springDocCustomizers(Optional> openApiCustomizers,
- Optional> operationCustomizers,
- Optional> routerOperationCustomizers,
- Optional> dataRestRouterOperationCustomizers,
- Optional> methodFilters, Optional> globalOpenApiCustomizers, Optional> globalOperationCustomizers,
- Optional> globalOpenApiMethodFilters){
+ public SpringDocCustomizers springDocCustomizers(Optional> openApiCustomizers,
+ Optional> operationCustomizers,
+ Optional> routerOperationCustomizers,
+ Optional> dataRestRouterOperationCustomizers,
+ Optional> methodFilters, Optional> globalOpenApiCustomizers,
+ Optional> globalOperationCustomizers,
+ Optional> globalOpenApiMethodFilters){
return new SpringDocCustomizers(openApiCustomizers,
operationCustomizers,
routerOperationCustomizers,
@@ -625,6 +609,7 @@ public SpringDocCustomizers springDocCustomizers(Optional repository
/**
* The type Spring repository rest resource provider configuration.
+ *
* @author bnasslashen
*/
@Lazy(false)
@@ -121,14 +125,14 @@ static class SpringRepositoryRestResourceProviderConfiguration {
/**
* Spring repository rest resource provider spring repository rest resource provider.
*
- * @param mappings the mappings
- * @param repositories the repositories
- * @param associations the associations
- * @param applicationContext the application context
+ * @param mappings the mappings
+ * @param repositories the repositories
+ * @param associations the associations
+ * @param applicationContext the application context
* @param dataRestRouterOperationService the data rest router operation service
- * @param persistentEntities the persistent entities
- * @param mapper the mapper
- * @param springDocDataRestUtils the spring doc data rest utils
+ * @param persistentEntities the persistent entities
+ * @param mapper the mapper
+ * @param springDocDataRestUtils the spring doc data rest utils
* @return the spring repository rest resource provider
*/
@Bean
@@ -145,10 +149,10 @@ SpringRepositoryRestResourceProvider springRepositoryRestResourceProvider(Resour
/**
* Data rest router operation builder data rest router operation service.
*
- * @param dataRestOperationService the data rest operation service
- * @param springDocConfigProperties the spring doc config properties
+ * @param dataRestOperationService the data rest operation service
+ * @param springDocConfigProperties the spring doc config properties
* @param repositoryRestConfiguration the repository rest configuration
- * @param dataRestHalProvider the data rest hal provider
+ * @param dataRestHalProvider the data rest hal provider
* @return the data rest router operation service
*/
@Bean
@@ -162,10 +166,10 @@ DataRestRouterOperationService dataRestRouterOperationBuilder(DataRestOperationS
/**
* Data rest operation builder data rest operation builder.
*
- * @param dataRestRequestService the data rest request builder
- * @param tagsBuilder the tags builder
+ * @param dataRestRequestService the data rest request builder
+ * @param tagsBuilder the tags builder
* @param dataRestResponseService the data rest response builder
- * @param operationService the operation service
+ * @param operationService the operation service
* @return the data rest operation builder
*/
@Bean
@@ -180,10 +184,10 @@ DataRestOperationService dataRestOperationBuilder(DataRestRequestService dataRes
* Data rest request builder data rest request builder.
*
* @param localSpringDocParameterNameDiscoverer the local spring doc parameter name discoverer
- * @param parameterBuilder the parameter builder
- * @param requestBodyService the request body builder
- * @param requestBuilder the request builder
- * @param springDocDataRestUtils the spring doc data rest utils
+ * @param parameterBuilder the parameter builder
+ * @param requestBodyService the request body builder
+ * @param requestBuilder the request builder
+ * @param springDocDataRestUtils the spring doc data rest utils
* @return the data rest request builder
*/
@Bean
@@ -225,7 +229,7 @@ DataRestTagsService dataRestTagsBuilder(OpenAPIService openAPIService) {
/**
* Spring doc data rest utils spring doc data rest utils.
*
- * @param linkRelationProvider the link relation provider
+ * @param linkRelationProvider the link relation provider
* @param repositoryRestConfiguration the repository rest configuration
* @return the spring doc data rest utils
*/
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocFunctionCatalogConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocFunctionCatalogConfiguration.java
index 6735bfe6d..7db8ef5d0 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocFunctionCatalogConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocFunctionCatalogConfiguration.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration;
@@ -43,6 +45,7 @@
/**
* The type Spring doc function catalog configuration.
+ *
* @author bnasslahsen
*/
@Lazy(false)
@@ -56,7 +59,7 @@ public class SpringDocFunctionCatalogConfiguration {
/**
* Spring cloud function provider spring cloud function provider.
*
- * @param functionCatalog the function catalog
+ * @param functionCatalog the function catalog
* @param springDocConfigProperties the spring doc config properties
* @return the spring cloud function provider
*/
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocGroovyConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocGroovyConfiguration.java
index 68d96b7fc..c98ac1227 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocGroovyConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocGroovyConfiguration.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration;
@@ -40,6 +42,7 @@
/**
* The type Spring doc groovy configuration.
+ *
* @author bnasslahsen
*/
@Lazy(false)
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocHateoasConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocHateoasConfiguration.java
index 54f13f9b2..f9ab95450 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocHateoasConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocHateoasConfiguration.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration;
@@ -52,6 +54,7 @@
/**
* The type Spring doc hateoas configuration.
+ *
* @author bnasslahsen
*/
@Lazy(false)
@@ -66,7 +69,7 @@ public class SpringDocHateoasConfiguration {
* Hateoas hal provider hateoas hal provider.
*
* @param hateoasPropertiesOptional the hateoas properties optional
- * @param objectMapperProvider the object mapper provider
+ * @param objectMapperProvider the object mapper provider
* @return the hateoas hal provider
*/
@Bean
@@ -79,7 +82,7 @@ HateoasHalProvider hateoasHalProvider(Optional hateoasPropert
/**
* Collection model content converter collection model content converter.
*
- * @param halProvider the hal provider
+ * @param halProvider the hal provider
* @param linkRelationProvider the link relation provider
* @return the collection model content converter
*/
@@ -94,11 +97,11 @@ CollectionModelContentConverter collectionModelContentConverter(HateoasHalProvid
* Registers an OpenApiCustomizer and a jackson mixin to ensure the definition of `Links` matches the serialized
* output. This is done because the customer serializer converts the data to a map before serializing it.
*
- * @param halProvider the hal provider
+ * @param halProvider the hal provider
* @param springDocConfigProperties the spring doc config properties
- * @param objectMapperProvider the object mapper provider
+ * @param objectMapperProvider the object mapper provider
* @return the open api customizer
- * @see org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider) org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)
+ * @see org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider) org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalLinkListSerializer#serialize(Links, JsonGenerator, SerializerProvider)
*/
@Bean(Constants.LINKS_SCHEMA_CUSTOMISER)
@ConditionalOnMissingBean(name = Constants.LINKS_SCHEMA_CUSTOMISER)
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocJacksonKotlinModuleConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocJacksonKotlinModuleConfiguration.java
index a8fb5b41a..bffa81467 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocJacksonKotlinModuleConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocJacksonKotlinModuleConfiguration.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.configuration;
import com.fasterxml.jackson.module.kotlin.KotlinModule;
@@ -24,14 +50,14 @@
@ConditionalOnExpression("${springdoc.api-docs.enabled:true} and ${springdoc.enable-kotlin:true}")
@ConditionalOnWebApplication
@ConditionalOnBean(SpringDocConfiguration.class)
-class SpringDocJacksonKotlinModuleConfiguration {
+public class SpringDocJacksonKotlinModuleConfiguration {
/**
* Instantiates a new objectMapperProvider with a kotlin module.
*
* @param springDocConfigProperties the spring doc config properties
+ * @return the object mapper provider
*/
-
@Bean
@Primary
ObjectMapperProvider springdocKotlinObjectMapperProvider(SpringDocConfigProperties springDocConfigProperties) {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocJavadocConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocJavadocConfiguration.java
index 76adbdcbf..9d94a0761 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocJavadocConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocJavadocConfiguration.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration;
@@ -38,9 +40,12 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
/**
* The type Spring doc security configuration.
+ *
* @author bnasslahsen
*/
@Lazy(false)
@@ -66,13 +71,14 @@ SpringDocJavadocProvider springDocJavadocProvider() {
/**
* Javadoc property customizer javadoc property customizer.
*
- * @param javadocProvider the javadoc provider
+ * @param javadocProvider the javadoc provider
* @param objectMapperProvider the object mapper provider
* @return the javadoc property customizer
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
+ @Order(Ordered.HIGHEST_PRECEDENCE)
JavadocPropertyCustomizer javadocPropertyCustomizer(JavadocProvider javadocProvider, ObjectMapperProvider objectMapperProvider) {
return new JavadocPropertyCustomizer(javadocProvider, objectMapperProvider);
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocKotlinConfiguration.kt b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocKotlinConfiguration.kt
index 7c7dd6070..dd0f423e8 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocKotlinConfiguration.kt
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocKotlinConfiguration.kt
@@ -1,9 +1,33 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.configuration
import io.swagger.v3.oas.annotations.Parameter
-import io.swagger.v3.oas.models.media.ByteArraySchema
import org.springdoc.core.customizers.ParameterCustomizer
-import org.springdoc.core.parsers.KotlinCoroutinesReturnTypeParser
import org.springdoc.core.utils.Constants
import org.springdoc.core.utils.SpringDocUtils
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean
@@ -44,22 +68,9 @@ class SpringDocKotlinConfiguration() {
init {
SpringDocUtils.getConfig()
.addRequestWrapperToIgnore(Continuation::class.java)
- .replaceWithSchema(ByteArray::class.java, ByteArraySchema())
.addDeprecatedType(Deprecated::class.java)
}
- /**
- * Kotlin coroutines return type parser kotlin coroutines return type parser.
- *
- * @return the kotlin coroutines return type parser
- */
- @Bean
- @Lazy(false)
- @ConditionalOnMissingBean
- fun kotlinCoroutinesReturnTypeParser(): KotlinCoroutinesReturnTypeParser {
- return KotlinCoroutinesReturnTypeParser()
- }
-
/**
* Kotlin springdoc-openapi ParameterCustomizer
*
@@ -92,9 +103,13 @@ class SpringDocKotlinConfiguration() {
// parameter is not required if a default value is provided in @RequestParam
else if (requestParam != null && requestParam.defaultValue != ValueConstants.DEFAULT_NONE)
parameterModel.required = false
- else
+ else{
+ val isJavaNullableAnnotationPresent = methodParameter.parameterAnnotations.any {
+ it.annotationClass.qualifiedName == "jakarta.annotation.Nullable"
+ }
parameterModel.required =
- kParameter.type.isMarkedNullable == false
+ kParameter.type.isMarkedNullable == false && !isJavaNullableAnnotationPresent
+ }
}
}
return@ParameterCustomizer parameterModel
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocKotlinxConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocKotlinxConfiguration.java
index f80b58154..62002637a 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocKotlinxConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocKotlinxConfiguration.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration;
@@ -37,6 +39,7 @@
/**
* The type Spring doc kotlinx configuration.
+ *
* @author bnasslahsen
*/
@Lazy(false)
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocPageableConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocPageableConfiguration.java
index 0dd0a9e50..7f1e351de 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocPageableConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocPageableConfiguration.java
@@ -3,32 +3,34 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration;
import java.util.Optional;
+import org.springdoc.core.converters.PageOpenAPIConverter;
import org.springdoc.core.converters.PageableOpenAPIConverter;
import org.springdoc.core.customizers.DataRestDelegatingMethodParameterCustomizer;
-import org.springdoc.core.customizers.DelegatingMethodParameterCustomizer;
import org.springdoc.core.providers.ObjectMapperProvider;
import org.springdoc.core.providers.RepositoryRestConfigurationProvider;
import org.springdoc.core.providers.SpringDataWebPropertiesProvider;
@@ -42,6 +44,9 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Pageable;
+import org.springframework.data.web.PagedModel;
+import org.springframework.data.web.config.EnableSpringDataWebSupport;
+import org.springframework.data.web.config.SpringDataWebSettings;
import static org.springdoc.core.utils.Constants.SPRINGDOC_ENABLED;
import static org.springdoc.core.utils.Constants.SPRINGDOC_PAGEABLE_CONVERTER_ENABLED;
@@ -49,6 +54,7 @@
/**
* The type Spring doc pageable configuration.
+ *
* @author bnasslahsen
*/
@Lazy(false)
@@ -75,17 +81,36 @@ PageableOpenAPIConverter pageableOpenAPIConverter(ObjectMapperProvider objectMap
return new PageableOpenAPIConverter(objectMapperProvider);
}
+ /**
+ * Page open api converter.
+ *
+ * @param settings the settings
+ * @param objectMapperProvider the object mapper provider
+ * @return the page open api converter
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ @ConditionalOnClass({ PagedModel.class, SpringDataWebSettings.class })
+ @Lazy(false)
+ PageOpenAPIConverter pageOpenAPIConverter(Optional settings,
+ ObjectMapperProvider objectMapperProvider) {
+ boolean replacePageWithPagedModel = settings.map(SpringDataWebSettings::pageSerializationMode)
+ .map(EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO::equals)
+ .orElse(false);
+ return new PageOpenAPIConverter(replacePageWithPagedModel, objectMapperProvider);
+ }
+
/**
* Delegating method parameter customizer delegating method parameter customizer.
*
* @param optionalSpringDataWebPropertiesProvider the optional spring data web properties
- * @param optionalRepositoryRestConfiguration the optional repository rest configuration
+ * @param optionalRepositoryRestConfiguration the optional repository rest configuration
* @return the delegating method parameter customizer
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
- DelegatingMethodParameterCustomizer delegatingMethodParameterCustomizer(Optional optionalSpringDataWebPropertiesProvider, Optional optionalRepositoryRestConfiguration) {
+ DataRestDelegatingMethodParameterCustomizer dataRestDelegatingMethodParameterCustomizer(Optional optionalSpringDataWebPropertiesProvider, Optional optionalRepositoryRestConfiguration) {
return new DataRestDelegatingMethodParameterCustomizer(optionalSpringDataWebPropertiesProvider, optionalRepositoryRestConfiguration);
}
}
\ No newline at end of file
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocRequiredModule.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocRequiredModule.java
index 7278ca597..64258a469 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocRequiredModule.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocRequiredModule.java
@@ -2,22 +2,26 @@
*
* *
* * *
- * * * * 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
+ * * * * *
+ * * * * * * Copyright 2019-2024 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.
+ * * * * *
* * * *
- * * * * 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 org.springdoc.core.configuration;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityConfiguration.java
index 465a9bc4a..ddbc478da 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityConfiguration.java
@@ -3,29 +3,30 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration;
-import java.lang.reflect.Field;
import java.util.Optional;
import io.swagger.v3.oas.models.Operation;
@@ -58,10 +59,10 @@
import org.springframework.http.HttpStatus;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
+import org.springframework.security.oauth2.client.annotation.RegisteredOAuth2AuthorizedClient;
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
import org.springframework.security.web.FilterChainProxy;
import org.springframework.security.web.SecurityFilterChain;
-import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
@@ -73,6 +74,7 @@
/**
* The type Spring doc security configuration.
+ *
* @author bnasslahsen
*/
@Lazy(false)
@@ -84,6 +86,9 @@
@ImportRuntimeHints(SpringDocSecurityHints.class)
public class SpringDocSecurityConfiguration {
+ /**
+ * The constant LOGGER.
+ */
private static final Logger LOGGER = LoggerFactory.getLogger(SpringDocSecurityConfiguration.class);
static {
@@ -109,7 +114,7 @@ class SpringSecurityLoginEndpointConfiguration {
@Bean
@ConditionalOnProperty(SPRINGDOC_SHOW_LOGIN_ENDPOINT)
@Lazy(false)
- OpenApiCustomizer springSecurityLoginEndpointCustomiser(ApplicationContext applicationContext) {
+ OpenApiCustomizer springSecurityLoginEndpointCustomizer(ApplicationContext applicationContext) {
FilterChainProxy filterChainProxy = applicationContext.getBean(AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME, FilterChainProxy.class);
return openAPI -> {
for (SecurityFilterChain filterChain : filterChainProxy.getFilterChains()) {
@@ -132,9 +137,8 @@ OpenApiCustomizer springSecurityLoginEndpointCustomiser(ApplicationContext appli
String mediaType = org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
if (optionalDefaultLoginPageGeneratingFilter.isPresent()) {
DefaultLoginPageGeneratingFilter defaultLoginPageGeneratingFilter = optionalDefaultLoginPageGeneratingFilter.get();
- Field formLoginEnabledField = FieldUtils.getDeclaredField(DefaultLoginPageGeneratingFilter.class, "formLoginEnabled", true);
try {
- boolean formLoginEnabled = (boolean) formLoginEnabledField.get(defaultLoginPageGeneratingFilter);
+ boolean formLoginEnabled = (boolean) FieldUtils.readDeclaredField(defaultLoginPageGeneratingFilter, "formLoginEnabled", true);
if (formLoginEnabled)
mediaType = org.springframework.http.MediaType.APPLICATION_FORM_URLENCODED_VALUE;
}
@@ -146,19 +150,16 @@ OpenApiCustomizer springSecurityLoginEndpointCustomiser(ApplicationContext appli
operation.requestBody(requestBody);
ApiResponses apiResponses = new ApiResponses();
apiResponses.addApiResponse(String.valueOf(HttpStatus.OK.value()), new ApiResponse().description(HttpStatus.OK.getReasonPhrase()));
- apiResponses.addApiResponse(String.valueOf(HttpStatus.FORBIDDEN.value()), new ApiResponse().description(HttpStatus.FORBIDDEN.getReasonPhrase()));
+ apiResponses.addApiResponse(String.valueOf(HttpStatus.UNAUTHORIZED.value()), new ApiResponse().description(HttpStatus.UNAUTHORIZED.getReasonPhrase()));
operation.responses(apiResponses);
operation.addTagsItem("login-endpoint");
PathItem pathItem = new PathItem().post(operation);
try {
- Field requestMatcherField = AbstractAuthenticationProcessingFilter.class.getDeclaredField("requiresAuthenticationRequestMatcher");
- requestMatcherField.setAccessible(true);
- AntPathRequestMatcher requestMatcher = (AntPathRequestMatcher) requestMatcherField.get(usernamePasswordAuthenticationFilter);
+ AntPathRequestMatcher requestMatcher = (AntPathRequestMatcher)FieldUtils.readField(usernamePasswordAuthenticationFilter, "requiresAuthenticationRequestMatcher", true);
String loginPath = requestMatcher.getPattern();
- requestMatcherField.setAccessible(false);
openAPI.getPaths().addPathItem(loginPath, pathItem);
}
- catch (NoSuchFieldException | IllegalAccessException |
+ catch (IllegalAccessException |
ClassCastException ignored) {
// Exception escaped
LOGGER.trace(ignored.getMessage());
@@ -169,6 +170,9 @@ OpenApiCustomizer springSecurityLoginEndpointCustomiser(ApplicationContext appli
}
}
+ /**
+ * The type Spring doc security o auth 2 configuration.
+ */
@Lazy(false)
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(OAuth2AuthorizationService.class)
@@ -186,4 +190,19 @@ GlobalOpenApiCustomizer springDocSecurityOAuth2Customizer() {
return new SpringDocSecurityOAuth2Customizer();
}
}
+
+ /**
+ * The type Spring doc security o auth 2 client configuration.
+ */
+ @Lazy(false)
+ @Configuration(proxyBeanMethods = false)
+ @ConditionalOnClass(RegisteredOAuth2AuthorizedClient.class)
+ class SpringDocSecurityOAuth2ClientConfiguration {
+
+ static {
+ getConfig()
+ .addAnnotationsToIgnore(RegisteredOAuth2AuthorizedClient.class);
+ }
+
+ }
}
\ No newline at end of file
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityOAuth2Customizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityOAuth2Customizer.java
index 871ebdbb6..026287bfa 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityOAuth2Customizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityOAuth2Customizer.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.configuration;
import java.lang.reflect.Field;
@@ -18,6 +44,7 @@
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.parameters.HeaderParameter;
import io.swagger.v3.oas.models.parameters.Parameter;
+import io.swagger.v3.oas.models.parameters.PathParameter;
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.responses.ApiResponses;
@@ -55,6 +82,7 @@
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.security.web.util.matcher.OrRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher;
+import org.springframework.util.ReflectionUtils;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.http.MediaType.TEXT_HTML_VALUE;
@@ -110,7 +138,7 @@ public void customise(OpenAPI openAPI) {
* @param securityFilterChain the security filter chain
* @param openapi31 the openapi 31
*/
- private void getOAuth2TokenRevocationEndpointFilter(OpenAPI openAPI, SecurityFilterChain securityFilterChain, boolean openapi31) {
+ private void getOAuth2TokenRevocationEndpointFilter(OpenAPI openAPI, SecurityFilterChain securityFilterChain, boolean openapi31) {
Object oAuth2EndpointFilter =
new SpringDocSecurityOAuth2EndpointUtils(OAuth2TokenRevocationEndpointFilter.class).findEndpoint(securityFilterChain);
if (oAuth2EndpointFilter != null) {
@@ -168,14 +196,24 @@ private void getOAuth2TokenIntrospectionEndpointFilter(OpenAPI openAPI, Security
* @param openapi31 the openapi 31
*/
private void getOAuth2AuthorizationServerMetadataEndpoint(OpenAPI openAPI, SecurityFilterChain securityFilterChain, boolean openapi31) {
+ ClassauthorizationServerMetadataEndpointClass = OAuth2AuthorizationServerMetadataEndpointFilter.class;
Object oAuth2EndpointFilter =
- new SpringDocSecurityOAuth2EndpointUtils(OAuth2AuthorizationServerMetadataEndpointFilter.class).findEndpoint(securityFilterChain);
+ new SpringDocSecurityOAuth2EndpointUtils(authorizationServerMetadataEndpointClass).findEndpoint(securityFilterChain);
if (oAuth2EndpointFilter != null) {
ApiResponses apiResponses = new ApiResponses();
buildApiResponsesOnSuccess(apiResponses, AnnotationsUtils.resolveSchemaFromType(SpringDocOAuth2AuthorizationServerMetadata.class, openAPI.getComponents(), null, openapi31));
buildApiResponsesOnInternalServerError(apiResponses);
Operation operation = buildOperation(apiResponses);
- buildPath(oAuth2EndpointFilter, REQUEST_MATCHER, openAPI, operation, HttpMethod.GET);
+ Field field = ReflectionUtils.findField(authorizationServerMetadataEndpointClass, "DEFAULT_OAUTH2_AUTHORIZATION_SERVER_METADATA_ENDPOINT_URI");
+ if (field != null) {
+ ReflectionUtils.makeAccessible(field);
+ String defaultOauth2MetadataUri = (String) ReflectionUtils.getField(field, null);
+ openAPI.getPaths().addPathItem(defaultOauth2MetadataUri , new PathItem().get(operation));
+ operation = buildOperation(apiResponses);
+ operation.addParametersItem(new PathParameter().name("subpath").schema(new StringSchema()));
+ operation.summary("Valid when multiple issuers are allowed");
+ openAPI.getPaths().addPathItem(defaultOauth2MetadataUri+"/{subpath}" , new PathItem().get(operation));
+ }
}
}
@@ -245,7 +283,7 @@ private void getOAuth2TokenEndpoint(OpenAPI openAPI, SecurityFilterChain securit
String mediaType = org.springframework.http.MediaType.APPLICATION_FORM_URLENCODED_VALUE;
RequestBody requestBody = new RequestBody().content(new Content().addMediaType(mediaType, new MediaType().schema(requestSchema)));
operation.setRequestBody(requestBody);
- operation.addParametersItem(new HeaderParameter().name("Authorization"));
+ operation.addParametersItem(new HeaderParameter().name("Authorization").schema(new StringSchema()));
buildPath(oAuth2EndpointFilter, "tokenEndpointMatcher", openAPI, operation, HttpMethod.POST);
}
@@ -270,8 +308,8 @@ private void getOAuth2AuthorizationEndpoint(OpenAPI openAPI, SecurityFilterChain
apiResponses.addApiResponse(String.valueOf(HttpStatus.OK.value()), response);
buildApiResponsesOnInternalServerError(apiResponses);
buildApiResponsesOnBadRequest(apiResponses, openAPI, openapi31);
- apiResponses.addApiResponse(String.valueOf(HttpStatus.MOVED_TEMPORARILY.value()),
- new ApiResponse().description(HttpStatus.MOVED_TEMPORARILY.getReasonPhrase())
+ apiResponses.addApiResponse(String.valueOf(HttpStatus.FOUND.value()),
+ new ApiResponse().description(HttpStatus.FOUND.getReasonPhrase())
.addHeaderObject("Location", new Header().schema(new StringSchema())));
Operation operation = buildOperation(apiResponses);
Schema> schema = new ObjectSchema().additionalProperties(new StringSchema());
@@ -288,22 +326,33 @@ private void getOAuth2AuthorizationEndpoint(OpenAPI openAPI, SecurityFilterChain
* @param openapi31 the openapi 31
*/
private void getOidcProviderConfigurationEndpoint(OpenAPI openAPI, SecurityFilterChain securityFilterChain, boolean openapi31) {
+ Class oidcProviderConfigurationEndpointFilterClass = OidcProviderConfigurationEndpointFilter.class;
Object oAuth2EndpointFilter =
- new SpringDocSecurityOAuth2EndpointUtils(OidcProviderConfigurationEndpointFilter.class).findEndpoint(securityFilterChain);
+ new SpringDocSecurityOAuth2EndpointUtils(oidcProviderConfigurationEndpointFilterClass).findEndpoint(securityFilterChain);
if (oAuth2EndpointFilter != null) {
ApiResponses apiResponses = new ApiResponses();
buildApiResponsesOnSuccess(apiResponses, AnnotationsUtils.resolveSchemaFromType(SpringDocOidcProviderConfiguration.class, openAPI.getComponents(), null, openapi31));
buildApiResponsesOnInternalServerError(apiResponses);
Operation operation = buildOperation(apiResponses);
- buildPath(oAuth2EndpointFilter, REQUEST_MATCHER, openAPI, operation, HttpMethod.GET);
+
+ Field field = ReflectionUtils.findField(oidcProviderConfigurationEndpointFilterClass, "DEFAULT_OIDC_PROVIDER_CONFIGURATION_ENDPOINT_URI");
+ if (field != null) {
+ ReflectionUtils.makeAccessible(field);
+ String defaultOidcConfigUri = (String) ReflectionUtils.getField(field, null);
+ openAPI.getPaths().addPathItem(defaultOidcConfigUri , new PathItem().get(operation));
+ operation = buildOperation(apiResponses);
+ operation.addParametersItem(new PathParameter().name("subpath").schema(new StringSchema()));
+ operation.summary("Valid when multiple issuers are allowed");
+ openAPI.getPaths().addPathItem("/{subpath}"+defaultOidcConfigUri , new PathItem().get(operation));
+ }
}
}
/**
* Gets OpenID UserInfo endpoint filter
*
- * @param openAPI the open api
+ * @param openAPI the open api
* @param securityFilterChain the security filter chain
*/
private void getOidcUserInfoEndpoint(OpenAPI openAPI, SecurityFilterChain securityFilterChain) {
@@ -346,7 +395,7 @@ private void getOidcClientRegistrationEndpoint(OpenAPI openAPI, SecurityFilterCh
String mediaType = APPLICATION_JSON_VALUE;
RequestBody requestBody = new RequestBody().content(new Content().addMediaType(mediaType, new MediaType().schema(schema)));
operation.setRequestBody(requestBody);
- operation.addParametersItem(new HeaderParameter().name("Authorization"));
+ operation.addParametersItem(new HeaderParameter().name("Authorization").schema(new StringSchema()));
buildPath(oAuth2EndpointFilter, "clientRegistrationEndpointMatcher", openAPI, operation, HttpMethod.POST);
}
@@ -369,7 +418,7 @@ private Operation buildOperation(ApiResponses apiResponses) {
* Build api responses api responses on success.
*
* @param apiResponses the api responses
- * @param schema the schema
+ * @param schema the schema
* @return the api responses
*/
private ApiResponses buildApiResponsesOnSuccess(ApiResponses apiResponses, Schema schema) {
@@ -384,7 +433,7 @@ private ApiResponses buildApiResponsesOnSuccess(ApiResponses apiResponses, Schem
* Build api responses api responses on created.
*
* @param apiResponses the api responses
- * @param schema the schema
+ * @param schema the schema
* @return the api responses
*/
private ApiResponses buildApiResponsesOnCreated(ApiResponses apiResponses, Schema schema) {
@@ -437,26 +486,23 @@ private static void buildOAuth2Error(OpenAPI openAPI, ApiResponses apiResponses,
/**
* Build path.
*
- * @param oAuth2EndpointFilter the o auth 2 endpoint filter
+ * @param oAuth2EndpointFilter the o auth 2 endpoint filter
* @param authorizationEndpointMatcher the authorization endpoint matcher
- * @param openAPI the open api
- * @param operation the operation
- * @param requestMethod the request method
+ * @param openAPI the open api
+ * @param operation the operation
+ * @param requestMethod the request method
*/
private void buildPath(Object oAuth2EndpointFilter, String authorizationEndpointMatcher, OpenAPI openAPI, Operation operation, HttpMethod requestMethod) {
try {
- Field tokenEndpointMatcherField = FieldUtils.getDeclaredField(oAuth2EndpointFilter.getClass(), authorizationEndpointMatcher, true);
- RequestMatcher endpointMatcher = (RequestMatcher) tokenEndpointMatcherField.get(oAuth2EndpointFilter);
+ RequestMatcher endpointMatcher = (RequestMatcher) FieldUtils.readDeclaredField(oAuth2EndpointFilter, authorizationEndpointMatcher, true);
String path = null;
if (endpointMatcher instanceof AntPathRequestMatcher antPathRequestMatcher)
path = antPathRequestMatcher.getPattern();
else if (endpointMatcher instanceof OrRequestMatcher endpointMatchers) {
- Field requestMatchersField = FieldUtils.getDeclaredField(OrRequestMatcher.class, "requestMatchers", true);
- Iterable requestMatchers = (Iterable) requestMatchersField.get(endpointMatchers);
+ Iterable requestMatchers = (Iterable) FieldUtils.readDeclaredField(endpointMatchers, "requestMatchers", true);
for (RequestMatcher requestMatcher : requestMatchers) {
if (requestMatcher instanceof OrRequestMatcher orRequestMatcher) {
- requestMatchersField = FieldUtils.getDeclaredField(OrRequestMatcher.class, "requestMatchers", true);
- requestMatchers = (Iterable) requestMatchersField.get(orRequestMatcher);
+ requestMatchers = (Iterable) FieldUtils.readDeclaredField(orRequestMatcher, "requestMatchers", true);
for (RequestMatcher matcher : requestMatchers) {
if (matcher instanceof AntPathRequestMatcher antPathRequestMatcher)
path = antPathRequestMatcher.getPattern();
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityOAuth2EndpointUtils.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityOAuth2EndpointUtils.java
index 7d9881357..dd7b1ba5f 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityOAuth2EndpointUtils.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSecurityOAuth2EndpointUtils.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.configuration;
import java.util.Optional;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSortConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSortConfiguration.java
index 5e512d170..f1f79de3c 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSortConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSortConfiguration.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration;
@@ -27,9 +29,7 @@
import java.util.Optional;
import org.springdoc.core.converters.SortOpenAPIConverter;
-import org.springdoc.core.converters.models.SortObject;
import org.springdoc.core.customizers.DataRestDelegatingMethodParameterCustomizer;
-import org.springdoc.core.customizers.DelegatingMethodParameterCustomizer;
import org.springdoc.core.providers.ObjectMapperProvider;
import org.springdoc.core.providers.RepositoryRestConfigurationProvider;
import org.springdoc.core.providers.SpringDataWebPropertiesProvider;
@@ -50,6 +50,7 @@
/**
* The type Spring doc pageable configuration.
+ *
* @author bnasslahsen
*/
@Lazy(false)
@@ -72,7 +73,6 @@ public class SpringDocSortConfiguration {
@Lazy(false)
SortOpenAPIConverter sortOpenAPIConverter(ObjectMapperProvider objectMapperProvider) {
getConfig().replaceParameterObjectWithClass(org.springframework.data.domain.Sort.class, org.springdoc.core.converters.models.Sort.class);
- getConfig().replaceWithClass(org.springframework.data.domain.Sort.class, SortObject.class);
return new SortOpenAPIConverter(objectMapperProvider);
}
@@ -80,13 +80,13 @@ SortOpenAPIConverter sortOpenAPIConverter(ObjectMapperProvider objectMapperProvi
* Delegating method parameter customizer delegating method parameter customizer.
*
* @param optionalSpringDataWebPropertiesProvider the optional spring data web properties
- * @param optionalRepositoryRestConfiguration the optional repository rest configuration
+ * @param optionalRepositoryRestConfiguration the optional repository rest configuration
* @return the delegating method parameter customizer
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
- DelegatingMethodParameterCustomizer delegatingMethodParameterCustomizer(Optional optionalSpringDataWebPropertiesProvider, Optional optionalRepositoryRestConfiguration) {
+ DataRestDelegatingMethodParameterCustomizer dataRestDelegatingMethodParameterCustomizer(Optional optionalSpringDataWebPropertiesProvider, Optional optionalRepositoryRestConfiguration) {
return new DataRestDelegatingMethodParameterCustomizer(optionalSpringDataWebPropertiesProvider, optionalRepositoryRestConfiguration);
}
}
\ No newline at end of file
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSpecPropertiesConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSpecPropertiesConfiguration.java
index bc2deb485..99136c420 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSpecPropertiesConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocSpecPropertiesConfiguration.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration;
@@ -53,13 +55,14 @@
@Conditional(SpecPropertiesCondition.class)
public class SpringDocSpecPropertiesConfiguration {
- /**
- * Springdoc customizer that takes care of the specification string properties customization.
- * Will be applied to general openapi schema.
- *
- * @return the springdoc customizer
- */
- @Bean
+ /**
+ * Springdoc customizer that takes care of the specification string properties customization.
+ * Will be applied to general openapi schema.
+ *
+ * @param springDocConfigProperties the spring doc config properties
+ * @return the springdoc customizer
+ */
+ @Bean
@ConditionalOnMissingBean
@Lazy(false)
SpecPropertiesCustomizer specificationStringPropertiesCustomizer(
@@ -68,13 +71,14 @@ SpecPropertiesCustomizer specificationStringPropertiesCustomizer(
return new SpecPropertiesCustomizer(springDocConfigProperties);
}
- /**
- * Bean post processor that applies the specification string properties customization to
- * grouped openapi schemas by using group name as a prefix for properties.
- *
- * @return the bean post processor
- */
- @Bean
+ /**
+ * Bean post processor that applies the specification string properties customization to
+ * grouped openapi schemas by using group name as a prefix for properties.
+ *
+ * @param springDocConfigProperties the spring doc config properties
+ * @return the bean post processor
+ */
+ @Bean
@ConditionalOnMissingBean
@Lazy(false)
SpecificationStringPropertiesCustomizerBeanPostProcessor specificationStringPropertiesCustomizerBeanPostProcessor(
@@ -89,9 +93,17 @@ SpecificationStringPropertiesCustomizerBeanPostProcessor specificationStringProp
*/
private static class SpecificationStringPropertiesCustomizerBeanPostProcessor implements BeanPostProcessor {
- private final SpringDocConfigProperties springDocConfigProperties;
+ /**
+ * The Spring doc config properties.
+ */
+ private final SpringDocConfigProperties springDocConfigProperties;
- public SpecificationStringPropertiesCustomizerBeanPostProcessor(
+ /**
+ * Instantiates a new Specification string properties customizer bean post processor.
+ *
+ * @param springDocConfigProperties the spring doc config properties
+ */
+ public SpecificationStringPropertiesCustomizerBeanPostProcessor(
SpringDocConfigProperties springDocConfigProperties
) {
this.springDocConfigProperties = springDocConfigProperties;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocUIConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocUIConfiguration.java
index 07da137fa..d54cb124c 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocUIConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocUIConfiguration.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration;
@@ -43,6 +45,7 @@
/**
* The type Spring doc Native Configuration.
+ *
* @author bnasslahsen
*/
@Lazy(false)
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocDataRestHints.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocDataRestHints.java
index ea83aa73a..e15d4c5ff 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocDataRestHints.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocDataRestHints.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration.hints;
@@ -36,11 +38,15 @@
/**
* The type Spring doc DataRest hints.
+ *
* @author bnasslahsen
*/
public class SpringDocDataRestHints implements RuntimeHintsRegistrar {
- //spring-data-rest
+ /**
+ * The Spring data rest type names.
+ */
+//spring-data-rest
static String[] springDataRestTypeNames = { "org.springframework.data.rest.webmvc.config.DelegatingHandlerMapping",
"org.springframework.data.rest.webmvc.support.DelegatingHandlerMapping",
"org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController",
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocHints.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocHints.java
index e4ac1f7b3..55428fa3d 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocHints.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocHints.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration.hints;
@@ -82,10 +84,14 @@
/**
* The type Spring doc hints.
+ *
* @author bnasslahsen
*/
public class SpringDocHints implements RuntimeHintsRegistrar {
+ /**
+ * The Types to register.
+ */
static Class[] typesToRegister = {
//swagger-models
io.swagger.v3.oas.models.security.SecurityScheme.Type.class,
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocSecurityHints.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocSecurityHints.java
index 22930100e..9bd3d02c5 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocSecurityHints.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocSecurityHints.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configuration.hints;
@@ -32,11 +34,15 @@
/**
* The type Spring doc DataRest hints.
+ *
* @author bnasslahsen
*/
public class SpringDocSecurityHints implements RuntimeHintsRegistrar {
- //spring-security
+ /**
+ * The Spring security type names.
+ */
+//spring-security
static String[] springSecurityTypeNames = { "org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter",
"org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter",
"org.springframework.security.web.util.matcher.OrRequestMatcher"
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2AuthorizationServerMetadata.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2AuthorizationServerMetadata.java
index f16e14158..ad57c68a1 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2AuthorizationServerMetadata.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2AuthorizationServerMetadata.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.configuration.oauth2;
import java.util.List;
@@ -10,45 +36,105 @@
/**
* The type Spring doc o auth 2 authorization server metadata.
*
- * @see OAuth2AuthorizationServerMetadata
* @author bnasslahsen
* @author yuta.saito
+ * @see OAuth2AuthorizationServerMetadata
*/
@Schema(name = "OAuth2AuthorizationServerMetadata")
public interface SpringDocOAuth2AuthorizationServerMetadata {
+ /**
+ * Issuer string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.ISSUER)
String issuer();
+ /**
+ * Authorization endpoint string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.AUTHORIZATION_ENDPOINT)
String authorizationEndpoint();
+ /**
+ * Token endpoint string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.TOKEN_ENDPOINT)
String tokenEndpoint();
+ /**
+ * Token endpoint auth methods supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.TOKEN_ENDPOINT_AUTH_METHODS_SUPPORTED)
List tokenEndpointAuthMethodsSupported();
+ /**
+ * Jwks uri string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.JWKS_URI)
String jwksUri();
+ /**
+ * Response types supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.RESPONSE_TYPES_SUPPORTED)
List responseTypesSupported();
+ /**
+ * Grant types supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.GRANT_TYPES_SUPPORTED)
List grantTypesSupported();
+ /**
+ * Revocation endpoint string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.REVOCATION_ENDPOINT)
String revocationEndpoint();
+ /**
+ * Revocation endpoint auth methods supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.REVOCATION_ENDPOINT_AUTH_METHODS_SUPPORTED)
List revocationEndpointAuthMethodsSupported();
+ /**
+ * Introspection endpoint string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.INTROSPECTION_ENDPOINT)
String introspectionEndpoint();
+ /**
+ * Introspection endpoint auth methods supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.INTROSPECTION_ENDPOINT_AUTH_METHODS_SUPPORTED)
List introspectionEndpointAuthMethodsSupported();
+ /**
+ * Code challenge methods supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.CODE_CHALLENGE_METHODS_SUPPORTED)
List codeChallengeMethodsSupported();
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2Token.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2Token.java
index 4aedaf5ec..369fafc39 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2Token.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2Token.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.configuration.oauth2;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@@ -7,19 +33,44 @@
/**
* The type Spring doc o auth 2 token.
*
- * @see DefaultOAuth2AccessTokenResponseMapConverter
* @author yuta.saito
+ * @see DefaultOAuth2AccessTokenResponseMapConverter
*/
@Schema(name = "OAuth2Token")
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public interface SpringDocOAuth2Token {
+ /**
+ * Gets access token.
+ *
+ * @return the access token
+ */
String getAccessToken();
+ /**
+ * Gets token type.
+ *
+ * @return the token type
+ */
String getTokenType();
+ /**
+ * Gets expires in.
+ *
+ * @return the expires in
+ */
long getExpiresIn();
+ /**
+ * Gets scope.
+ *
+ * @return the scope
+ */
String getScope();
+ /**
+ * Gets refresh token.
+ *
+ * @return the refresh token
+ */
String getRefreshToken();
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2TokenIntrospection.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2TokenIntrospection.java
index ae2cc9ee0..13b34a0b7 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2TokenIntrospection.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOAuth2TokenIntrospection.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.configuration.oauth2;
import java.util.List;
@@ -10,46 +36,106 @@
/**
* The type Spring doc o auth 2 token introspection.
*
- * @see OAuth2TokenIntrospectionHttpMessageConverter
- * @see OAuth2TokenIntrospection
* @author bnasslahsen
* @author yuta.saito
+ * @see OAuth2TokenIntrospectionHttpMessageConverter
+ * @see OAuth2TokenIntrospection
*/
@Schema(name = "OAuth2TokenIntrospection")
public interface SpringDocOAuth2TokenIntrospection {
+ /**
+ * Gets active.
+ *
+ * @return the active
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.ACTIVE)
boolean getActive();
+ /**
+ * Gets scope.
+ *
+ * @return the scope
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.SCOPE)
String getScope();
+ /**
+ * Gets client id.
+ *
+ * @return the client id
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.CLIENT_ID)
String getClientId();
+ /**
+ * Gets username.
+ *
+ * @return the username
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.USERNAME)
String getUsername();
+ /**
+ * Gets token type.
+ *
+ * @return the token type
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.TOKEN_TYPE)
String getTokenType();
+ /**
+ * Gets expires at.
+ *
+ * @return the expires at
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.EXP)
long getExpiresAt();
+ /**
+ * Gets issue at.
+ *
+ * @return the issue at
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.IAT)
long getIssueAt();
+ /**
+ * Gets not before.
+ *
+ * @return the not before
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.NBF)
long getNotBefore();
+ /**
+ * Gets subject.
+ *
+ * @return the subject
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.SUB)
String getSubject();
+ /**
+ * Gets audience.
+ *
+ * @return the audience
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.AUD)
List getAudience();
+ /**
+ * Gets issuer.
+ *
+ * @return the issuer
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.ISS)
String getIssuer();
+ /**
+ * Gets id.
+ *
+ * @return the id
+ */
@JsonProperty(OAuth2TokenIntrospectionClaimNames.JTI)
String getId();
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcClientRegistrationRequest.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcClientRegistrationRequest.java
index 984d7539a..97c0c327d 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcClientRegistrationRequest.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcClientRegistrationRequest.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.configuration.oauth2;
import java.time.Instant;
@@ -11,48 +37,113 @@
/**
* The type Spring doc OpenID Client Registration Request
*
+ * @author yuta.saito
* @see OidcClientRegistration
* @see OidcClientRegistrationHttpMessageConverter
- * @author yuta.saito
*/
@Schema(name = "ClientRegistrationRequest")
public interface SpringDocOidcClientRegistrationRequest {
+ /**
+ * Client id string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.CLIENT_ID)
String clientId();
+ /**
+ * Client id issued at instant.
+ *
+ * @return the instant
+ */
@JsonProperty(OidcClientMetadataClaimNames.CLIENT_ID_ISSUED_AT)
Instant clientIdIssuedAt();
+ /**
+ * Client secret string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.CLIENT_SECRET)
String clientSecret();
+ /**
+ * Client secret expires at instant.
+ *
+ * @return the instant
+ */
@JsonProperty(OidcClientMetadataClaimNames.CLIENT_SECRET_EXPIRES_AT)
Instant CLIENT_SECRET_EXPIRES_AT();
+ /**
+ * Client name string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.CLIENT_NAME)
String clientName();
+ /**
+ * Redirect uris list.
+ *
+ * @return the list
+ */
@JsonProperty(OidcClientMetadataClaimNames.REDIRECT_URIS)
List redirectUris();
+ /**
+ * Token endpoint authentication method string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.TOKEN_ENDPOINT_AUTH_METHOD)
String tokenEndpointAuthenticationMethod();
+ /**
+ * Token endpoint authentication signing algorithm string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.TOKEN_ENDPOINT_AUTH_SIGNING_ALG)
String tokenEndpointAuthenticationSigningAlgorithm();
+ /**
+ * Grant types list.
+ *
+ * @return the list
+ */
@JsonProperty(OidcClientMetadataClaimNames.GRANT_TYPES)
List grantTypes();
+ /**
+ * Response type list.
+ *
+ * @return the list
+ */
@JsonProperty(OidcClientMetadataClaimNames.RESPONSE_TYPES)
List responseType();
+ /**
+ * Scopes string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.SCOPE)
String scopes();
+ /**
+ * Jwk set url string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.JWKS_URI)
String jwkSetUrl();
+ /**
+ * Id token signed response algorithm string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.ID_TOKEN_SIGNED_RESPONSE_ALG)
String idTokenSignedResponseAlgorithm();
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcClientRegistrationResponse.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcClientRegistrationResponse.java
index f62c8d0c0..ecd9d852b 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcClientRegistrationResponse.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcClientRegistrationResponse.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.configuration.oauth2;
import java.util.List;
@@ -10,54 +36,129 @@
/**
* The type Spring doc OpenID Client Registration Request
*
+ * @author yuta.saito
* @see OidcClientRegistration
* @see OidcClientRegistrationHttpMessageConverter
- * @author yuta.saito
*/
@Schema(name = "ClientRegistrationResponse")
public interface SpringDocOidcClientRegistrationResponse {
+ /**
+ * Client id string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.CLIENT_ID)
String clientId();
+ /**
+ * Client id issued at long.
+ *
+ * @return the long
+ */
@JsonProperty(OidcClientMetadataClaimNames.CLIENT_ID_ISSUED_AT)
long clientIdIssuedAt();
+ /**
+ * Client secret string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.CLIENT_SECRET)
String clientSecret();
+ /**
+ * Client secret expires at long.
+ *
+ * @return the long
+ */
@JsonProperty(OidcClientMetadataClaimNames.CLIENT_SECRET_EXPIRES_AT)
long CLIENT_SECRET_EXPIRES_AT();
+ /**
+ * Client name string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.CLIENT_NAME)
String clientName();
+ /**
+ * Redirect uris list.
+ *
+ * @return the list
+ */
@JsonProperty(OidcClientMetadataClaimNames.REDIRECT_URIS)
List redirectUris();
+ /**
+ * Token endpoint authentication method string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.TOKEN_ENDPOINT_AUTH_METHOD)
String tokenEndpointAuthenticationMethod();
+ /**
+ * Token endpoint authentication signing algorithm string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.TOKEN_ENDPOINT_AUTH_SIGNING_ALG)
String tokenEndpointAuthenticationSigningAlgorithm();
+ /**
+ * Grant types list.
+ *
+ * @return the list
+ */
@JsonProperty(OidcClientMetadataClaimNames.GRANT_TYPES)
List grantTypes();
+ /**
+ * Response type list.
+ *
+ * @return the list
+ */
@JsonProperty(OidcClientMetadataClaimNames.RESPONSE_TYPES)
List responseType();
+ /**
+ * Scopes string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.SCOPE)
String scopes();
+ /**
+ * Jwk set url string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.JWKS_URI)
String jwkSetUrl();
+ /**
+ * Id token signed response algorithm string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.ID_TOKEN_SIGNED_RESPONSE_ALG)
String idTokenSignedResponseAlgorithm();
+ /**
+ * Registration access token string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.REGISTRATION_ACCESS_TOKEN)
String registrationAccessToken();
+ /**
+ * Registration client url string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcClientMetadataClaimNames.REGISTRATION_CLIENT_URI)
String registrationClientUrl();
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcProviderConfiguration.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcProviderConfiguration.java
index 15f7f99c4..9cc97461a 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcProviderConfiguration.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/oauth2/SpringDocOidcProviderConfiguration.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.configuration.oauth2;
import java.util.List;
@@ -11,56 +37,136 @@
/**
* The type Spring doc OpenID Provider Configuration
*
- * @see OidcProviderConfiguration
* @author yuta.saito
+ * @see OidcProviderConfiguration
*/
@Schema(name = "OidcProviderConfiguration")
public interface SpringDocOidcProviderConfiguration {
+ /**
+ * Issuer string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.ISSUER)
String issuer();
+ /**
+ * Authorization endpoint string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.AUTHORIZATION_ENDPOINT)
String authorizationEndpoint();
+ /**
+ * Token endpoint string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.TOKEN_ENDPOINT)
String tokenEndpoint();
+ /**
+ * Token endpoint auth methods supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.TOKEN_ENDPOINT_AUTH_METHODS_SUPPORTED)
List tokenEndpointAuthMethodsSupported();
+ /**
+ * Jwks uri string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.JWKS_URI)
String jwksUri();
+ /**
+ * User info endpoint string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcProviderMetadataClaimNames.USER_INFO_ENDPOINT)
String userInfoEndpoint();
+ /**
+ * Response types supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.RESPONSE_TYPES_SUPPORTED)
List responseTypesSupported();
+ /**
+ * Grant types supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.GRANT_TYPES_SUPPORTED)
List grantTypesSupported();
+ /**
+ * Revocation endpoint string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.REVOCATION_ENDPOINT)
String revocationEndpoint();
+ /**
+ * Revocation endpoint auth methods supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.REVOCATION_ENDPOINT_AUTH_METHODS_SUPPORTED)
List revocationEndpointAuthMethodsSupported();
+ /**
+ * Introspection endpoint string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.INTROSPECTION_ENDPOINT)
String introspectionEndpoint();
+ /**
+ * Introspection endpoint auth methods supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.INTROSPECTION_ENDPOINT_AUTH_METHODS_SUPPORTED)
List introspectionEndpointAuthMethodsSupported();
+ /**
+ * Subject types supported string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcProviderMetadataClaimNames.SUBJECT_TYPES_SUPPORTED)
String subjectTypesSupported();
+ /**
+ * Id token signing alg values supported string.
+ *
+ * @return the string
+ */
@JsonProperty(OidcProviderMetadataClaimNames.ID_TOKEN_SIGNING_ALG_VALUES_SUPPORTED)
String idTokenSigningAlgValuesSupported();
+ /**
+ * Scope supported string.
+ *
+ * @return the string
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.SCOPES_SUPPORTED)
String scopeSupported();
+ /**
+ * Code challenge methods supported list.
+ *
+ * @return the list
+ */
@JsonProperty(OAuth2AuthorizationServerMetadataClaimNames.CODE_CHALLENGE_METHODS_SUPPORTED)
List codeChallengeMethodsSupported();
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configurer/SpringdocActuatorBeanFactoryConfigurer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configurer/SpringdocActuatorBeanFactoryConfigurer.java
index 0bfcdf5d4..6e5294201 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configurer/SpringdocActuatorBeanFactoryConfigurer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configurer/SpringdocActuatorBeanFactoryConfigurer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configurer;
@@ -27,7 +29,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.springdoc.core.customizers.ActuatorOpenApiCustomizer;
import org.springdoc.core.customizers.ActuatorOperationCustomizer;
import org.springdoc.core.models.GroupedOpenApi;
import org.springdoc.core.properties.SpringDocConfigProperties;
@@ -47,6 +48,7 @@
/**
* The type Springdoc bean factory configurer.
+ *
* @author bnasslahsen
*/
public class SpringdocActuatorBeanFactoryConfigurer extends SpringdocBeanFactoryConfigurer {
@@ -59,7 +61,7 @@ public class SpringdocActuatorBeanFactoryConfigurer extends SpringdocBeanFactory
/**
* Instantiates a new Springdoc actuator bean factory configurer.
*
- * @param groupedOpenApis the grouped open apis
+ * @param groupedOpenApis the grouped open apis
*/
public SpringdocActuatorBeanFactoryConfigurer(List groupedOpenApis) {
this.groupedOpenApis = groupedOpenApis;
@@ -76,9 +78,7 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
WebEndpointProperties webEndpointProperties = result.get();
SpringDocConfigProperties springDocConfigProperties = springDocConfigPropertiesBindResult.get();
List newGroups = new ArrayList<>();
-
- ActuatorOpenApiCustomizer actuatorOpenApiCustomizer = new ActuatorOpenApiCustomizer(webEndpointProperties);
- beanFactory.registerSingleton("actuatorOpenApiCustomizer", actuatorOpenApiCustomizer);
+
ActuatorOperationCustomizer actuatorCustomizer = new ActuatorOperationCustomizer(springDocConfigProperties);
beanFactory.registerSingleton("actuatorCustomizer", actuatorCustomizer);
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configurer/SpringdocBeanFactoryConfigurer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configurer/SpringdocBeanFactoryConfigurer.java
index a67ff7e25..845b389f3 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configurer/SpringdocBeanFactoryConfigurer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configurer/SpringdocBeanFactoryConfigurer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.configurer;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/AdditionalModelsConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/AdditionalModelsConverter.java
index c565255db..1e8b673dc 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/AdditionalModelsConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/AdditionalModelsConverter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
@@ -41,6 +43,7 @@
/**
* The type Additional models converter.
+ *
* @author bnasslahsen
*/
public class AdditionalModelsConverter implements ModelConverter {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/CollectionModelContentConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/CollectionModelContentConverter.java
index 0b8b6ae6e..72adf3a81 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/CollectionModelContentConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/CollectionModelContentConverter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
@@ -46,8 +48,8 @@
* Override resolved schema as there is a custom serializer that converts the data to a map before serializing it.
*
* @author bnasslahsen
- * @see org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer
- * @see org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider) org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider)
+ * @see org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer
+ * @see org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider) org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider)org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalResourcesSerializer#serialize(Collection, JsonGenerator, SerializerProvider)
*/
public class CollectionModelContentConverter implements ModelConverter {
@@ -85,7 +87,7 @@ public Schema> resolve(AnnotatedType type, ModelConverterContext context, Iter
/**
* Gets entity type.
*
- * @param type the type
+ * @param type the type
* @return the entity type
*/
private Class> getEntityType(AnnotatedType type) {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ConverterUtils.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ConverterUtils.java
index 98b165ee9..247bc235e 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ConverterUtils.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ConverterUtils.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/FileSupportConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/FileSupportConverter.java
index 9192f4471..8d5fce596 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/FileSupportConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/FileSupportConverter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
@@ -40,6 +42,7 @@
/**
* The type File support converter.
+ *
* @author bnasslahsen
*/
public class FileSupportConverter implements ModelConverter {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/JavaTypeToIgnoreConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/JavaTypeToIgnoreConverter.java
index 093e2f68e..b40659070 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/JavaTypeToIgnoreConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/JavaTypeToIgnoreConverter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
@@ -35,6 +37,7 @@
/**
* The type Request type to ignore converter.
+ *
* @author bnasslahsen
*/
public class JavaTypeToIgnoreConverter implements ModelConverter {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ModelConverterRegistrar.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ModelConverterRegistrar.java
index d97926ce1..0cc94cb40 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ModelConverterRegistrar.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ModelConverterRegistrar.java
@@ -3,28 +3,29 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
-import java.lang.reflect.Field;
import java.util.List;
import java.util.Optional;
@@ -37,6 +38,7 @@
/**
* Wrapper for model converters to only register converters once
+ *
* @author bnasslahsen
*/
public class ModelConverterRegistrar {
@@ -75,8 +77,7 @@ public ModelConverterRegistrar(List modelConverters, SpringDocCo
@SuppressWarnings("unchecked")
private Optional getRegisteredConverterSameAs(ModelConverter modelConverter) {
try {
- Field convertersField = FieldUtils.getDeclaredField(ModelConverters.class, "converters", true);
- List modelConverters = (List) convertersField.get(modelConvertersInstance);
+ List modelConverters = (List) FieldUtils.readDeclaredField(modelConvertersInstance, "converters", true);
return modelConverters.stream()
.filter(registeredModelConverter -> isSameConverter(registeredModelConverter, modelConverter))
.findFirst();
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PageOpenAPIConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PageOpenAPIConverter.java
new file mode 100644
index 000000000..2799e5077
--- /dev/null
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PageOpenAPIConverter.java
@@ -0,0 +1,124 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.converters;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Iterator;
+
+import com.fasterxml.jackson.databind.JavaType;
+import io.swagger.v3.core.converter.AnnotatedType;
+import io.swagger.v3.core.converter.ModelConverter;
+import io.swagger.v3.core.converter.ModelConverterContext;
+import io.swagger.v3.oas.models.media.Schema;
+import org.apache.commons.lang3.StringUtils;
+import org.springdoc.core.providers.ObjectMapperProvider;
+
+import org.springframework.core.ResolvableType;
+import org.springframework.data.web.PagedModel;
+
+/**
+ * The Spring Data Page type model converter.
+ *
+ * @author Claudio Nave
+ */
+public class PageOpenAPIConverter implements ModelConverter {
+
+ /**
+ * The constant PAGE_TO_REPLACE.
+ */
+ private static final String PAGE_TO_REPLACE = "org.springframework.data.domain.Page";
+
+ /**
+ * The constant PAGED_MODEL.
+ */
+ private static final AnnotatedType PAGED_MODEL = new AnnotatedType(PagedModel.class).resolveAsRef(true);
+
+ /**
+ * The Spring doc object mapper.
+ */
+ private final ObjectMapperProvider springDocObjectMapper;
+
+ /**
+ * Flag to replace Page with PagedModel or not.
+ */
+ private final boolean replacePageWithPagedModel;
+
+ /**
+ * Instantiates a new Page open api converter.
+ *
+ * @param replacePageWithPagedModel flag to replace Page with PagedModel or not
+ * @param springDocObjectMapper the spring doc object mapper
+ */
+ public PageOpenAPIConverter(boolean replacePageWithPagedModel, ObjectMapperProvider springDocObjectMapper) {
+ this.replacePageWithPagedModel = replacePageWithPagedModel;
+ this.springDocObjectMapper = springDocObjectMapper;
+ }
+
+ /**
+ * Resolve schema.
+ * @param type the type
+ * @param context the context
+ * @param chain the chain
+ * @return the schema
+ */
+ @Override
+ public Schema resolve(AnnotatedType type, ModelConverterContext context, Iterator chain) {
+ JavaType javaType = springDocObjectMapper.jsonMapper().constructType(type.getType());
+ if (javaType != null) {
+ Class> cls = javaType.getRawClass();
+ if (replacePageWithPagedModel && PAGE_TO_REPLACE.equals(cls.getCanonicalName())) {
+ if (!type.isSchemaProperty())
+ type = resolvePagedModelType(type);
+ else
+ type.name(cls.getSimpleName() + StringUtils.capitalize(type.getParent().getType()));
+ }
+ }
+ return (chain.hasNext()) ? chain.next().resolve(type, context, chain) : null;
+ }
+
+ /**
+ * Resolve paged model type annotated type.
+ *
+ * @param type the type
+ * @return the annotated type
+ */
+ private AnnotatedType resolvePagedModelType(AnnotatedType type) {
+ Type pageType = type.getType();
+ if (pageType instanceof ParameterizedType) {
+ Type argumentType = ((ParameterizedType) type.getType()).getActualTypeArguments()[0];
+ Type pagedModelType = ResolvableType
+ .forClassWithGenerics(PagedModel.class, ResolvableType.forType(argumentType))
+ .getType();
+ return new AnnotatedType(pagedModelType).resolveAsRef(true);
+ }
+ else {
+ return PAGED_MODEL;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PageableOpenAPIConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PageableOpenAPIConverter.java
index 8bf14d5ea..2faf74dd0 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PageableOpenAPIConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PageableOpenAPIConverter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
@@ -37,6 +39,7 @@
/**
* The Pageable Type models converter.
+ *
* @author bnasslahsen
*/
public class PageableOpenAPIConverter implements ModelConverter {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PolymorphicModelConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PolymorphicModelConverter.java
index 2f04a52c8..12cec2add 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PolymorphicModelConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PolymorphicModelConverter.java
@@ -3,44 +3,53 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
+import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.databind.JavaType;
import io.swagger.v3.core.converter.AnnotatedType;
import io.swagger.v3.core.converter.ModelConverter;
import io.swagger.v3.core.converter.ModelConverterContext;
import io.swagger.v3.core.util.AnnotationsUtils;
+import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.media.ComposedSchema;
import io.swagger.v3.oas.models.media.ObjectSchema;
import io.swagger.v3.oas.models.media.Schema;
+import org.apache.commons.lang3.reflect.FieldUtils;
import org.springdoc.core.providers.ObjectMapperProvider;
/**
* The type Polymorphic model converter.
+ *
* @author bnasslahsen
*/
public class PolymorphicModelConverter implements ModelConverter {
@@ -50,6 +59,17 @@ public class PolymorphicModelConverter implements ModelConverter {
*/
private final ObjectMapperProvider springDocObjectMapper;
+ /**
+ * The constant PARENT_TYPES_TO_IGNORE.
+ */
+ private static final List PARENT_TYPES_TO_IGNORE = Collections.synchronizedList(new ArrayList<>());
+
+ static {
+ PARENT_TYPES_TO_IGNORE.add("JsonSchema");
+ PARENT_TYPES_TO_IGNORE.add("Pageable");
+ PARENT_TYPES_TO_IGNORE.add("EntityModel");
+ }
+
/**
* Instantiates a new Polymorphic model converter.
*
@@ -59,12 +79,30 @@ public PolymorphicModelConverter(ObjectMapperProvider springDocObjectMapper) {
this.springDocObjectMapper = springDocObjectMapper;
}
- private static Schema> getResolvedSchema(JavaType javaType, Schema> resolvedSchema) {
+ /**
+ * Add parent type.
+ *
+ * @param parentTypes the parent types
+ */
+ public static void addParentType(String... parentTypes) {
+ PARENT_TYPES_TO_IGNORE.addAll(List.of(parentTypes));
+ }
+
+ /**
+ * Gets resolved schema.
+ *
+ * @param javaType the java type
+ * @param resolvedSchema the resolved schema
+ * @return the resolved schema
+ */
+ private Schema> getResolvedSchema(JavaType javaType, Schema> resolvedSchema) {
if (resolvedSchema instanceof ObjectSchema && resolvedSchema.getProperties() != null) {
- if (resolvedSchema.getProperties().containsKey(javaType.getRawClass().getName()))
+ if (resolvedSchema.getProperties().containsKey(javaType.getRawClass().getName())) {
resolvedSchema = resolvedSchema.getProperties().get(javaType.getRawClass().getName());
- else if (resolvedSchema.getProperties().containsKey(javaType.getRawClass().getSimpleName()))
+ }
+ else if (resolvedSchema.getProperties().containsKey(javaType.getRawClass().getSimpleName())) {
resolvedSchema = resolvedSchema.getProperties().get(javaType.getRawClass().getSimpleName());
+ }
}
return resolvedSchema;
}
@@ -73,11 +111,27 @@ else if (resolvedSchema.getProperties().containsKey(javaType.getRawClass().getSi
public Schema resolve(AnnotatedType type, ModelConverterContext context, Iterator chain) {
JavaType javaType = springDocObjectMapper.jsonMapper().constructType(type.getType());
if (javaType != null) {
+ for (Field field : FieldUtils.getAllFields(javaType.getRawClass())) {
+ if (field.isAnnotationPresent(JsonUnwrapped.class)) {
+ PARENT_TYPES_TO_IGNORE.add(javaType.getRawClass().getSimpleName());
+ }
+ }
if (chain.hasNext()) {
+ if (!type.isResolveAsRef() && type.getParent() != null
+ && PARENT_TYPES_TO_IGNORE.stream().noneMatch(ignore -> type.getParent().getName().startsWith(ignore)))
+ type.resolveAsRef(true);
Schema> resolvedSchema = chain.next().resolve(type, context, chain);
resolvedSchema = getResolvedSchema(javaType, resolvedSchema);
- if (resolvedSchema == null || resolvedSchema.get$ref() == null)
+ if (resolvedSchema == null || resolvedSchema.get$ref() == null) {
return resolvedSchema;
+ }
+ if(resolvedSchema.get$ref().contains(Components.COMPONENTS_SCHEMAS_REF)) {
+ String schemaName = resolvedSchema.get$ref().substring(Components.COMPONENTS_SCHEMAS_REF.length());
+ Schema existingSchema = context.getDefinedModels().get(schemaName);
+ if (existingSchema != null && existingSchema.getOneOf() != null) {
+ return resolvedSchema;
+ }
+ }
return composePolymorphicSchema(type, resolvedSchema, context.getDefinedModels().values());
}
}
@@ -87,13 +141,31 @@ public Schema resolve(AnnotatedType type, ModelConverterContext context, Iterato
/**
* Compose polymorphic schema.
*
- * @param type the type
- * @param schema the schema
+ * @param type the type
+ * @param schema the schema
* @param schemas the schemas
* @return the schema
*/
private Schema composePolymorphicSchema(AnnotatedType type, Schema schema, Collection schemas) {
String ref = schema.get$ref();
+ List composedSchemas = findComposedSchemas(ref, schemas);
+
+ if (composedSchemas.isEmpty()) return schema;
+
+ ComposedSchema result = new ComposedSchema();
+ if (isConcreteClass(type)) result.addOneOfItem(schema);
+ composedSchemas.forEach(result::addOneOfItem);
+ return result;
+ }
+
+ /**
+ * Find composed schemas recursively.
+ *
+ * @param ref the reference of the schema
+ * @param schemas the collection of schemas to search in
+ * @return the list of composed schemas
+ */
+ private List findComposedSchemas(String ref, Collection schemas) {
List composedSchemas = schemas.stream()
.filter(ComposedSchema.class::isInstance)
.map(ComposedSchema.class::cast)
@@ -101,12 +173,15 @@ private Schema composePolymorphicSchema(AnnotatedType type, Schema schema, Colle
.filter(s -> s.getAllOf().stream().anyMatch(s2 -> ref.equals(s2.get$ref())))
.map(s -> new Schema().$ref(AnnotationsUtils.COMPONENTS_REF + s.getName()))
.toList();
- if (composedSchemas.isEmpty()) return schema;
- ComposedSchema result = new ComposedSchema();
- if (isConcreteClass(type)) result.addOneOfItem(schema);
- composedSchemas.forEach(result::addOneOfItem);
- return result;
+ List resultSchemas = new ArrayList<>(composedSchemas);
+
+ for (Schema childSchema : composedSchemas) {
+ String childSchemaRef = childSchema.get$ref();
+ resultSchemas.addAll(findComposedSchemas(childSchemaRef, schemas));
+ }
+
+ return resultSchemas;
}
/**
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PropertyCustomizingConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PropertyCustomizingConverter.java
index f82afbb45..188f97537 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PropertyCustomizingConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/PropertyCustomizingConverter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
@@ -36,6 +38,7 @@
/**
* The type Property customizing converter.
+ *
* @author bnasslahsen
*/
public class PropertyCustomizingConverter implements ModelConverter {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/RepresentationModelLinksOASMixin.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/RepresentationModelLinksOASMixin.java
index 6a5f3e7a7..cfdc65127 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/RepresentationModelLinksOASMixin.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/RepresentationModelLinksOASMixin.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
@@ -32,6 +34,7 @@
/**
* The type Representation model links oas mixin.
+ *
* @author bnasslahsen
*/
public abstract class RepresentationModelLinksOASMixin extends RepresentationModelMixin {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ResponseSupportConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ResponseSupportConverter.java
index 6ce3e79e5..b820589ef 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ResponseSupportConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/ResponseSupportConverter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
@@ -35,12 +37,15 @@
import io.swagger.v3.oas.models.media.StringSchema;
import org.springdoc.core.providers.ObjectMapperProvider;
+import org.springframework.http.ResponseEntity;
+
import static org.springdoc.core.converters.ConverterUtils.isFluxTypeWrapper;
import static org.springdoc.core.converters.ConverterUtils.isResponseTypeToIgnore;
import static org.springdoc.core.converters.ConverterUtils.isResponseTypeWrapper;
/**
* The type Response support converter.
+ *
* @author bnasslahsen
*/
public class ResponseSupportConverter implements ModelConverter {
@@ -65,7 +70,7 @@ public Schema resolve(AnnotatedType type, ModelConverterContext context, Iterato
if (javaType != null) {
Class> cls = javaType.getRawClass();
if (isResponseTypeWrapper(cls) && !isFluxTypeWrapper(cls)) {
- JavaType innerType = javaType.getBindings().getBoundType(0);
+ JavaType innerType = findResponseEntity(javaType).containedType(0);
if (innerType == null)
return new StringSchema();
return context.resolve(new AnnotatedType(innerType)
@@ -79,4 +84,18 @@ else if (isResponseTypeToIgnore(cls))
return (chain.hasNext()) ? chain.next().resolve(type, context, chain) : null;
}
+ /**
+ * Find response entity java type.
+ *
+ * @param javaType the java type
+ * @return the java type
+ */
+ private JavaType findResponseEntity(JavaType javaType){
+ if(ResponseEntity.class.isAssignableFrom(javaType.getRawClass())){
+ while (ResponseEntity.class != javaType.getRawClass())
+ javaType = javaType.getSuperClass();
+ }
+ return javaType;
+ }
+
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/SchemaPropertyDeprecatingConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/SchemaPropertyDeprecatingConverter.java
index 919484a4a..d08f6c7dd 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/SchemaPropertyDeprecatingConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/SchemaPropertyDeprecatingConverter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
@@ -41,6 +43,7 @@
/**
* The type Schema property deprecating converter.
+ *
* @author bnasslahsen
*/
public class SchemaPropertyDeprecatingConverter implements ModelConverter {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/SortOpenAPIConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/SortOpenAPIConverter.java
index bc8fe5ce4..5dc533013 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/SortOpenAPIConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/SortOpenAPIConverter.java
@@ -1,27 +1,31 @@
-package org.springdoc.core.converters;
-
/*
*
* *
* * *
- * * * * 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
+ * * * * *
+ * * * * * * Copyright 2019-2024 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.
+ * * * * *
* * * *
- * * * * 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 org.springdoc.core.converters;
+
import java.util.Iterator;
import com.fasterxml.jackson.databind.JavaType;
@@ -35,10 +39,14 @@
/**
* The Spring Data Sort type model converter.
- * @author daniel-shuy
+ *
+ * @author daniel -shuy
*/
public class SortOpenAPIConverter implements ModelConverter {
+ /**
+ * The constant SORT_TO_REPLACE.
+ */
private static final String SORT_TO_REPLACE = "org.springframework.data.domain.Sort";
/**
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/WebFluxSupportConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/WebFluxSupportConverter.java
index 08137e942..434d8ff02 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/WebFluxSupportConverter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/WebFluxSupportConverter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters;
@@ -44,6 +46,7 @@
/**
* The type Web flux support converter.
+ *
* @author bnasslahsen
*/
public class WebFluxSupportConverter implements ModelConverter {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/DefaultPageable.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/DefaultPageable.java
index b33db51e0..fa59c38b7 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/DefaultPageable.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/DefaultPageable.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters.models;
@@ -30,6 +32,7 @@
/**
* The type Default pageable.
+ *
* @author bnasslahsen
*/
@ParameterObject
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/MonetaryAmount.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/MonetaryAmount.java
index 34cd2654c..2b63c3a14 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/MonetaryAmount.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/MonetaryAmount.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters.models;
@@ -31,6 +33,7 @@
/**
* The type Monetary amount.
+ *
* @author bnasslahsen
*/
@Schema
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/Pageable.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/Pageable.java
index b97360821..cd5d5b601 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/Pageable.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/Pageable.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters.models;
@@ -34,6 +36,7 @@
/**
* The type Pageable.
+ *
* @author bnasslahsen
*/
public class Pageable {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/PageableAsQueryParam.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/PageableAsQueryParam.java
index 7ab5f3a6a..ebd89348e 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/PageableAsQueryParam.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/PageableAsQueryParam.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters.models;
@@ -36,6 +38,7 @@
/**
* The interface Pageable as query param.
+ *
* @author bnasslahsen
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/Sort.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/Sort.java
index d698a9a2b..16ea63f3b 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/Sort.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/Sort.java
@@ -1,27 +1,31 @@
-package org.springdoc.core.converters.models;
-
/*
*
* *
* * *
- * * * * 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
+ * * * * *
+ * * * * * * Copyright 2019-2024 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.
+ * * * * *
* * * *
- * * * * 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 org.springdoc.core.converters.models;
+
import java.util.List;
import java.util.Objects;
@@ -31,7 +35,8 @@
/**
* The Sort type.
- * @author daniel-shuy
+ *
+ * @author daniel -shuy
*/
public class Sort {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/SortAsQueryParam.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/SortAsQueryParam.java
new file mode 100644
index 000000000..b1eaf3dfd
--- /dev/null
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/SortAsQueryParam.java
@@ -0,0 +1,26 @@
+package org.springdoc.core.converters.models;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Schema;
+
+/**
+ * The Sort class as query param.
+ *
+ * @author ondrejkrpec
+ */
+@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@Parameter(in = ParameterIn.QUERY
+ , description = "Sorting criteria in the format: property,(asc|desc). "
+ + "Default sort order is ascending. " + "Multiple sort criteria are supported."
+ , name = "sort"
+ , array = @ArraySchema(schema = @Schema(type = "string"))
+)
+public @interface SortAsQueryParam {}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/SortObject.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/SortObject.java
index c1b851270..131adef31 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/SortObject.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/SortObject.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.converters.models;
@@ -29,6 +31,7 @@
/**
* The type Sort response.
+ *
* @author bnasslahsen
*/
@ArraySchema(arraySchema = @Schema(implementation = SortObject.class))
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ActuatorOpenApiCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ActuatorOpenApiCustomizer.java
index 93c367b22..27d85889a 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ActuatorOpenApiCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ActuatorOpenApiCustomizer.java
@@ -3,59 +3,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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
import java.util.Comparator;
import java.util.HashSet;
-import java.util.List;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import java.util.stream.Stream;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.Paths;
-import io.swagger.v3.oas.models.media.StringSchema;
-import io.swagger.v3.oas.models.parameters.Parameter;
-import io.swagger.v3.oas.models.parameters.PathParameter;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
-import org.springframework.util.CollectionUtils;
-
-import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR;
/**
- * The type Actuator open api customiser.
+ * The type Actuator open api customizer.
+ *
* @author bnasslahsen
+ * @since 2.7.0
+ * @deprecated as not anymore required, use your own {@link org.springdoc.core.customizers.GlobalOpenApiCustomizer} instead
*/
+@Deprecated(since = "2.7.0")
public class ActuatorOpenApiCustomizer implements GlobalOpenApiCustomizer {
- /**
- * The Path pathern.
- */
- private final Pattern pathPathern = Pattern.compile("\\{(.*?)}");
/**
* The Web endpoint properties.
@@ -71,6 +64,13 @@ public ActuatorOpenApiCustomizer(WebEndpointProperties webEndpointProperties) {
this.webEndpointProperties = webEndpointProperties;
}
+ /**
+ * Actuator path entry stream stream.
+ *
+ * @param openApi the open api
+ * @param relativeSubPath the relative sub path
+ * @return the stream
+ */
private Stream> actuatorPathEntryStream(OpenAPI openApi, String relativeSubPath) {
String pathPrefix = webEndpointProperties.getBasePath() + Optional.ofNullable(relativeSubPath).orElse("");
return Optional.ofNullable(openApi.getPaths())
@@ -80,30 +80,16 @@ private Stream> actuatorPathEntryStream(OpenAPI openApi,
.orElse(Stream.empty());
}
- private void handleActuatorPathParam(OpenAPI openApi) {
- actuatorPathEntryStream(openApi, DEFAULT_PATH_SEPARATOR).forEach(stringPathItemEntry -> {
- String path = stringPathItemEntry.getKey();
- Matcher matcher = pathPathern.matcher(path);
- while (matcher.find()) {
- String pathParam = matcher.group(1);
- PathItem pathItem = stringPathItemEntry.getValue();
- pathItem.readOperations().forEach(operation -> {
- List existingParameters = operation.getParameters();
- Optional existingParam = Optional.empty();
- if (!CollectionUtils.isEmpty(existingParameters))
- existingParam = existingParameters.stream().filter(p -> pathParam.equals(p.getName())).findAny();
- if (!existingParam.isPresent())
- operation.addParametersItem(new PathParameter().name(pathParam).schema(new StringSchema()));
- });
- }
- });
- }
-
+ /**
+ * Handle actuator operation id uniqueness.
+ *
+ * @param openApi the open api
+ */
private void handleActuatorOperationIdUniqueness(OpenAPI openApi) {
Set usedOperationIds = new HashSet<>();
actuatorPathEntryStream(openApi, null)
.sorted(Comparator.comparing(Entry::getKey))
- .forEachOrdered(stringPathItemEntry -> {
+ .forEachOrdered(stringPathItemEntry ->
stringPathItemEntry.getValue().readOperations().forEach(operation -> {
String initialOperationId = operation.getOperationId();
String uniqueOperationId = operation.getOperationId();
@@ -112,13 +98,12 @@ private void handleActuatorOperationIdUniqueness(OpenAPI openApi) {
uniqueOperationId = initialOperationId + "_" + ++counter;
}
operation.setOperationId(uniqueOperationId);
- });
- });
+ })
+ );
}
@Override
public void customise(OpenAPI openApi) {
- handleActuatorPathParam(openApi);
handleActuatorOperationIdUniqueness(openApi);
}
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ActuatorOperationCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ActuatorOperationCustomizer.java
index 985513421..8843ac3b5 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ActuatorOperationCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ActuatorOperationCustomizer.java
@@ -3,54 +3,61 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
import java.lang.reflect.Field;
import java.lang.reflect.Parameter;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import io.swagger.v3.core.util.AnnotationsUtils;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.Content;
import io.swagger.v3.oas.models.media.MediaType;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.RequestBody;
+import io.swagger.v3.oas.models.responses.ApiResponse;
+import io.swagger.v3.oas.models.responses.ApiResponses;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springdoc.core.properties.SpringDocConfigProperties;
-import org.springframework.boot.actuate.endpoint.OperationType;
+import org.springframework.boot.actuate.endpoint.ApiVersion;
+import org.springframework.boot.actuate.endpoint.SecurityContext;
import org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation;
import org.springframework.boot.actuate.endpoint.annotation.Selector;
import org.springframework.boot.actuate.endpoint.invoke.OperationParameter;
import org.springframework.boot.actuate.endpoint.invoke.reflect.OperationMethod;
+import org.springframework.boot.actuate.endpoint.web.WebServerNamespace;
+import org.springframework.http.HttpStatus;
import org.springframework.web.method.HandlerMethod;
import static org.springdoc.core.providers.ActuatorProvider.getTag;
/**
* The type Actuator operation customizer.
+ *
* @author bnasslahsen
*/
public class ActuatorOperationCustomizer implements GlobalOperationCustomizer {
@@ -70,11 +77,6 @@ public class ActuatorOperationCustomizer implements GlobalOperationCustomizer {
*/
private static final Logger LOGGER = LoggerFactory.getLogger(ActuatorOperationCustomizer.class);
- /**
- * The regex pattern for operationId lookup.
- */
- private static final Pattern pattern = Pattern.compile(".*'([^']*)'.*");
-
/**
* The Spring doc config properties.
*/
@@ -92,44 +94,178 @@ public ActuatorOperationCustomizer(SpringDocConfigProperties springDocConfigProp
@Override
public Operation customize(Operation operation, HandlerMethod handlerMethod) {
- if (operation.getTags() != null && operation.getTags().contains(getTag().getName())) {
- Field operationFiled = FieldUtils.getDeclaredField(handlerMethod.getBean().getClass(), OPERATION, true);
- Object actuatorOperation;
- if (operationFiled != null) {
- try {
- actuatorOperation = operationFiled.get(handlerMethod.getBean());
- Field actuatorOperationFiled = FieldUtils.getDeclaredField(actuatorOperation.getClass(), OPERATION, true);
- if (actuatorOperationFiled != null) {
- AbstractDiscoveredOperation discoveredOperation = (AbstractDiscoveredOperation) actuatorOperationFiled.get(actuatorOperation);
- OperationMethod operationMethod = discoveredOperation.getOperationMethod();
- if (OperationType.WRITE.equals(operationMethod.getOperationType())) {
- for (OperationParameter operationParameter : operationMethod.getParameters()) {
- Field parameterField = FieldUtils.getDeclaredField(operationParameter.getClass(), PARAMETER, true);
- Parameter parameter = (Parameter) parameterField.get(operationParameter);
- Schema> schema = AnnotationsUtils.resolveSchemaFromType(parameter.getType(), null, null, springDocConfigProperties.isOpenapi31());
- if (parameter.getAnnotation(Selector.class) == null) {
- operation.setRequestBody(new RequestBody()
- .content(new Content().addMediaType(org.springframework.http.MediaType.APPLICATION_JSON_VALUE, new MediaType().schema(schema))));
- }
- }
- }
- }
- }
- catch (IllegalAccessException e) {
- LOGGER.warn(e.getMessage());
- }
+ if (operationHasValidTag(operation)) {
+ Field operationField = FieldUtils.getDeclaredField(handlerMethod.getBean().getClass(), OPERATION,true);
+ if (operationField != null) {
+ processOperationField(handlerMethod, operation, operationField);
}
+ setOperationSummary(operation, handlerMethod);
+ }
+ return operation;
+ }
- String summary = handlerMethod.toString();
- Matcher matcher = pattern.matcher(summary);
- String operationId = operation.getOperationId();
- while (matcher.find()) {
- operationId = matcher.group(1);
+ /**
+ * Operation has valid tag boolean.
+ *
+ * @param operation the operation
+ * @return the boolean
+ */
+ private boolean operationHasValidTag(Operation operation) {
+ return operation.getTags() != null && operation.getTags().contains(getTag().getName());
+ }
+
+ /**
+ * Process operation field.
+ *
+ * @param handlerMethod the handler method
+ * @param operation the operation
+ * @param operationField the operation field
+ */
+ private void processOperationField(HandlerMethod handlerMethod, Operation operation, Field operationField) {
+ try {
+ Object actuatorOperation = operationField.get(handlerMethod.getBean());
+ Field actuatorOperationField = FieldUtils.getDeclaredField(actuatorOperation.getClass(), OPERATION, true);
+ if (actuatorOperationField != null) {
+ AbstractDiscoveredOperation discoveredOperation =
+ (AbstractDiscoveredOperation) actuatorOperationField.get(actuatorOperation);
+ handleOperationMethod(discoveredOperation.getOperationMethod(), operation);
+ }
+ }
+ catch (IllegalAccessException e) {
+ LOGGER.warn(e.getMessage());
+ }
+ }
+
+ /**
+ * Handle operation method.
+ *
+ * @param operationMethod the operation method
+ * @param operation the operation
+ */
+ private void handleOperationMethod(OperationMethod operationMethod, Operation operation) {
+ String operationId = operationMethod.getMethod().getName();
+ operation.setOperationId(operationId);
+
+ switch (operationMethod.getOperationType()) {
+ case READ:
+ addParameters(operationMethod, operation, ParameterIn.QUERY);
+ break;
+ case WRITE:
+ addWriteParameters(operationMethod, operation);
+ operation.setResponses(new ApiResponses()
+ .addApiResponse(String.valueOf(HttpStatus.NO_CONTENT.value()), new ApiResponse().description(HttpStatus.NO_CONTENT.getReasonPhrase()))
+ .addApiResponse(String.valueOf(HttpStatus.BAD_REQUEST.value()), new ApiResponse().description(HttpStatus.BAD_REQUEST.getReasonPhrase())));
+ break;
+ case DELETE:
+ operation.setResponses(new ApiResponses().addApiResponse(String.valueOf(HttpStatus.NO_CONTENT.value()), new ApiResponse().description(HttpStatus.NO_CONTENT.getReasonPhrase())));
+ addParameters(operationMethod, operation, ParameterIn.QUERY);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Add parameters.
+ *
+ * @param operationMethod the operation method
+ * @param operation the operation
+ * @param parameterIn the parameter in
+ */
+ private void addParameters(OperationMethod operationMethod, Operation operation, ParameterIn parameterIn) {
+ for (OperationParameter operationParameter : operationMethod.getParameters()) {
+ Parameter parameter = getParameterFromField(operationParameter);
+ if(parameter == null) continue;
+ Schema> schema = resolveSchema(parameter);
+ if (parameter.getAnnotation(Selector.class) != null) {
+ operation.addParametersItem(new io.swagger.v3.oas.models.parameters.PathParameter()
+ .name(parameter.getName())
+ .schema(schema));
+ operation.getResponses().addApiResponse(String.valueOf(HttpStatus.NOT_FOUND.value()), new ApiResponse().description(HttpStatus.NOT_FOUND.getReasonPhrase()));
+ }
+ else if (isValidParameterType(parameter)) {
+ operation.addParametersItem(new io.swagger.v3.oas.models.parameters.Parameter()
+ .name(parameter.getName())
+ .in(parameterIn.toString())
+ .schema(schema));
+ }
+ }
+ }
+
+ /**
+ * Add write parameters.
+ *
+ * @param operationMethod the operation method
+ * @param operation the operation
+ */
+ private void addWriteParameters(OperationMethod operationMethod, Operation operation) {
+ for (OperationParameter operationParameter : operationMethod.getParameters()) {
+ Parameter parameter = getParameterFromField(operationParameter);
+ if(parameter == null) continue;
+ Schema> schema = resolveSchema(parameter);
+ if (parameter.getAnnotation(Selector.class) != null) {
+ operation.addParametersItem(new io.swagger.v3.oas.models.parameters.PathParameter()
+ .name(parameter.getName())
+ .schema(schema));
+ }
+ else {
+ operation.setRequestBody(new RequestBody()
+ .content(new Content()
+ .addMediaType(org.springframework.http.MediaType.APPLICATION_JSON_VALUE,
+ new MediaType().schema(schema))));
}
- if (operation.getSummary() == null && !summary.contains("$"))
- operation.setSummary(summary);
- operation.setOperationId(operationId);
}
- return operation;
}
+
+ /**
+ * Gets parameter from field.
+ *
+ * @param operationParameter the operation parameter
+ * @return the parameter from field
+ */
+ private Parameter getParameterFromField(OperationParameter operationParameter) {
+ try {
+ return (Parameter) FieldUtils.readDeclaredField(operationParameter, PARAMETER, true);
+ }
+ catch (IllegalAccessException e) {
+ LOGGER.warn(e.getMessage());
+ return null;
+ }
+ }
+
+ /**
+ * Resolve schema schema.
+ *
+ * @param parameter the parameter
+ * @return the schema
+ */
+ private Schema> resolveSchema(Parameter parameter) {
+ return AnnotationsUtils.resolveSchemaFromType(parameter.getType(), null, null, springDocConfigProperties.isOpenapi31());
+ }
+
+ /**
+ * Is valid parameter type boolean.
+ *
+ * @param parameter the parameter
+ * @return the boolean
+ */
+ private boolean isValidParameterType(Parameter parameter) {
+ return !ApiVersion.class.isAssignableFrom(parameter.getType()) &&
+ !WebServerNamespace.class.isAssignableFrom(parameter.getType()) &&
+ !SecurityContext.class.isAssignableFrom(parameter.getType());
+ }
+
+ /**
+ * Sets operation summary.
+ *
+ * @param operation the operation
+ * @param handlerMethod the handler method
+ */
+ private void setOperationSummary(Operation operation, HandlerMethod handlerMethod) {
+ String summary = handlerMethod.toString();
+ if (operation.getSummary() == null && !summary.contains("$")) {
+ operation.setSummary(summary);
+ }
+ }
+
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestDelegatingMethodParameterCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestDelegatingMethodParameterCustomizer.java
index 8918b2bc4..6aea22f12 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestDelegatingMethodParameterCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestDelegatingMethodParameterCustomizer.java
@@ -2,28 +2,31 @@
*
* *
* * *
- * * * * 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
+ * * * * *
+ * * * * * * Copyright 2019-2024 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.
+ * * * * *
* * * *
- * * * * 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 org.springdoc.core.customizers;
import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
@@ -50,7 +53,6 @@
import org.apache.commons.lang3.reflect.FieldUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springdoc.core.extractor.DelegatingMethodParameter;
import org.springdoc.core.providers.RepositoryRestConfigurationProvider;
import org.springdoc.core.providers.SpringDataWebPropertiesProvider;
@@ -86,7 +88,7 @@ public class DataRestDelegatingMethodParameterCustomizer implements DelegatingMe
/**
* Instantiates a new Data rest delegating method parameter customizer.
*
- * @param optionalSpringDataWebPropertiesProvider the optional spring data web properties provider
+ * @param optionalSpringDataWebPropertiesProvider the optional spring data web properties provider
* @param optionalRepositoryRestConfigurationProvider the optional repository rest configuration provider
*/
public DataRestDelegatingMethodParameterCustomizer(Optional optionalSpringDataWebPropertiesProvider, Optional optionalRepositoryRestConfigurationProvider) {
@@ -103,9 +105,8 @@ public void customize(MethodParameter originalParameter, MethodParameter methodP
(Pageable.class.isAssignableFrom(parameterType) || Sort.class.isAssignableFrom(parameterType))
&& (isSpringDataWebPropertiesPresent() || isRepositoryRestConfigurationPresent())
)) {
- Field field = FieldUtils.getDeclaredField(DelegatingMethodParameter.class, "additionalParameterAnnotations", true);
try {
- Annotation[] parameterAnnotations = (Annotation[]) field.get(methodParameter);
+ Annotation[] parameterAnnotations = (Annotation[]) FieldUtils.readDeclaredField(methodParameter, "additionalParameterAnnotations", true);
if (ArrayUtils.isNotEmpty(parameterAnnotations))
for (int i = 0; i < parameterAnnotations.length; i++) {
if (Parameter.class.equals(parameterAnnotations[i].annotationType())) {
@@ -126,15 +127,14 @@ public void customize(MethodParameter originalParameter, MethodParameter methodP
*
* @param methodParameter the method parameter
* @param pageableDefault the pageable default
+ * @param sortDefault the sort default
* @return the new parameter annotation for field
*/
private Optional getNewParameterAnnotationForField(MethodParameter methodParameter, PageableDefault pageableDefault, SortDefault sortDefault) {
String parameterName = methodParameter.getParameterName();
- Field field;
Parameter parameterNew;
try {
- field = methodParameter.getContainingClass().getDeclaredField(parameterName);
- Parameter parameter = field.getAnnotation(Parameter.class);
+ Parameter parameter = methodParameter.getContainingClass().getDeclaredField(parameterName).getAnnotation(Parameter.class);
parameterNew = new Parameter() {
@Override
public Class extends Annotation> annotationType() {
@@ -189,6 +189,10 @@ public boolean allowReserved() {
@Override
public Schema schema() {
return new Schema() {
+ @Override
+ public SchemaResolution schemaResolution() {
+ return parameterSchema.schemaResolution();
+ }
private Schema parameterSchema = parameter.schema();
@@ -938,6 +942,11 @@ public String[] examples() {
public String _const() {
return schema._const();
}
+
+ @Override
+ public SchemaResolution schemaResolution() {
+ return schema.schemaResolution();
+ }
};
}
@@ -1030,7 +1039,7 @@ public String ref() {
* Gets name.
*
* @param parameterName the parameter name
- * @param originalName the original name
+ * @param originalName the original name
* @return the name
*/
private String getName(String parameterName, String originalName) {
@@ -1062,8 +1071,7 @@ else if (isSpringDataWebPropertiesPresent())
else
name = originalName;
break;
- case "direction":
- case "caseSensitive":
+ case "direction", "caseSensitive":
name = originalName;
break;
default:
@@ -1076,7 +1084,7 @@ else if (isSpringDataWebPropertiesPresent())
/**
* Gets description.
*
- * @param parameterName the parameter name
+ * @param parameterName the parameter name
* @param originalDescription the original description
* @return the description
*/
@@ -1090,8 +1098,8 @@ private String getDescription(String parameterName, String originalDescription)
/**
* Gets default value.
*
- * @param parameterName the parameter name
- * @param pageableDefault the pageable default
+ * @param parameterName the parameter name
+ * @param pageableDefault the pageable default
* @param defaultSchemaVal the default schema val
* @return the default value
*/
@@ -1140,9 +1148,9 @@ else if (isSpringDataWebPropertiesPresent() && optionalSpringDataWebPropertiesPr
/**
* Gets default value.
*
- * @param parameterName the parameter name
- * @param pageableDefault the pageable default
- * @param sortDefault the sort default
+ * @param parameterName the parameter name
+ * @param pageableDefault the pageable default
+ * @param sortDefault the sort default
* @param defaultSchemaVal the default schema val
* @return the default value
*/
@@ -1167,7 +1175,7 @@ private String getArrayDefaultValue(String parameterName, PageableDefault pageab
* Gets default sort.
*
* @param pageableDefault the pageable default
- * @param sortDefault the sort default
+ * @param sortDefault the sort default
* @return the default sort
*/
private DefaultSort getDefaultSort(PageableDefault pageableDefault, SortDefault sortDefault) {
@@ -1222,23 +1230,52 @@ private boolean isRepositoryRestConfigurationPresent() {
return optionalRepositoryRestConfigurationProvider.isPresent() && optionalRepositoryRestConfigurationProvider.get().isRepositoryRestConfigurationPresent();
}
+ /**
+ * The type Default sort.
+ */
private static class DefaultSort {
+ /**
+ * The constant DIRECTION_GROUP.
+ */
private static final String DIRECTION_GROUP = Arrays.stream(Sort.Direction.values()).map(Enum::name).collect(Collectors.joining("|"));
+ /**
+ * The constant DIRECTED_REGEXP.
+ */
private static final String DIRECTED_REGEXP = "\\w+(\\.\\w+)*,\\s*(" + DIRECTION_GROUP + ')';
+ /**
+ * The constant DIRECTED_PATTERN.
+ */
private static final Pattern DIRECTED_PATTERN = Pattern.compile(DIRECTED_REGEXP, Pattern.CASE_INSENSITIVE);
+ /**
+ * The Direction.
+ */
private final Sort.Direction direction;
+ /**
+ * The Properties.
+ */
private final String[] properties;
+ /**
+ * Instantiates a new Default sort.
+ *
+ * @param direction the direction
+ * @param properties the properties
+ */
DefaultSort(Sort.Direction direction, String... properties) {
this.direction = direction;
this.properties = properties;
}
+ /**
+ * Gets effective properties.
+ *
+ * @return the effective properties
+ */
List getEffectiveProperties() {
return Arrays.stream(properties)
.map(p -> {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestRouterOperationCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestRouterOperationCustomizer.java
index b9f968a4d..51a79aaec 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestRouterOperationCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestRouterOperationCustomizer.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.customizers;
import org.springdoc.core.fn.RouterOperation;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DelegatingMethodParameterCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DelegatingMethodParameterCustomizer.java
index 74a3bac4d..0c1cc5cb4 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DelegatingMethodParameterCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DelegatingMethodParameterCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -36,7 +38,7 @@ public interface DelegatingMethodParameterCustomizer {
* Customize.
*
* @param originalParameter the original parameter
- * @param methodParameter the method parameter
+ * @param methodParameter the method parameter
*/
void customize(MethodParameter originalParameter, MethodParameter methodParameter);
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/GlobalOpenApiCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/GlobalOpenApiCustomizer.java
index 8b5130cdc..a095e05f9 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/GlobalOpenApiCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/GlobalOpenApiCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -29,7 +31,7 @@
* customize Open api on default OpenAPI description and groups.
*
* @author christophejan
- * @see OpenApiCustomizer customize default OpenAPI description but not groups
+ * @see OpenApiCustomizer default OpenAPI description but not groups
*/
public interface GlobalOpenApiCustomizer extends OpenApiCustomizer {
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/GlobalOperationCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/GlobalOperationCustomizer.java
index 9dc560053..ed9ab472c 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/GlobalOperationCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/GlobalOperationCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -30,7 +32,7 @@
* description and groups
*
* @author christophejan
- * @see OperationCustomizer customize operations on default OpenAPI description but not groups
+ * @see OperationCustomizer operations on default OpenAPI description but not groups
*/
public interface GlobalOperationCustomizer extends OperationCustomizer {
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/JavadocPropertyCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/JavadocPropertyCustomizer.java
index e81ea2225..fd76c76a4 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/JavadocPropertyCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/JavadocPropertyCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * Copyright 2019-2023 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -44,6 +46,7 @@
import io.swagger.v3.core.converter.ModelConverterContext;
import io.swagger.v3.core.converter.ModelConverterContextImpl;
import io.swagger.v3.core.util.AnnotationsUtils;
+import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
@@ -64,6 +67,9 @@ public record JavadocPropertyCustomizer(JavadocProvider javadocProvider,
ObjectMapperProvider objectMapperProvider)
implements ModelConverter {
+ /**
+ * The constant LOGGER.
+ */
private static final Logger LOGGER = LoggerFactory.getLogger(DelegatingMethodParameter.class);
/**
@@ -95,7 +101,7 @@ public Schema resolve(AnnotatedType type, ModelConverterContext context, Iterato
setJavadocDescription(cls, fields, clsProperties, existingSchema, false);
}
else if (resolvedSchema != null && resolvedSchema.get$ref() != null && resolvedSchema.get$ref().contains(AnnotationsUtils.COMPONENTS_REF)) {
- String schemaName = resolvedSchema.get$ref().substring(21);
+ String schemaName = resolvedSchema.get$ref().substring(Components.COMPONENTS_SCHEMAS_REF.length());
Schema existingSchema = context.getDefinedModels().get(schemaName);
setJavadocDescription(cls, fields, clsProperties, existingSchema, false);
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiBuilderCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiBuilderCustomizer.java
index 25d8d467e..b1b673a25 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiBuilderCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiBuilderCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -28,6 +30,7 @@
/**
* The interface Open api builder customizer.
+ *
* @author bnasslahsen
*/
@FunctionalInterface
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiCustomizer.java
index 970203322..122a34d42 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -31,7 +33,7 @@
* Open api on default OpenAPI description but not on groups
*
* @author bnasslahsen
- * @see GlobalOpenApiCustomizer customize default OpenAPI description and groups
+ * @see GlobalOpenApiCustomizer default OpenAPI description and groups
*/
@FunctionalInterface
public interface OpenApiCustomizer {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiHateoasLinksCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiHateoasLinksCustomizer.java
index 4c1d80b0e..bb77dab38 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiHateoasLinksCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiHateoasLinksCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -39,6 +41,7 @@
/**
* The type Open api hateoas links customiser.
+ *
* @author bnasslahsen
*/
public class OpenApiHateoasLinksCustomizer extends SpecFilter implements GlobalOpenApiCustomizer {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiLocaleCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiLocaleCustomizer.java
index 568945325..4ee54f1fd 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiLocaleCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OpenApiLocaleCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -30,6 +32,7 @@
/**
* The interface Open api locale customizer.
+ *
* @author bnasslahsen
*/
@FunctionalInterface
@@ -39,7 +42,7 @@ public interface OpenApiLocaleCustomizer {
* Customise.
*
* @param openApi the open api
- * @param locale the locale
+ * @param locale the locale
*/
void customise(OpenAPI openApi, Locale locale);
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OperationCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OperationCustomizer.java
index 015f4afc7..d0016c9ef 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OperationCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OperationCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -34,7 +36,7 @@
* groups
*
* @author bnasslahsen
- * @see GlobalOperationCustomizer customize operations on default OpenAPI description and groups
+ * @see GlobalOperationCustomizer operations on default OpenAPI description and groups
*/
@FunctionalInterface
public interface OperationCustomizer {
@@ -42,7 +44,7 @@ public interface OperationCustomizer {
/**
* Customize operation.
*
- * @param operation input operation
+ * @param operation input operation
* @param handlerMethod original handler method
* @return customized operation
*/
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OperationIdCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OperationIdCustomizer.java
new file mode 100644
index 000000000..58bf1a162
--- /dev/null
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/OperationIdCustomizer.java
@@ -0,0 +1,92 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.customizers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.Operation;
+import io.swagger.v3.oas.models.PathItem;
+
+/**
+ * The type Operation id customizer.
+ *
+ * @author bnasslahsen
+ */
+public class OperationIdCustomizer implements GlobalOpenApiCustomizer {
+
+ @Override
+ public void customise(OpenAPI openApi) {
+ // Map to store operationId counts
+ Map operationIdCount = new HashMap<>();
+
+ // Iterate through all the paths
+ for (Map.Entry pathEntry : openApi.getPaths().entrySet()) {
+ PathItem pathItem = pathEntry.getValue();
+
+ // Process all HTTP methods for the path (GET, POST, PUT, DELETE, etc.)
+ processOperation(pathItem.getGet(), operationIdCount);
+ processOperation(pathItem.getPost(), operationIdCount);
+ processOperation(pathItem.getPut(), operationIdCount);
+ processOperation(pathItem.getDelete(), operationIdCount);
+ processOperation(pathItem.getPatch(), operationIdCount);
+ processOperation(pathItem.getHead(), operationIdCount);
+ processOperation(pathItem.getOptions(), operationIdCount);
+ processOperation(pathItem.getTrace(), operationIdCount);
+ }
+ }
+
+ /**
+ * Process operation.
+ *
+ * @param operation the operation
+ * @param operationIdCount the operation id count
+ */
+// Helper method to process each operation and handle duplicate operationId
+ private void processOperation(Operation operation, Map operationIdCount) {
+ if (operation != null) {
+ String originalOperationId = operation.getOperationId();
+
+ // Check if operationId already exists
+ if (operationIdCount.containsKey(originalOperationId)) {
+ // Get the count for the current operationId and increment
+ int count = operationIdCount.get(originalOperationId);
+ count++;
+ operationIdCount.put(originalOperationId, count);
+
+ // Create new unique operationId by appending _x
+ String newOperationId = originalOperationId + "_" + count;
+ operation.setOperationId(newOperationId);
+ }
+ else {
+ // First time this operationId is seen, initialize the count
+ operationIdCount.put(originalOperationId, 0);
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ParameterCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ParameterCustomizer.java
index 7dbaa0d3c..61fc363cc 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ParameterCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ParameterCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -31,6 +33,7 @@
/**
* Implement and register a bean of type {@link ParameterCustomizer} to customize a parameter
* based on the parameter and handler method input
+ *
* @author bnasslahsen
*/
@FunctionalInterface
@@ -38,7 +41,7 @@ public interface ParameterCustomizer {
/**
* Customize parameter.
*
- * @param parameterModel to be customized
+ * @param parameterModel to be customized
* @param methodParameter original parameter from handler method
* @return customized parameter
*/
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ParameterObjectNamingStrategyCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ParameterObjectNamingStrategyCustomizer.java
new file mode 100644
index 000000000..464dcef43
--- /dev/null
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ParameterObjectNamingStrategyCustomizer.java
@@ -0,0 +1,70 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.customizers;
+
+import java.lang.reflect.Field;
+
+import com.fasterxml.jackson.databind.PropertyNamingStrategies;
+import com.fasterxml.jackson.databind.annotation.JsonNaming;
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.springframework.core.MethodParameter;
+import org.springframework.core.annotation.AnnotatedElementUtils;
+
+/**
+ * The type Parameter object naming strategy customizer.
+ *
+ * @author bnasslahsen
+ */
+public class ParameterObjectNamingStrategyCustomizer implements DelegatingMethodParameterCustomizer {
+
+ /**
+ * The constant LOGGER.
+ */
+ private static final Logger LOGGER = LoggerFactory.getLogger(ParameterObjectNamingStrategyCustomizer.class);
+
+ @Override
+ public void customize(MethodParameter originalParameter, MethodParameter methodParameter) {
+ if (AnnotatedElementUtils.isAnnotated(methodParameter.getContainingClass(), JsonNaming.class)) {
+ JsonNaming jsonNaming = methodParameter.getContainingClass().getAnnotation(JsonNaming.class);
+ if (jsonNaming.value().equals(PropertyNamingStrategies.UpperSnakeCaseStrategy.class)) {
+ try {
+ Field parameterNameField = FieldUtils.getDeclaredField(methodParameter.getClass(), "parameterName",
+ true);
+ parameterNameField.set(methodParameter,
+ PropertyNamingStrategies.UpperSnakeCaseStrategy.INSTANCE.translate(
+ methodParameter.getParameterName()));
+ }
+ catch (IllegalAccessException e) {
+ LOGGER.warn(e.getMessage());
+ }
+ }
+ }
+ }
+}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/PropertyCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/PropertyCustomizer.java
index 447958c3e..ebbb9b3b5 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/PropertyCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/PropertyCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -30,6 +32,7 @@
/**
* Implement and register a bean of type {@link PropertyCustomizer} to customize a schema property
* based on annotated type
+ *
* @author bnasslahsen
*/
@FunctionalInterface
@@ -39,7 +42,7 @@ public interface PropertyCustomizer {
* Customize schema.
*
* @param property to be customized
- * @param type form the model class
+ * @param type form the model class
* @return customized property
*/
Schema customize(Schema property, AnnotatedType type);
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/QuerydslPredicateOperationCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/QuerydslPredicateOperationCustomizer.java
index bbd45e5d3..c06aee89d 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/QuerydslPredicateOperationCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/QuerydslPredicateOperationCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
@@ -62,6 +64,7 @@
/**
* The type Querydsl predicate operation customizer.
+ *
* @author Gibah Joseph Email: gibahjoe@gmail.com Mar, 2020
*/
@SuppressWarnings("unchecked")
@@ -149,17 +152,14 @@ public Operation customize(Operation operation, HandlerMethod handlerMethod) {
/**
* Gets field value of boolean.
*
- * @param instance the instance
- * @param fieldName the field name
+ * @param instance the instance
+ * @param fieldName the field name
* @return the field value of boolean
*/
private boolean getFieldValueOfBoolean(QuerydslBindings instance, String fieldName) {
try {
- Field field = FieldUtils.getDeclaredField(instance.getClass(), fieldName, true);
- if (field != null)
- return (boolean) field.get(instance);
- }
- catch (IllegalAccessException e) {
+ return (boolean) FieldUtils.readDeclaredField(instance, fieldName, true);
+ } catch (IllegalAccessException e) {
LOGGER.warn(e.getMessage());
}
return false;
@@ -168,7 +168,7 @@ private boolean getFieldValueOfBoolean(QuerydslBindings instance, String fieldNa
/**
* Extract qdsl bindings querydsl bindings.
*
- * @param predicate the predicate
+ * @param predicate the predicate
* @return the querydsl bindings
*/
private QuerydslBindings extractQdslBindings(QuerydslPredicate predicate) {
@@ -187,9 +187,9 @@ private QuerydslBindings extractQdslBindings(QuerydslPredicate predicate) {
/**
* Gets field values.
*
- * @param instance the instance
- * @param fieldName the field name
- * @param alternativeFieldName the alternative field name
+ * @param instance the instance
+ * @param fieldName the field name
+ * @param alternativeFieldName the alternative field name
* @return the field values
*/
private Set getFieldValues(QuerydslBindings instance, String fieldName, String alternativeFieldName) {
@@ -209,14 +209,13 @@ private Set getFieldValues(QuerydslBindings instance, String fieldName,
/**
* Gets path spec.
*
- * @param instance the instance
- * @param fieldName the field name
+ * @param instance the instance
+ * @param fieldName the field name
* @return the path spec
*/
private Map getPathSpec(QuerydslBindings instance, String fieldName) {
try {
- Field field = FieldUtils.getDeclaredField(instance.getClass(), fieldName, true);
- return (Map) field.get(instance);
+ return (Map) FieldUtils.readDeclaredField(instance, fieldName, true);
}
catch (IllegalAccessException e) {
LOGGER.warn(e.getMessage());
@@ -227,7 +226,7 @@ private Map getPathSpec(QuerydslBindings instance, String fieldN
/**
* Gets path from path spec.
*
- * @param instance the instance
+ * @param instance the instance
* @return the path from path spec
*/
private Optional> getPathFromPathSpec(Object instance) {
@@ -235,8 +234,7 @@ private Optional> getPathFromPathSpec(Object instance) {
if (instance == null) {
return Optional.empty();
}
- Field field = FieldUtils.getDeclaredField(instance.getClass(), "path", true);
- return (Optional>) field.get(instance);
+ return (Optional>) FieldUtils.readDeclaredField(instance, "path", true);
}
catch (IllegalAccessException e) {
LOGGER.warn(e.getMessage());
@@ -246,9 +244,9 @@ private Optional> getPathFromPathSpec(Object instance) {
/***
* Tries to figure out the Type of the field. It first checks the Qdsl pathSpecMap before checking the root class. Defaults to String.class
- * @param fieldName The name of the field used as reference to get the type
- * @param pathSpecMap The Qdsl path specifications as defined in the resolved bindings
- * @param root The root type where the paths are gotten
+ * @param fieldName The name of the field used as reference to get the type
+ * @param pathSpecMap The Qdsl path specifications as defined in the resolved bindings
+ * @param root The root type where the paths are gotten
* @return The type of the field. Returns
*/
private Type getFieldType(String fieldName, Map pathSpecMap, Class> root) {
@@ -273,8 +271,8 @@ private Type getFieldType(String fieldName, Map pathSpecMap, Cla
/***
* Constructs the parameter
- * @param type The type of the parameter
- * @param name The name of the parameter
+ * @param type The type of the parameter
+ * @param name The name of the parameter
* @return The swagger parameter
*/
private Parameter buildParam(Type type, String name) {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/RouterOperationCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/RouterOperationCustomizer.java
index 2bf93dc60..196e2ef7d 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/RouterOperationCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/RouterOperationCustomizer.java
@@ -1,3 +1,29 @@
+/*
+ *
+ * *
+ * * *
+ * * * *
+ * * * * *
+ * * * * * * Copyright 2019-2024 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 org.springdoc.core.customizers;
import org.springdoc.core.fn.RouterOperation;
@@ -17,7 +43,7 @@ public interface RouterOperationCustomizer {
* Customize router operation.
*
* @param routerOperation input operation
- * @param handlerMethod original handler method
+ * @param handlerMethod original handler method
* @return customized router operation
*/
RouterOperation customize(RouterOperation routerOperation, HandlerMethod handlerMethod);
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ServerBaseUrlCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ServerBaseUrlCustomizer.java
index b209ba72e..229427559 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ServerBaseUrlCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/ServerBaseUrlCustomizer.java
@@ -3,29 +3,34 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
+import org.springframework.http.HttpRequest;
+
/**
* The interface Server Base URL customiser.
+ *
* @author skylar -stark
*/
@FunctionalInterface
@@ -35,7 +40,8 @@ public interface ServerBaseUrlCustomizer {
* Customise.
*
* @param serverBaseUrl the serverBaseUrl.
+ * @param request the request.
* @return the customised serverBaseUrl
*/
- String customize(String serverBaseUrl);
+ String customize(String serverBaseUrl, HttpRequest request);
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/SpecPropertiesCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/SpecPropertiesCustomizer.java
index f87f36eca..a25957473 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/SpecPropertiesCustomizer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/SpecPropertiesCustomizer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/SpringDocCustomizers.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/SpringDocCustomizers.java
index 10ce504c6..286c331cc 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/SpringDocCustomizers.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/SpringDocCustomizers.java
@@ -3,30 +3,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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.customizers;
-import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+import java.util.Set;
import org.springdoc.core.filters.GlobalOpenApiMethodFilter;
import org.springdoc.core.filters.OpenApiMethodFilter;
@@ -49,23 +51,23 @@ public class SpringDocCustomizers implements ApplicationContextAware, Initializi
/**
* The Open api customisers.
*/
- private final Optional> openApiCustomizers;
+ private final Optional> openApiCustomizers;
/**
* The Operation customizers.
*/
- private final Optional> operationCustomizers;
+ private final Optional> operationCustomizers;
/**
* The RouterOperation customizers.
*/
- private final Optional> routerOperationCustomizers;
+ private final Optional> routerOperationCustomizers;
/**
* The Data rest router operation customizers.
*/
- private final Optional> dataRestRouterOperationCustomizers;
+ private final Optional> dataRestRouterOperationCustomizers;
/**
* The Context.
@@ -75,43 +77,43 @@ public class SpringDocCustomizers implements ApplicationContextAware, Initializi
/**
* The method filters to use.
*/
- private final Optional> methodFilters;
+ private final Optional> methodFilters;
/**
* The Global open api customizers.
*/
- private Optional> globalOpenApiCustomizers;
+ private Optional> globalOpenApiCustomizers;
/**
* The Global operation customizers.
*/
- private Optional> globalOperationCustomizers;
+ private Optional> globalOperationCustomizers;
/**
* The Global open api method filters.
*/
- private Optional> globalOpenApiMethodFilters;
+ private Optional> globalOpenApiMethodFilters;
/**
* Instantiates a new Spring doc customizers.
*
- * @param openApiCustomizers the open api customizers
- * @param operationCustomizers the operation customizers
- * @param routerOperationCustomizers the router operation customizers
+ * @param openApiCustomizers the open api customizers
+ * @param operationCustomizers the operation customizers
+ * @param routerOperationCustomizers the router operation customizers
* @param dataRestRouterOperationCustomizers the data rest router operation customizers
- * @param methodFilters the method filters
- * @param globalOpenApiCustomizers the global open api customizers
- * @param globalOperationCustomizers the global operation customizers
- * @param globalOpenApiMethodFilters the global open api method filters
- */
- public SpringDocCustomizers(Optional> openApiCustomizers,
- Optional> operationCustomizers,
- Optional> routerOperationCustomizers,
- Optional> dataRestRouterOperationCustomizers,
- Optional> methodFilters,
- Optional> globalOpenApiCustomizers, Optional> globalOperationCustomizers,
- Optional> globalOpenApiMethodFilters) {
+ * @param methodFilters the method filters
+ * @param globalOpenApiCustomizers the global open api customizers
+ * @param globalOperationCustomizers the global operation customizers
+ * @param globalOpenApiMethodFilters the global open api method filters
+ */
+ public SpringDocCustomizers(Optional> openApiCustomizers,
+ Optional> operationCustomizers,
+ Optional> routerOperationCustomizers,
+ Optional> dataRestRouterOperationCustomizers,
+ Optional> methodFilters,
+ Optional> globalOpenApiCustomizers, Optional> globalOperationCustomizers,
+ Optional> globalOpenApiMethodFilters) {
this.openApiCustomizers = openApiCustomizers;
this.operationCustomizers = operationCustomizers;
this.globalOpenApiCustomizers = globalOpenApiCustomizers;
@@ -126,13 +128,13 @@ public SpringDocCustomizers(Optional> openApiCustomizers
/**
* Instantiates a new Spring doc customizers.
*
- * @param openApiCustomizers the open api customizers
- * @param operationCustomizers the operation customizers
+ * @param openApiCustomizers the open api customizers
+ * @param operationCustomizers the operation customizers
* @param routerOperationCustomizers the router operation customizers
- * @param openApiMethodFilters the open api method filters
+ * @param openApiMethodFilters the open api method filters
*/
- public SpringDocCustomizers(Optional> openApiCustomizers, Optional> operationCustomizers,
- Optional> routerOperationCustomizers, Optional> openApiMethodFilters) {
+ public SpringDocCustomizers(Optional> openApiCustomizers, Optional> operationCustomizers,
+ Optional> routerOperationCustomizers, Optional> openApiMethodFilters) {
this.openApiCustomizers = openApiCustomizers;
this.operationCustomizers = operationCustomizers;
this.routerOperationCustomizers = routerOperationCustomizers;
@@ -145,7 +147,7 @@ public SpringDocCustomizers(Optional> openApiCustomizers
*
* @return the open api customizers
*/
- public Optional> getOpenApiCustomizers() {
+ public Optional> getOpenApiCustomizers() {
return openApiCustomizers;
}
@@ -154,7 +156,7 @@ public Optional> getOpenApiCustomizers() {
*
* @return the operation customizers
*/
- public Optional> getOperationCustomizers() {
+ public Optional> getOperationCustomizers() {
return operationCustomizers;
}
@@ -163,7 +165,7 @@ public Optional> getOperationCustomizers() {
*
* @return the router operation customizers
*/
- public Optional> getRouterOperationCustomizers() {
+ public Optional> getRouterOperationCustomizers() {
return routerOperationCustomizers;
}
@@ -172,7 +174,7 @@ public Optional> getRouterOperationCustomizers()
*
* @return the data rest router operation customizers
*/
- public Optional> getDataRestRouterOperationCustomizers() {
+ public Optional> getDataRestRouterOperationCustomizers() {
return dataRestRouterOperationCustomizers;
}
@@ -181,7 +183,7 @@ public Optional> getDataRestRouterOperat
*
* @return the method filters
*/
- public Optional> getMethodFilters() {
+ public Optional> getMethodFilters() {
return methodFilters;
}
@@ -195,7 +197,7 @@ public void setApplicationContext(ApplicationContext applicationContext) throws
*
* @return the global open api customizers
*/
- public Optional> getGlobalOpenApiCustomizers() {
+ public Optional> getGlobalOpenApiCustomizers() {
return globalOpenApiCustomizers;
}
@@ -204,7 +206,7 @@ public Optional> getGlobalOpenApiCustomizers() {
*
* @return the global operation customizers
*/
- public Optional> getGlobalOperationCustomizers() {
+ public Optional> getGlobalOperationCustomizers() {
return globalOperationCustomizers;
}
@@ -213,7 +215,7 @@ public Optional> getGlobalOperationCustomizers()
*
* @return the global open api method filters
*/
- public Optional> getGlobalOpenApiMethodFilters() {
+ public Optional> getGlobalOpenApiMethodFilters() {
return globalOpenApiMethodFilters;
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/ControllerType.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/ControllerType.java
index 8a6bde515..c23d148ce 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/ControllerType.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/ControllerType.java
@@ -3,50 +3,53 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.data;
/**
* The enum Controller type.
+ *
* @author bnasslahsen
*/
public enum ControllerType {
/**
- *Entity controller type.
+ * Entity controller type.
*/
ENTITY,
/**
- *Search controller type.
+ * Search controller type.
*/
SEARCH,
/**
- *Schema controller type.
+ * Schema controller type.
*/
SCHEMA,
/**
- *PROPERTY controller type.
+ * PROPERTY controller type.
*/
PROPERTY,
/**
- *GENERAL controller type.
+ * GENERAL controller type.
*/
GENERAL
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestOperationService.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestOperationService.java
index 7fd17b417..71f93b67b 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestOperationService.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestOperationService.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.data;
@@ -59,6 +61,7 @@
/**
* The type Data rest operation builder.
+ *
* @author bnasslahsen
*/
public class DataRestOperationService {
@@ -96,10 +99,10 @@ public class DataRestOperationService {
/**
* Instantiates a new Data rest operation builder.
*
- * @param dataRestRequestService the data rest request builder
- * @param tagsBuilder the tags builder
+ * @param dataRestRequestService the data rest request builder
+ * @param tagsBuilder the tags builder
* @param dataRestResponseService the data rest response builder
- * @param operationService the operation service
+ * @param operationService the operation service
*/
public DataRestOperationService(DataRestRequestService dataRestRequestService, DataRestTagsService tagsBuilder,
DataRestResponseService dataRestResponseService, OperationService operationService) {
@@ -112,15 +115,15 @@ public DataRestOperationService(DataRestRequestService dataRestRequestService, D
/**
* Build operation.
*
- * @param handlerMethod the handler method
- * @param dataRestRepository the repository data rest
- * @param openAPI the open api
- * @param requestMethod the request method
- * @param operationPath the operation path
- * @param methodAttributes the method attributes
- * @param resourceMetadata the resource metadata
+ * @param handlerMethod the handler method
+ * @param dataRestRepository the repository data rest
+ * @param openAPI the open api
+ * @param requestMethod the request method
+ * @param operationPath the operation path
+ * @param methodAttributes the method attributes
+ * @param resourceMetadata the resource metadata
* @param methodResourceMapping the method resource mapping
- * @param controllerType the controller type
+ * @param controllerType the controller type
* @return the operation
*/
public Operation buildOperation(HandlerMethod handlerMethod, DataRestRepository dataRestRepository,
@@ -143,13 +146,13 @@ else if (ControllerType.SEARCH.equals(controllerType)) {
/**
* Build entity operation.
*
- * @param handlerMethod the handler method
+ * @param handlerMethod the handler method
* @param dataRestRepository the repository data rest
- * @param openAPI the open api
- * @param requestMethod the request method
- * @param operationPath the operation path
- * @param methodAttributes the method attributes
- * @param resourceMetadata the resource metadata
+ * @param openAPI the open api
+ * @param requestMethod the request method
+ * @param operationPath the operation path
+ * @param methodAttributes the method attributes
+ * @param resourceMetadata the resource metadata
* @return the operation
*/
private Operation buildEntityOperation(HandlerMethod handlerMethod, DataRestRepository dataRestRepository,
@@ -170,13 +173,13 @@ private Operation buildEntityOperation(HandlerMethod handlerMethod, DataRestRepo
/**
* Build search operation.
*
- * @param handlerMethod the handler method
- * @param dataRestRepository the repository data rest
- * @param openAPI the open api
- * @param requestMethod the request method
- * @param methodAttributes the method attributes
+ * @param handlerMethod the handler method
+ * @param dataRestRepository the repository data rest
+ * @param openAPI the open api
+ * @param requestMethod the request method
+ * @param methodAttributes the method attributes
* @param methodResourceMapping the method resource mapping
- * @param resourceMetadata the resource metadata
+ * @param resourceMetadata the resource metadata
* @return the operation
*/
private Operation buildSearchOperation(HandlerMethod handlerMethod, DataRestRepository dataRestRepository,
@@ -235,8 +238,8 @@ else if (CollectionUtils.isEmpty(operation.getParameters()))
/**
* Gets parameter type.
*
- * @param pName the p name
- * @param method the method
+ * @param pName the p name
+ * @param method the method
* @param description the description
* @return the parameter type
*/
@@ -268,10 +271,10 @@ private Type getParameterType(String pName, Method method, ResourceDescription d
/**
* Update parameter from annotations parameter.
*
- * @param openAPI the open api
+ * @param openAPI the open api
* @param methodAttributes the method attributes
- * @param method the method
- * @param pName the p name
+ * @param method the method
+ * @param pName the p name
* @return the parameter
*/
private Parameter getParameterFromAnnotations(OpenAPI openAPI, MethodAttributes methodAttributes, Method method, String pName) {
@@ -295,7 +298,7 @@ private Parameter getParameterFromAnnotations(OpenAPI openAPI, MethodAttributes
* Init operation.
*
* @param handlerMethod the handler method
- * @param domainType the domain type
+ * @param domainType the domain type
* @param requestMethod the request method
* @return the operation
*/
@@ -313,9 +316,10 @@ private Operation initOperation(HandlerMethod handlerMethod, Class> domainType
/**
* Add operation description.
- * @param operation the operation
- * @param requestMethod the request method
- * @param entity the entity
+ *
+ * @param operation the operation
+ * @param requestMethod the request method
+ * @param entity the entity
* @param dataRestRepository the data rest repository
*/
private void addOperationDescription(Operation operation, RequestMethod requestMethod, String entity, DataRestRepository dataRestRepository) {
@@ -343,8 +347,8 @@ private void addOperationDescription(Operation operation, RequestMethod requestM
/**
* Create description.
*
- * @param action the action
- * @param entity the entity
+ * @param action the action
+ * @param entity the entity
* @param dataRestRepository the data rest repository
* @return the string
*/
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRepository.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRepository.java
index 12234f84e..87874be1e 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRepository.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRepository.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.data;
@@ -30,6 +32,7 @@
/**
* The type Data rest repository.
+ *
* @author bnasslahsen
*/
public class DataRestRepository {
@@ -82,9 +85,9 @@ public class DataRestRepository {
/**
* Instantiates a new Data rest repository.
*
- * @param domainType the domain type
+ * @param domainType the domain type
* @param repositoryType the repository type
- * @param locale the locale
+ * @param locale the locale
*/
public DataRestRepository(Class> domainType, Class> repositoryType, Locale locale) {
this.domainType = domainType;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRequestService.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRequestService.java
index b756e7a87..a00aad09e 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRequestService.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRequestService.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.data;
@@ -63,8 +65,11 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;
+import static org.springdoc.core.utils.SpringDocUtils.getParameterAnnotations;
+
/**
* The type Data rest request builder.
+ *
* @author bnasslahsen
*/
public class DataRestRequestService {
@@ -98,10 +103,10 @@ public class DataRestRequestService {
* Instantiates a new Data rest request builder.
*
* @param localSpringDocParameterNameDiscoverer the local spring doc parameter name discoverer
- * @param parameterBuilder the parameter builder
- * @param requestBodyService the request body builder
- * @param requestBuilder the request builder
- * @param springDocDataRestUtils the spring doc data rest utils
+ * @param parameterBuilder the parameter builder
+ * @param requestBodyService the request body builder
+ * @param requestBuilder the request builder
+ * @param springDocDataRestUtils the spring doc data rest utils
*/
public DataRestRequestService(SpringDocParameterNameDiscoverer localSpringDocParameterNameDiscoverer, GenericParameterService parameterBuilder,
RequestBodyService requestBodyService, AbstractRequestService requestBuilder, SpringDocDataRestUtils springDocDataRestUtils) {
@@ -115,12 +120,12 @@ public DataRestRequestService(SpringDocParameterNameDiscoverer localSpringDocPar
/**
* Build parameters.
*
- * @param openAPI the open api
- * @param handlerMethod the handler method
- * @param requestMethod the request method
- * @param methodAttributes the method attributes
- * @param operation the operation
- * @param resourceMetadata the resource metadata
+ * @param openAPI the open api
+ * @param handlerMethod the handler method
+ * @param requestMethod the request method
+ * @param methodAttributes the method attributes
+ * @param operation the operation
+ * @param resourceMetadata the resource metadata
* @param dataRestRepository the data rest repository
*/
public void buildParameters(OpenAPI openAPI, HandlerMethod handlerMethod, RequestMethod requestMethod, MethodAttributes methodAttributes,
@@ -141,17 +146,17 @@ public void buildParameters(OpenAPI openAPI, HandlerMethod handlerMethod, Reques
/**
* Build common parameters.
*
- * @param openAPI the open api
- * @param requestMethod the request method
- * @param methodAttributes the method attributes
- * @param operation the operation
- * @param pNames the p names
- * @param parameters the parameters
+ * @param openAPI the open api
+ * @param requestMethod the request method
+ * @param methodAttributes the method attributes
+ * @param operation the operation
+ * @param pNames the p names
+ * @param parameters the parameters
* @param dataRestRepository the data rest repository
*/
public void buildCommonParameters(OpenAPI openAPI, RequestMethod requestMethod, MethodAttributes methodAttributes, Operation operation, String[] pNames, MethodParameter[] parameters,
DataRestRepository dataRestRepository) {
- parameters = DelegatingMethodParameter.customize(pNames, parameters, parameterBuilder.getDelegatingMethodParameterCustomizer(), requestBuilder.isDefaultFlatParamObject());
+ parameters = DelegatingMethodParameter.customize(pNames, parameters, parameterBuilder.getOptionalDelegatingMethodParameterCustomizers(), requestBuilder.isDefaultFlatParamObject());
Class> domainType = dataRestRepository.getDomainType();
for (MethodParameter methodParameter : parameters) {
final String pName = methodParameter.getParameterName();
@@ -161,7 +166,7 @@ public void buildCommonParameters(OpenAPI openAPI, RequestMethod requestMethod,
ParameterInfo parameterInfo = new ParameterInfo(pName, methodParameter, parameterBuilder, parameterDoc);
if (isParamToIgnore(methodParameter)) {
if (PersistentEntityResource.class.equals(methodParameter.getParameterType())) {
- Schema> schema = SpringDocAnnotationsUtils.resolveSchemaFromType(domainType, openAPI.getComponents(), null, methodParameter.getParameterAnnotations(), openAPI.getSpecVersion());
+ Schema> schema = SpringDocAnnotationsUtils.resolveSchemaFromType(domainType, openAPI.getComponents(), null, getParameterAnnotations(methodParameter), openAPI.getSpecVersion());
parameterInfo.setParameterModel(new Parameter().schema(schema));
}
else if (methodParameter.getParameterAnnotation(BackendId.class) != null) {
@@ -175,7 +180,7 @@ else if (methodParameter.getParameterAnnotation(BackendId.class) != null) {
parameterInfo.setParameterModel(parameter);
}
if (!ArrayUtils.isEmpty(methodParameter.getParameterAnnotations()))
- parameter = requestBuilder.buildParams(parameterInfo, openAPI.getComponents(), requestMethod, null,
+ parameter = requestBuilder.buildParams(parameterInfo, openAPI.getComponents(), requestMethod, methodAttributes,
openAPI.getOpenapi());
addParameters(openAPI, requestMethod, methodAttributes, operation, methodParameter, parameterInfo, parameter);
}
@@ -185,10 +190,10 @@ else if (methodParameter.getParameterAnnotation(BackendId.class) != null) {
/**
* Build parameter from doc parameter.
*
- * @param parameterDoc the parameter doc
- * @param components the components
+ * @param parameterDoc the parameter doc
+ * @param components the components
* @param jsonViewAnnotation the json view annotation
- * @param locale the locale
+ * @param locale the locale
* @return the parameter
*/
public Parameter buildParameterFromDoc(io.swagger.v3.oas.annotations.Parameter parameterDoc, Components components, JsonView jsonViewAnnotation, Locale locale) {
@@ -210,17 +215,17 @@ private boolean isParamToIgnore(MethodParameter methodParameter) {
/**
* Add parameters.
*
- * @param openAPI the open api
- * @param requestMethod the request method
+ * @param openAPI the open api
+ * @param requestMethod the request method
* @param methodAttributes the method attributes
- * @param operation the operation
- * @param methodParameter the method parameter
- * @param parameterInfo the parameter info
- * @param parameter the parameter
+ * @param operation the operation
+ * @param methodParameter the method parameter
+ * @param parameterInfo the parameter info
+ * @param parameter the parameter
*/
private void addParameters(OpenAPI openAPI, RequestMethod requestMethod, MethodAttributes methodAttributes, Operation operation,
MethodParameter methodParameter, ParameterInfo parameterInfo, Parameter parameter) {
- List parameterAnnotations = Arrays.asList(methodParameter.getParameterAnnotations());
+ List parameterAnnotations = Arrays.asList(getParameterAnnotations(methodParameter));
if (requestBuilder.isValidParameter(parameter)) {
requestBuilder.applyBeanValidatorAnnotations(parameter, parameterAnnotations);
operation.addParametersItem(parameter);
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestResponseService.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestResponseService.java
index cc4967231..7f5d7af35 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestResponseService.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestResponseService.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.data;
@@ -39,10 +41,10 @@
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.responses.ApiResponses;
import org.springdoc.core.models.MethodAttributes;
-import org.springdoc.core.parsers.ReturnTypeParser;
import org.springdoc.core.service.GenericResponseService;
import org.springdoc.core.utils.SpringDocDataRestUtils;
+import org.springframework.core.GenericTypeResolver;
import org.springframework.core.MethodParameter;
import org.springframework.core.ResolvableType;
import org.springframework.data.rest.core.mapping.MethodResourceMapping;
@@ -62,6 +64,7 @@
/**
* The type Data rest response builder.
+ *
* @author bnasslahsen
*/
public class DataRestResponseService {
@@ -94,14 +97,15 @@ public DataRestResponseService(GenericResponseService genericResponseService, Sp
/**
* Build search response.
- * @param operation the operation
- * @param handlerMethod the handler method
- * @param openAPI the open api
+ *
+ * @param operation the operation
+ * @param handlerMethod the handler method
+ * @param openAPI the open api
* @param methodResourceMapping the method resource mapping
- * @param domainType the domain type
- * @param methodAttributes the method attributes
- * @param resourceMetadata the resource metadata
- * @param dataRestRepository the data rest repository
+ * @param domainType the domain type
+ * @param methodAttributes the method attributes
+ * @param resourceMetadata the resource metadata
+ * @param dataRestRepository the data rest repository
*/
public void buildSearchResponse(Operation operation, HandlerMethod handlerMethod, OpenAPI openAPI,
MethodResourceMapping methodResourceMapping, Class> domainType, MethodAttributes methodAttributes, ResourceMetadata resourceMetadata,
@@ -130,14 +134,15 @@ public void buildSearchResponse(Operation operation, HandlerMethod handlerMethod
/**
* Build entity response.
- * @param operation the operation
- * @param handlerMethod the handler method
- * @param openAPI the open api
- * @param requestMethod the request method
- * @param operationPath the operation path
- * @param methodAttributes the method attributes
+ *
+ * @param operation the operation
+ * @param handlerMethod the handler method
+ * @param openAPI the open api
+ * @param requestMethod the request method
+ * @param operationPath the operation path
+ * @param methodAttributes the method attributes
* @param dataRestRepository the data rest repository
- * @param resourceMetadata the resource metadata
+ * @param resourceMetadata the resource metadata
*/
public void buildEntityResponse(Operation operation, HandlerMethod handlerMethod, OpenAPI openAPI, RequestMethod requestMethod,
String operationPath, MethodAttributes methodAttributes, DataRestRepository dataRestRepository, ResourceMetadata resourceMetadata) {
@@ -157,8 +162,8 @@ public void buildEntityResponse(Operation operation, HandlerMethod handlerMethod
*
* @param requestMethod the request method
* @param operationPath the operation path
- * @param apiResponses the api responses
- * @param apiResponse the api response
+ * @param apiResponses the api responses
+ * @param apiResponse the api response
*/
private void addResponse(RequestMethod requestMethod, String operationPath, ApiResponses apiResponses, ApiResponse apiResponse) {
switch (requestMethod) {
@@ -192,12 +197,12 @@ private void addResponse(RequestMethod requestMethod, String operationPath, ApiR
* Find search return type.
*
* @param methodResourceMapping the method resource mapping
- * @param domainType the domain type
+ * @param domainType the domain type
* @return the type
*/
private Type findSearchReturnType(MethodResourceMapping methodResourceMapping, Class> domainType) {
Type returnType;
- Type returnRepoType = ReturnTypeParser.resolveType(methodResourceMapping.getMethod().getGenericReturnType(), methodResourceMapping.getMethod().getDeclaringClass());
+ Type returnRepoType = GenericTypeResolver.resolveType(methodResourceMapping.getMethod().getGenericReturnType(), methodResourceMapping.getMethod().getDeclaringClass());
if (methodResourceMapping.isPagingResource()) {
returnType = resolveGenericType(PagedModel.class, EntityModel.class, domainType);
}
@@ -218,29 +223,27 @@ else if (ClassUtils.isPrimitiveOrWrapper(methodResourceMapping.getReturnedDomain
* Gets type.
*
* @param methodParameterReturn the method parameter return
- * @param requestMethod the request method
- * @param dataRestRepository the data rest repository
- * @param resourceMetadata the resource metadata
+ * @param requestMethod the request method
+ * @param dataRestRepository the data rest repository
+ * @param resourceMetadata the resource metadata
* @return the type
*/
private Type getType(MethodParameter methodParameterReturn, RequestMethod requestMethod, DataRestRepository dataRestRepository, ResourceMetadata resourceMetadata) {
- Type returnType = ReturnTypeParser.resolveType(methodParameterReturn.getGenericParameterType(), methodParameterReturn.getContainingClass());
+ Type returnType = GenericTypeResolver.resolveType(methodParameterReturn.getGenericParameterType(), methodParameterReturn.getContainingClass());
Class returnedEntityType = dataRestRepository.getReturnType();
- if (returnType instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) returnType;
+ if (returnType instanceof ParameterizedType parameterizedType) {
if ((ResponseEntity.class.equals(parameterizedType.getRawType()))) {
return getTypeForResponseEntity(requestMethod, dataRestRepository, returnedEntityType, parameterizedType);
}
else if ((HttpEntity.class.equals(parameterizedType.getRawType())
- && parameterizedType.getActualTypeArguments()[0] instanceof ParameterizedType)) {
- ParameterizedType wildcardTypeUpperBound = (ParameterizedType) parameterizedType.getActualTypeArguments()[0];
+ && parameterizedType.getActualTypeArguments()[0] instanceof ParameterizedType wildcardTypeUpperBound)) {
if (RepresentationModel.class.equals(wildcardTypeUpperBound.getRawType())) {
return resolveGenericType(HttpEntity.class, RepresentationModel.class, returnedEntityType);
}
}
else if ((CollectionModel.class.equals(parameterizedType.getRawType())
- && Object.class.equals(parameterizedType.getActualTypeArguments()[0]))) {
+ && parameterizedType.getActualTypeArguments()[0]!=null)) {
return getTypeForCollectionModel(returnedEntityType, resourceMetadata.isPagingResource());
}
}
@@ -250,10 +253,10 @@ else if ((CollectionModel.class.equals(parameterizedType.getRawType())
/**
* Gets type for response entity.
*
- * @param requestMethod the request method
+ * @param requestMethod the request method
* @param dataRestRepository the data rest repository
* @param returnedEntityType the returned entity type
- * @param parameterizedType the parameterized type
+ * @param parameterizedType the parameterized type
* @return the type for response entity
*/
private Type getTypeForResponseEntity(RequestMethod requestMethod, DataRestRepository dataRestRepository, Class returnedEntityType, ParameterizedType parameterizedType) {
@@ -273,7 +276,7 @@ else if (parameterizedType.getActualTypeArguments()[0] instanceof WildcardType)
* Gets type for collection model.
*
* @param returnedEntityType the returned entity type
- * @param pagingResource the paging resource
+ * @param pagingResource the paging resource
* @return the type for collection model
*/
private Type getTypeForCollectionModel(Class returnedEntityType, boolean pagingResource) {
@@ -286,16 +289,15 @@ private Type getTypeForCollectionModel(Class returnedEntityType, boolean pagingR
/**
* Gets type for wildcard type.
*
- * @param requestMethod the request method
+ * @param requestMethod the request method
* @param dataRestRepository the data rest repository
* @param returnedEntityType the returned entity type
- * @param parameterizedType the parameterized type
+ * @param parameterizedType the parameterized type
* @return the type for wildcard type
*/
private Type getTypeForWildcardType(RequestMethod requestMethod, DataRestRepository dataRestRepository, Class returnedEntityType, ParameterizedType parameterizedType) {
WildcardType wildcardType = (WildcardType) parameterizedType.getActualTypeArguments()[0];
- if (wildcardType.getUpperBounds()[0] instanceof ParameterizedType) {
- ParameterizedType wildcardTypeUpperBound = (ParameterizedType) wildcardType.getUpperBounds()[0];
+ if (wildcardType.getUpperBounds()[0] instanceof ParameterizedType wildcardTypeUpperBound) {
if (RepresentationModel.class.equals(wildcardTypeUpperBound.getRawType())) {
Class> type = findType(requestMethod, dataRestRepository);
if (MapModel.class.equals(type))
@@ -310,10 +312,10 @@ private Type getTypeForWildcardType(RequestMethod requestMethod, DataRestReposit
/**
* Gets type.
*
- * @param requestMethod the request method
+ * @param requestMethod the request method
* @param dataRestRepository the data rest repository
* @param returnedEntityType the returned entity type
- * @param parameterizedType the parameterized type
+ * @param parameterizedType the parameterized type
* @return the type
*/
private Type getTypeForParameterizedType(RequestMethod requestMethod, DataRestRepository dataRestRepository, Class returnedEntityType, ParameterizedType parameterizedType) {
@@ -335,7 +337,7 @@ else if (EntityModel.class.equals(parameterizedType1.getRawType())) {
/**
* Find type class.
*
- * @param requestMethod the request method
+ * @param requestMethod the request method
* @param dataRestRepository the data rest repository
* @return the class
*/
@@ -358,8 +360,8 @@ else if (dataRestRepository.isMap())
/**
* Resolve generic type type.
*
- * @param container the container
- * @param generic the generic
+ * @param container the container
+ * @param generic the generic
* @param domainType the domain type
* @return the type
*/
@@ -372,7 +374,7 @@ private Type resolveGenericType(Class> container, Class> generic, Class> d
* Add response 200.
*
* @param apiResponses the api responses
- * @param apiResponse the api response
+ * @param apiResponse the api response
*/
private void addResponse200(ApiResponses apiResponses, ApiResponse apiResponse) {
apiResponses.put(String.valueOf(HttpStatus.OK.value()), apiResponse.description(HttpStatus.OK.getReasonPhrase()));
@@ -398,6 +400,7 @@ private void addResponse404(ApiResponses apiResponses) {
/**
* The type Map model.
+ *
* @author bnasslashen
*/
private static class MapModel extends RepresentationModel {
@@ -410,7 +413,7 @@ private static class MapModel extends RepresentationModel {
* Instantiates a new Map model.
*
* @param content the content
- * @param links the links
+ * @param links the links
*/
public MapModel(Map content, Link... links) {
super(Arrays.asList(links));
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRouterOperationService.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRouterOperationService.java
index 917a66d99..85cd00e74 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRouterOperationService.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestRouterOperationService.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.data;
@@ -59,6 +61,7 @@
/**
* The type Data rest router operation builder.
+ *
* @author bnasslahsen
*/
public class DataRestRouterOperationService {
@@ -96,10 +99,10 @@ public class DataRestRouterOperationService {
/**
* Instantiates a new Data rest router operation builder.
*
- * @param dataRestOperationService the data rest operation builder
- * @param springDocConfigProperties the spring doc config properties
+ * @param dataRestOperationService the data rest operation builder
+ * @param springDocConfigProperties the spring doc config properties
* @param repositoryRestConfiguration the repository rest configuration
- * @param dataRestHalProvider the data rest hal provider
+ * @param dataRestHalProvider the data rest hal provider
*/
public DataRestRouterOperationService(DataRestOperationService dataRestOperationService, SpringDocConfigProperties springDocConfigProperties,
RepositoryRestConfiguration repositoryRestConfiguration, DataRestHalProvider dataRestHalProvider) {
@@ -113,10 +116,10 @@ public DataRestRouterOperationService(DataRestOperationService dataRestOperation
* Build entity router operation list.
*
* @param routerOperationList the router operation list
- * @param handlerMethodMap the handler method map
- * @param resourceMetadata the resource metadata
- * @param dataRestRepository the repository data rest
- * @param openAPI the open api
+ * @param handlerMethodMap the handler method map
+ * @param resourceMetadata the resource metadata
+ * @param dataRestRepository the repository data rest
+ * @param openAPI the open api
*/
public void buildEntityRouterOperationList(List routerOperationList,
Map handlerMethodMap, ResourceMetadata resourceMetadata,
@@ -131,11 +134,11 @@ public void buildEntityRouterOperationList(List routerOperation
/**
* Build search router operation list.
*
- * @param routerOperationList the router operation list
- * @param handlerMethodMap the handler method map
- * @param resourceMetadata the resource metadata
- * @param dataRestRepository the repository data rest
- * @param openAPI the open api
+ * @param routerOperationList the router operation list
+ * @param handlerMethodMap the handler method map
+ * @param resourceMetadata the resource metadata
+ * @param dataRestRepository the repository data rest
+ * @param openAPI the open api
* @param methodResourceMapping the method resource mapping
*/
public void buildSearchRouterOperationList(List routerOperationList,
@@ -153,14 +156,14 @@ public void buildSearchRouterOperationList(List routerOperation
/**
* Build router operation list.
*
- * @param routerOperationList the router operation list
- * @param resourceMetadata the resource metadata
- * @param dataRestRepository the repository data rest
- * @param openAPI the open api
- * @param path the path
- * @param entry the entry
- * @param subPath the sub path
- * @param controllerType the controllerType
+ * @param routerOperationList the router operation list
+ * @param resourceMetadata the resource metadata
+ * @param dataRestRepository the repository data rest
+ * @param openAPI the open api
+ * @param path the path
+ * @param entry the entry
+ * @param subPath the sub path
+ * @param controllerType the controllerType
* @param methodResourceMapping the method resource mapping
*/
private void buildRouterOperationList(List routerOperationList, ResourceMetadata resourceMetadata,
@@ -200,18 +203,18 @@ private void buildRouterOperationList(List routerOperationList,
/**
* Build router operation.
*
- * @param routerOperationList the router operation list
- * @param resourceMetadata the resource metadata
- * @param dataRestRepository the data rest repository
- * @param openAPI the open api
- * @param path the path
- * @param subPath the sub path
- * @param controllerType the controller type
- * @param methodResourceMapping the method resource mapping
- * @param requestMappingInfo the request mapping info
- * @param handlerMethod the handler method
+ * @param routerOperationList the router operation list
+ * @param resourceMetadata the resource metadata
+ * @param dataRestRepository the data rest repository
+ * @param openAPI the open api
+ * @param path the path
+ * @param subPath the sub path
+ * @param controllerType the controller type
+ * @param methodResourceMapping the method resource mapping
+ * @param requestMappingInfo the request mapping info
+ * @param handlerMethod the handler method
* @param requestMethodsCollection the request methods collection
- * @param collection the collection
+ * @param collection the collection
*/
private void buildRouterOperation(List routerOperationList, ResourceMetadata resourceMetadata, DataRestRepository dataRestRepository,
OpenAPI openAPI, String path, String subPath, ControllerType controllerType, MethodResourceMapping methodResourceMapping, RequestMappingInfo requestMappingInfo,
@@ -235,13 +238,13 @@ private void buildRouterOperation(List routerOperationList, Res
/**
* Calculate operation path string.
*
- * @param path the path
- * @param subPath the sub path
- * @param patterns the patterns
- * @param regexMap the regex map
+ * @param path the path
+ * @param subPath the sub path
+ * @param patterns the patterns
+ * @param regexMap the regex map
* @param controllerType the controller type
- * @param relationName the relation name
- * @param resourceType the resource type
+ * @param relationName the relation name
+ * @param resourceType the resource type
* @return the string
*/
private String calculateOperationPath(String path, String subPath, Set patterns,
@@ -265,15 +268,15 @@ else if (ControllerType.PROPERTY.equals(controllerType))
/**
* Build router operation.
*
- * @param routerOperationList the router operation list
- * @param dataRestRepository the repository data rest
- * @param openAPI the open api
+ * @param routerOperationList the router operation list
+ * @param dataRestRepository the repository data rest
+ * @param openAPI the open api
* @param methodResourceMapping the method resource mapping
- * @param handlerMethod the handler method
- * @param requestMethod the request method
- * @param resourceMetadata the resource metadata
- * @param operationPath the operation path
- * @param controllerType the controller type
+ * @param handlerMethod the handler method
+ * @param requestMethod the request method
+ * @param resourceMetadata the resource metadata
+ * @param operationPath the operation path
+ * @param controllerType the controller type
*/
private void buildRouterOperation
(List routerOperationList, DataRestRepository
@@ -297,7 +300,7 @@ else if (ControllerType.PROPERTY.equals(controllerType))
* Gets search entry.
*
* @param handlerMethodMap the handler method map
- * @param locale the locale
+ * @param locale the locale
* @return the search entry
*/
private Optional> getSearchEntry
@@ -319,9 +322,9 @@ else if (ControllerType.PROPERTY.equals(controllerType))
* Is search controller present boolean.
*
* @param requestMappingInfo the request mapping info
- * @param handlerMethod the handler method
- * @param requestMethod the request method
- * @param locale the locale
+ * @param handlerMethod the handler method
+ * @param requestMethod the request method
+ * @param locale the locale
* @return the boolean
*/
private boolean isSearchControllerPresent(RequestMappingInfo requestMappingInfo, HandlerMethod handlerMethod, RequestMethod requestMethod, Locale locale) {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestTagsService.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestTagsService.java
index d8c53e613..f6e1797fc 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestTagsService.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestTagsService.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.data;
@@ -41,6 +43,7 @@
/**
* The type Data rest tags builder.
+ *
* @author bnasslahsen
*/
public class DataRestTagsService {
@@ -62,10 +65,10 @@ public DataRestTagsService(OpenAPIService openAPIService) {
/**
* Build search tags.
*
- * @param operation the operation
- * @param handlerMethod the handler method
+ * @param operation the operation
+ * @param handlerMethod the handler method
* @param dataRestRepository the repository data rest
- * @param method the method
+ * @param method the method
*/
public void buildSearchTags(Operation operation, HandlerMethod handlerMethod,
DataRestRepository dataRestRepository, Method method) {
@@ -75,8 +78,8 @@ public void buildSearchTags(Operation operation, HandlerMethod handlerMethod,
/**
* Build entity tags.
*
- * @param operation the operation
- * @param handlerMethod the handler method
+ * @param operation the operation
+ * @param handlerMethod the handler method
* @param dataRestRepository the repository data rest
*/
public void buildEntityTags(Operation operation, HandlerMethod handlerMethod,
@@ -86,10 +89,11 @@ public void buildEntityTags(Operation operation, HandlerMethod handlerMethod,
/**
* Build tags.
- * @param operation the operation
- * @param handlerMethod the handler method
+ *
+ * @param operation the operation
+ * @param handlerMethod the handler method
* @param dataRestRepository the repository data rest
- * @param method
+ * @param method the method
*/
private void buildTags(Operation operation, HandlerMethod handlerMethod,
DataRestRepository dataRestRepository, Method method) {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/discoverer/SpringDocParameterNameDiscoverer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/discoverer/SpringDocParameterNameDiscoverer.java
index db57f082f..10344c6d9 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/discoverer/SpringDocParameterNameDiscoverer.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/discoverer/SpringDocParameterNameDiscoverer.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * Copyright 2019-2023 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.discoverer;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/extractor/DelegatingMethodParameter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/extractor/DelegatingMethodParameter.java
index d3320398e..e704d51a4 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/extractor/DelegatingMethodParameter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/extractor/DelegatingMethodParameter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * Copyright 2019-2023 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.extractor;
@@ -56,6 +58,7 @@
/**
* The type Delegating method parameter.
+ *
* @author zarebski.m
*/
public class DelegatingMethodParameter extends MethodParameter {
@@ -85,6 +88,11 @@ public class DelegatingMethodParameter extends MethodParameter {
*/
private final boolean isParameterObject;
+ /**
+ * The Method annotations.
+ */
+ private final Annotation[] methodAnnotations;
+
/**
* The Is not required.
*/
@@ -93,32 +101,34 @@ public class DelegatingMethodParameter extends MethodParameter {
/**
* Instantiates a new Delegating method parameter.
*
- * @param delegate the delegate
- * @param parameterName the parameter name
+ * @param delegate the delegate
+ * @param parameterName the parameter name
* @param additionalParameterAnnotations the additional parameter annotations
- * @param isParameterObject the is parameter object
- * @param isNotRequired the is required
+ * @param methodAnnotations the method annotations
+ * @param isParameterObject the is parameter object
+ * @param isNotRequired the is required
*/
- DelegatingMethodParameter(MethodParameter delegate, String parameterName, Annotation[] additionalParameterAnnotations, boolean isParameterObject, boolean isNotRequired) {
+ DelegatingMethodParameter(MethodParameter delegate, String parameterName, Annotation[] additionalParameterAnnotations, Annotation[] methodAnnotations, boolean isParameterObject, boolean isNotRequired) {
super(delegate);
this.delegate = delegate;
this.additionalParameterAnnotations = additionalParameterAnnotations;
this.parameterName = parameterName;
this.isParameterObject = isParameterObject;
this.isNotRequired = isNotRequired;
+ this.methodAnnotations =methodAnnotations;
}
/**
* Customize method parameter [ ].
*
- * @param pNames the p names
- * @param parameters the parameters
- * @param optionalDelegatingMethodParameterCustomizer the optional delegating method parameter customizer
- * @param defaultFlatParamObject the default flat param object
+ * @param pNames the p names
+ * @param parameters the parameters
+ * @param optionalDelegatingMethodParameterCustomizers the optional list delegating method parameter customizer
+ * @param defaultFlatParamObject the default flat param object
* @return the method parameter [ ]
*/
public static MethodParameter[] customize(String[] pNames, MethodParameter[] parameters,
- Optional optionalDelegatingMethodParameterCustomizer, boolean defaultFlatParamObject) {
+ Optional> optionalDelegatingMethodParameterCustomizers, boolean defaultFlatParamObject) {
List explodedParameters = new ArrayList<>();
for (int i = 0; i < parameters.length; ++i) {
MethodParameter p = parameters[i];
@@ -130,13 +140,13 @@ public static MethodParameter[] customize(String[] pNames, MethodParameter[] par
if (!MethodParameterPojoExtractor.isSimpleType(paramClass)
&& (hasFlatAnnotation || (defaultFlatParamObject && !hasNotFlatAnnotation && !AbstractRequestService.isRequestTypeToIgnore(paramClass)))) {
MethodParameterPojoExtractor.extractFrom(paramClass).forEach(methodParameter -> {
- optionalDelegatingMethodParameterCustomizer.ifPresent(customizer -> customizer.customize(p, methodParameter));
+ optionalDelegatingMethodParameterCustomizers.ifPresent(delegatingMethodParameterCustomizers -> delegatingMethodParameterCustomizers.forEach(customizer -> customizer.customize(p, methodParameter)));
explodedParameters.add(methodParameter);
});
}
else {
String name = pNames != null ? pNames[i] : p.getParameterName();
- explodedParameters.add(new DelegatingMethodParameter(p, name, null, false, false));
+ explodedParameters.add(new DelegatingMethodParameter(p, name, null, null, false, false));
}
}
return explodedParameters.toArray(new MethodParameter[0]);
@@ -145,10 +155,11 @@ public static MethodParameter[] customize(String[] pNames, MethodParameter[] par
/**
* Return a variant of this {@code MethodParameter} which refers to the
* given containing class.
+ *
* @param methodParameter the method parameter
* @param containingClass a specific containing class (potentially a subclass of the declaring class, e.g. substituting a type variable) A copy of spring withContainingClass, to keep compatibility with older spring versions
* @return the method parameter
- * @see #getParameterType() #getParameterType()
+ * @see #getParameterType() #getParameterType()#getParameterType()
*/
public static MethodParameter changeContainingClass(MethodParameter methodParameter, @Nullable Class> containingClass) {
MethodParameter result = methodParameter.clone();
@@ -167,7 +178,8 @@ public static MethodParameter changeContainingClass(MethodParameter methodParame
@Override
@NonNull
public Annotation[] getParameterAnnotations() {
- return ArrayUtils.addAll(delegate.getParameterAnnotations(), additionalParameterAnnotations);
+ Annotation[] methodAnnotations = ArrayUtils.addAll(delegate.getParameterAnnotations(), this.methodAnnotations);
+ return ArrayUtils.addAll(methodAnnotations, additionalParameterAnnotations);
}
@Override
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/extractor/MethodParameterPojoExtractor.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/extractor/MethodParameterPojoExtractor.java
index ff8e3f0c1..837c79b29 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/extractor/MethodParameterPojoExtractor.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/extractor/MethodParameterPojoExtractor.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.extractor;
@@ -52,14 +54,15 @@
import io.swagger.v3.core.util.PrimitiveType;
import io.swagger.v3.oas.annotations.Parameter;
-import org.springdoc.core.parsers.ReturnTypeParser;
+import org.springframework.core.GenericTypeResolver;
import org.springframework.core.MethodParameter;
import static org.springdoc.core.utils.Constants.DOT;
/**
* The type Method parameter pojo extractor.
+ *
* @author bnasslahsen
*/
public class MethodParameterPojoExtractor {
@@ -88,6 +91,7 @@ public class MethodParameterPojoExtractor {
SIMPLE_TYPES.add(Iterable.class);
SIMPLE_TYPES.add(Duration.class);
SIMPLE_TYPES.add(LocalTime.class);
+ SIMPLE_TYPES.add(Class.class);
SIMPLE_TYPE_PREDICATES.add(Class::isPrimitive);
SIMPLE_TYPE_PREDICATES.add(Class::isEnum);
@@ -115,7 +119,7 @@ static Stream extractFrom(Class> clazz) {
/**
* Extract from stream.
*
- * @param clazz the clazz
+ * @param clazz the clazz
* @param fieldNamePrefix the field name prefix
* @return the stream
*/
@@ -129,8 +133,8 @@ private static Stream extractFrom(Class> clazz, String fieldN
/**
* From getter of field stream.
*
- * @param paramClass the param class
- * @param field the field
+ * @param paramClass the param class
+ * @param field the field
* @param fieldNamePrefix the field name prefix
* @return the stream
*/
@@ -150,14 +154,15 @@ private static Stream fromGetterOfField(Class> paramClass, Fi
/**
* Extract the type
- * @param paramClass
- * @param field
+ *
+ * @param paramClass the param class
+ * @param field the field
* @return The revoled type or null if it was not a reifiable type
*/
private static Class> extractType(Class> paramClass, Field field) {
Class> type = field.getType();
if (field.getGenericType() instanceof TypeVariable>) {
- Type fieldType = ReturnTypeParser.resolveType(field.getGenericType(), paramClass);
+ Type fieldType = GenericTypeResolver.resolveType(field.getGenericType(), paramClass);
if (fieldType instanceof Class>)
type = (Class>) fieldType;
@@ -171,8 +176,8 @@ private static Class> extractType(Class> paramClass, Field field) {
/**
* From simple class stream.
*
- * @param paramClass the param class
- * @param field the field
+ * @param paramClass the param class
+ * @param field the field
* @param fieldNamePrefix the field name prefix
* @return the stream
*/
@@ -187,7 +192,7 @@ private static Stream fromSimpleClass(Class> paramClass, Fiel
.map(RecordComponent::getAccessor)
.map(method -> new MethodParameter(method, -1))
.map(methodParameter -> DelegatingMethodParameter.changeContainingClass(methodParameter, paramClass))
- .map(param -> new DelegatingMethodParameter(param, fieldNamePrefix + field.getName(), fieldAnnotations, true, isNotRequired));
+ .map(param -> new DelegatingMethodParameter(param, fieldNamePrefix + field.getName(), fieldAnnotations, param.getMethodAnnotations(), true, isNotRequired));
}
else
@@ -197,7 +202,7 @@ private static Stream fromSimpleClass(Class> paramClass, Fiel
.filter(Objects::nonNull)
.map(method -> new MethodParameter(method, -1))
.map(methodParameter -> DelegatingMethodParameter.changeContainingClass(methodParameter, paramClass))
- .map(param -> new DelegatingMethodParameter(param, fieldNamePrefix + field.getName(), fieldAnnotations, true, isNotRequired));
+ .map(param -> new DelegatingMethodParameter(param, fieldNamePrefix + field.getName(), fieldAnnotations, param.getMethodAnnotations(), true, isNotRequired));
}
catch (IntrospectionException e) {
return Stream.of();
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/filters/GlobalOpenApiMethodFilter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/filters/GlobalOpenApiMethodFilter.java
index d170a768b..df86a27de 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/filters/GlobalOpenApiMethodFilter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/filters/GlobalOpenApiMethodFilter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.filters;
@@ -30,7 +32,7 @@
* and groups.
*
* @author michael.clarke
- * @see OpenApiMethodFilter filter methods in default OpenAPI description but not groups
+ * @see OpenApiMethodFilter methods in default OpenAPI description but not groups
*/
@FunctionalInterface
public interface GlobalOpenApiMethodFilter extends OpenApiMethodFilter {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/filters/OpenApiMethodFilter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/filters/OpenApiMethodFilter.java
index c5fe4563d..edbccd7de 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/filters/OpenApiMethodFilter.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/filters/OpenApiMethodFilter.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.filters;
@@ -32,7 +34,7 @@
* but not groups
*
* @author michael.clarke
- * @see GlobalOpenApiMethodFilter filter methods in default OpenAPI description and groups
+ * @see GlobalOpenApiMethodFilter methods in default OpenAPI description and groups
*/
@FunctionalInterface
public interface OpenApiMethodFilter {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/AbstractRouterFunctionVisitor.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/AbstractRouterFunctionVisitor.java
index 8bd7cbe00..5f10fc44b 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/AbstractRouterFunctionVisitor.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/AbstractRouterFunctionVisitor.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn;
@@ -39,6 +41,7 @@
/**
* The type Abstract router function visitor.
+ *
* @author bnasslahsen
*/
public class AbstractRouterFunctionVisitor {
@@ -141,7 +144,7 @@ else if (this.level > 0) {
/**
* Header.
*
- * @param name the name
+ * @param name the name
* @param value the value
*/
public void header(String name, String value) {
@@ -165,7 +168,7 @@ public List getRouterFunctionDatas() {
/**
* Query param.
*
- * @param name the name
+ * @param name the name
* @param value the value
*/
public void queryParam(String name, String value) {
@@ -187,7 +190,7 @@ public void pathExtension(String extension) {
/**
* Param.
*
- * @param name the name
+ * @param name the name
* @param value the value
*/
public void param(String name, String value) {
@@ -287,9 +290,9 @@ protected void commonRoute() {
/**
* Calculate header.
*
- * @param value the value
+ * @param value the value
* @param headers the headers
- * @param header the header
+ * @param header the header
*/
private void calculateHeader(String value, List headers, String header) {
if (value.contains(",")) {
@@ -326,8 +329,8 @@ private void createRouterFunctionData(String path) {
/**
* Add header.
*
- * @param mediaType the media type
- * @param header the header
+ * @param mediaType the media type
+ * @param header the header
* @param routerFunctionData the router function data
*/
private void addHeader(String mediaType, String header, RouterFunctionData routerFunctionData) {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/AbstractSpringdocRouteBuilder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/AbstractSpringdocRouteBuilder.java
index 1741bd194..a19283c2a 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/AbstractSpringdocRouteBuilder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/AbstractSpringdocRouteBuilder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn;
@@ -30,6 +32,7 @@
/**
* The type Abstract springdoc route builder.
+ *
* @author bnasslahsen
*/
public abstract class AbstractSpringdocRouteBuilder {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/RouterFunctionData.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/RouterFunctionData.java
index 1cca044de..fb9e03425 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/RouterFunctionData.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/RouterFunctionData.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn;
@@ -40,6 +42,7 @@
/**
* The type Router function data.
+ *
* @author bnasslahsen
*/
public class RouterFunctionData {
@@ -138,7 +141,7 @@ public Map getQueryParams() {
/**
* Add query params.
*
- * @param name the name
+ * @param name the name
* @param value the value
*/
public void addQueryParams(String name, String value) {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/RouterOperation.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/RouterOperation.java
index 8540fb5f9..0d70c08ee 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/RouterOperation.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/RouterOperation.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn;
@@ -40,6 +42,7 @@
/**
* The type Router operation.
+ *
* @author bnasslahsen
*/
public class RouterOperation implements Comparable {
@@ -132,7 +135,7 @@ public RouterOperation(org.springdoc.core.annotations.RouterOperation routerOper
* Instantiates a new Router operation.
*
* @param routerOperationAnnotation the router operation annotation
- * @param routerFunctionData the router function data
+ * @param routerFunctionData the router function data
*/
public RouterOperation(org.springdoc.core.annotations.RouterOperation routerOperationAnnotation, RouterFunctionData routerFunctionData) {
this.path = StringUtils.isBlank(routerOperationAnnotation.path()) ? routerFunctionData.getPath() : routerOperationAnnotation.path();
@@ -151,11 +154,12 @@ public RouterOperation(org.springdoc.core.annotations.RouterOperation routerOper
/**
* Instantiates a new Router operation.
*
- * @param path the path
- * @param methods the methods
+ * @param path the path
+ * @param methods the methods
* @param consumes the consumes
* @param produces the produces
- * @param headers the headers
+ * @param headers the headers
+ * @param params the params
*/
public RouterOperation(String path, RequestMethod[] methods, String[] consumes, String[] produces, String[] headers, String[] params) {
this.path = path;
@@ -195,7 +199,7 @@ public RouterOperation(RouterFunctionData routerFunctionData) {
* Instantiates a new Router operation.
*
* @param routerOperation the router operation
- * @param requestMethod the request method
+ * @param requestMethod the request method
*/
public RouterOperation(org.springdoc.core.annotations.RouterOperation routerOperation, RequestMethod requestMethod) {
this(routerOperation);
@@ -394,7 +398,7 @@ public String[] getParams() {
/**
* Sets params.
*
- * @param params
+ * @param params the params
*/
public void setParams(String[] params) {
this.params = params;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/apiresponse/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/apiresponse/Builder.java
index 915ae1124..7a8c8f8c4 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/apiresponse/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/apiresponse/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.apiresponse;
@@ -35,6 +37,7 @@
/**
* The type Api response builder.
+ *
* @author bnasslahsen
*/
public class Builder {
@@ -46,37 +49,31 @@ public class Builder {
/**
* A short description of the response.
- *
*/
private String description = "";
/**
* The HTTP response code, or 'default', for the supplied response. May only have 1 default entry.
- *
*/
private String responseCode = "default";
/**
* An array of response headers. Allows additional information to be included with response.
- *
*/
private Header[] headers = {};
/**
* An array of operation links that can be followed from the response.
- *
*/
private Link[] links = {};
/**
* An array containing descriptions of potential response payloads, for different media types.
- *
*/
private Content[] content = {};
/**
* The list of optional extensions
- *
*/
private Extension[] extensions = {};
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/arrayschema/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/arrayschema/Builder.java
index d6d8882f7..278b276d4 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/arrayschema/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/arrayschema/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.arrayschema;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/content/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/content/Builder.java
index 827fbe58c..92ac322a1 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/content/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/content/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.content;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/discriminatormapping/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/discriminatormapping/Builder.java
index 93ee0b3fc..0944436e1 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/discriminatormapping/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/discriminatormapping/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.discriminatormapping;
@@ -31,19 +33,18 @@
/**
* The type Discriminator mapping builder.
+ *
* @author bnasslahsen
*/
public class Builder {
/**
* The property value that will be mapped to a Schema
- *
*/
private String value = "";
/**
* The schema that is being mapped to a property value
- *
*/
private Class> schema = Void.class;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/encoding/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/encoding/Builder.java
index b9983b635..04f94375f 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/encoding/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/encoding/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.encoding;
@@ -33,6 +35,7 @@
/**
* The type Encoding builder.
+ *
* @author bnasslahsen
*/
public class Builder {
@@ -41,45 +44,38 @@ public class Builder {
* The name of this encoding object instance.
* This property is a key in encoding map of MediaType object and
* MUST exist in a schema as a property.
- *
*/
private String name = "";
/**
* The Content-Type for encoding a specific property.
- *
*/
private String contentType = "";
/**
* Describes how a specific property value will be serialized depending on its type
- *
*/
private String style = "";
/**
* When this is true, property values of type array or object generate separate parameters for each value of the array,
* or key-value-pair of the map.
- *
*/
private boolean explode;
/**
* Determines whether the parameter value SHOULD allow reserved characters,
* as defined by RFC3986 to be included without percent-encoding.
- *
*/
private boolean allowReserved;
/**
* An array of header objects
- *
*/
private Header[] headers = {};
/**
* The list of optional extensions
- *
*/
private Extension[] extensions = {};
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/exampleobject/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/exampleobject/Builder.java
index 97b6e86a7..3d41d0cda 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/exampleobject/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/exampleobject/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.exampleobject;
@@ -32,6 +34,7 @@
/**
* The type Example object builder.
+ *
* @author bnasslahsen
*/
public class Builder {
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/extension/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/extension/Builder.java
index bcfbfa188..be3bd437d 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/extension/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/extension/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.extension;
@@ -32,19 +34,18 @@
/**
* The type Extension builder.
+ *
* @author bnasslahsen
*/
public class Builder {
/**
* An option name for these extensions.
- *
*/
private String name = "";
/**
* The extension properties.
- *
*/
private ExtensionProperty[] properties;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/extensionproperty/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/extensionproperty/Builder.java
index 292472741..28365ceb9 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/extensionproperty/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/extensionproperty/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.extensionproperty;
@@ -30,25 +32,23 @@
/**
* The type Extension property builder.
+ *
* @author bnasslahsen
*/
public class Builder {
/**
* The name of the property.
- *
*/
private String name;
/**
* The value of the property.
- *
*/
private String value;
/**
* If set to true, field `value` will be parsed and serialized as JSON/YAML
- *
*/
private boolean parseValue;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/externaldocumentation/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/externaldocumentation/Builder.java
index 92d54bb1e..96aa0d096 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/externaldocumentation/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/externaldocumentation/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.externaldocumentation;
@@ -32,25 +34,23 @@
/**
* The type External documentation builder.
+ *
* @author bnasslahsen
*/
public class Builder {
/**
* A short description of the target documentation.
- *
*/
private String description = "";
/**
* The URL for the target documentation. Value must be in the format of a URL.
- *
*/
private String url = "";
/**
* The list of optional extensions
- *
*/
private Extension[] extensions = {};
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/header/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/header/Builder.java
index b48504be1..86950dcd7 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/header/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/header/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.header;
@@ -220,7 +222,7 @@ public Builder examples(ExampleObject[] val) {
examples = val;
return this;
}
-
+
/**
* Build header.
*
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/link/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/link/Builder.java
index afaf2ebec..dc2d9d3ae 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/link/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/link/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.link;
@@ -34,54 +36,47 @@
/**
* The type Link builder.
+ *
* @author bnasslahsen
*/
public class Builder {
/**
* The name of this link.
- *
*/
private String name = "";
/**
* A relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and must point to an Operation Object. Relative operationRef values may be used to locate an existing Operation Object in the OpenAPI definition. Ignored if the operationId property is specified.
- *
*/
private String operationRef = "";
/**
* The name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
- *
*/
private String operationId = "";
/**
* Array of parameters to pass to an operation as specified with operationId or identified via operationRef.
- *
*/
private LinkParameter[] parameters = {};
/**
* A description of the link. CommonMark syntax may be used for rich text representation.
- *
*/
private String description = "";
/**
* A literal value or {expression} to use as a request body when calling the target operation.
- *
*/
private String requestBody = "";
/**
* An alternative server to service this operation.
- *
*/
private Server server = org.springdoc.core.fn.builders.server.Builder.serverBuilder().build();
/**
* The list of optional extensions
- *
*/
private Extension[] extensions = {};
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/linkparameter/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/linkparameter/Builder.java
index aa33b92b8..c59fdb181 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/linkparameter/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/linkparameter/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.linkparameter;
@@ -30,18 +32,17 @@
/**
* The type Link parameter builder.
+ *
* @author bnasslahsen
*/
public class Builder {
/**
* The name of this link parameter.
- *
*/
private String name = "";
/**
* A constant or an expression to be evaluated and passed to the linked operation.
- *
*/
private String expression = "";
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/operation/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/operation/Builder.java
index 795b3ca70..d17b65d74 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/operation/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/operation/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.operation;
@@ -40,6 +42,7 @@
/**
* The type Operation builder.
+ *
* @author bnasslahsen
*/
public class Builder {
@@ -62,91 +65,76 @@ public class Builder {
/**
* The HTTP method for this operation.
- *
*/
private String method = "";
/**
* Tags can be used for logical grouping of operations by resources or any other qualifier.
- *
*/
private String[] tags = {};
/**
* Provides a brief description of this operation. Should be 120 characters or less for proper visibility in Swagger-UI.
- *
*/
private String summary = "";
/**
* A verbose description of the operation.
- *
*/
private String description = "";
/**
* Request body associated to the operation.
- *
*/
private RequestBody requestBody = org.springdoc.core.fn.builders.requestbody.Builder.requestBodyBuilder().build();
/**
* Additional external documentation for this operation.
- *
*/
private ExternalDocumentation externalDocs = org.springdoc.core.fn.builders.externaldocumentation.Builder.externalDocumentationBuilder().build();
/**
* The operationId is used by third-party tools to uniquely identify this operation.
- *
*/
private String operationId = "";
/**
* An optional array of parameters which will be added to any automatically detected parameters in the method itself.
- *
*/
private Parameter[] parameters = {};
/**
* The list of possible responses as they are returned from executing this operation.
- *
*/
private ApiResponse[] responses = {};
/**
* Allows an operation to be marked as deprecated. Alternatively use the @Deprecated annotation
- *
*/
private boolean deprecated;
/**
* A declaration of which security mechanisms can be used for this operation.
- *
*/
private SecurityRequirement[] security = {};
/**
* An alternative server array to service this operation.
- *
*/
private Server[] servers = {};
/**
* The list of optional extensions
- *
*/
private Extension[] extensions = {};
/**
* Allows this operation to be marked as hidden
- *
*/
private boolean hidden;
/**
* Ignores JsonView annotations while resolving operations and types.
- *
*/
private boolean ignoreJsonView;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/parameter/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/parameter/Builder.java
index 93b5ab27a..780e28d6f 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/parameter/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/parameter/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.parameter;
@@ -39,102 +41,87 @@
/**
* The type Parameter builder.
+ *
* @author bnasslahsen
*/
public class Builder {
/**
* The name of the parameter.
- *
*/
private String name = "";
/**
* The location of the parameter. Possible values are "query", "header", "path" or "cookie". Ignored when empty string.
- *
*/
private ParameterIn in = ParameterIn.DEFAULT;
/**
* Additional description data to provide on the purpose of the parameter
- *
*/
private String description = "";
/**
* Determines whether this parameter is mandatory. If the parameter location is "path", this property is required and its value must be true. Otherwise, the property may be included and its default value is false.
- *
*/
private boolean required;
/**
* Specifies that a parameter is deprecated and should be transitioned out of usage.
- *
*/
private boolean deprecated;
/**
* When true, allows sending an empty value. If false, the parameter will be considered \"null\" if no value is present. This may create validation errors when the parameter is required.
- *
*/
private boolean allowEmptyValue;
/**
* Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form. Ignored if the properties content or array are specified.
- *
*/
private ParameterStyle style = ParameterStyle.DEFAULT;
/**
* When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. Ignored if the properties content or array are specified.
- *
*/
private Explode explode = Explode.DEFAULT;
/**
* Determines whether the parameter value should allow reserved characters, as defined by RFC3986. This property only applies to parameters with an in value of query. The default value is false. Ignored if the properties content or array are specified.
- *
*/
private boolean allowReserved;
/**
* The schema defining the type used for the parameter. Ignored if the properties content or array are specified.
- *
*/
private Schema schema = org.springdoc.core.fn.builders.schema.Builder.schemaBuilder().build();
/**
* The schema of the array that defines this parameter. Ignored if the property content is specified.
- *
*/
private ArraySchema array = org.springdoc.core.fn.builders.arrayschema.Builder.arraySchemaBuilder().build();
/**
* The representation of this parameter, for different media types.
- *
*/
private Content[] content = {};
/**
* Allows this parameter to be marked as hidden
- *
*/
private boolean hidden;
/**
* An array of examples of the schema used to show the use of the associated schema.
- *
*/
private ExampleObject[] examples = {};
/**
* Provides an example of the schema. When associated with a specific media type, the example string shall be parsed by the consumer to be treated as an object or an array. Ignored if the properties examples, content or array are specified.
- *
*/
private String example = "";
/**
* The list of optional extensions
- *
*/
private Extension[] extensions = {};
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/requestbody/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/requestbody/Builder.java
index 6c0bb9b8f..1dad234d3 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/requestbody/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/requestbody/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.requestbody;
@@ -33,31 +35,28 @@
/**
* The type Request body builder.
+ *
* @author bnasslahsen
*/
public class Builder {
/**
* A brief description of the request body.
- *
*/
private String description = "";
/**
* The content of the request body.
- *
*/
private Content[] content = {};
/**
* Determines if the request body is required in the request. Defaults to false.
- *
*/
private boolean required;
/**
* The list of optional extensions
- *
*/
private Extension[] extensions = {};
@@ -68,6 +67,9 @@ public class Builder {
*/
private String ref = "";
+ /**
+ * The Use parameter type schema.
+ */
private boolean useParameterTypeSchema = false;
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/schema/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/schema/Builder.java
index 6746a69a1..a326d22b5 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/schema/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/schema/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.schema;
@@ -35,6 +37,7 @@
import io.swagger.v3.oas.annotations.media.Schema.AccessMode;
import io.swagger.v3.oas.annotations.media.Schema.AdditionalPropertiesValue;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
+import io.swagger.v3.oas.annotations.media.Schema.SchemaResolution;
import org.apache.commons.lang3.ArrayUtils;
/**
@@ -228,6 +231,11 @@ public class Builder {
*/
private Extension[] extensions = {};
+ /**
+ * The Schema resolution.
+ */
+ private SchemaResolution schemaResolution;
+
/**
* Allows to specify the additionalProperties value
* AdditionalPropertiesValue.TRUE: set to TRUE
@@ -818,6 +826,17 @@ public Builder requiredMode(RequiredMode requiredMode) {
return this;
}
+ /**
+ * Schema resolution builder.
+ *
+ * @param schemaResolution the schema resolution
+ * @return the builder
+ */
+ public Builder schemaResolution(SchemaResolution schemaResolution) {
+ this.schemaResolution = schemaResolution;
+ return this;
+ }
+
/**
* Additional properties builder.
*
@@ -1195,6 +1214,11 @@ public String[] examples() {
public String _const() {
return _const;
}
+
+ @Override
+ public SchemaResolution schemaResolution() {
+ return schemaResolution;
+ }
};
}
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/securityrequirement/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/securityrequirement/Builder.java
index fb977cce0..823f49b88 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/securityrequirement/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/securityrequirement/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.securityrequirement;
@@ -30,19 +32,18 @@
/**
* The type Security requirement builder.
+ *
* @author bnasslahsen
*/
public class Builder {
/**
* This name must correspond to a declared SecurityRequirement.
- *
*/
private String name;
/**
* If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution.
* For other security scheme types, the array must be empty.
- *
*/
private String[] scopes = {};
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/server/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/server/Builder.java
index 662adb9dd..ae981c420 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/server/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/server/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.server;
@@ -33,6 +35,7 @@
/**
* The type Server builder.
+ *
* @author bnasslahsen
*/
public class Builder {
@@ -40,25 +43,21 @@ public class Builder {
* Required. A URL to the target host.
* This URL supports Server Variables and may be relative, to indicate that the host location is relative to the location where the
* OpenAPI definition is being served. Variable substitutions will be made when a variable is named in {brackets}.
- *
*/
private String url = "";
/**
* An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
- *
*/
private String description = "";
/**
* An array of variables used for substitution in the server's URL template.
- *
*/
private ServerVariable[] variables = {};
/**
* The list of optional extensions
- *
*/
private Extension[] extensions = {};
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/servervariable/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/servervariable/Builder.java
index df517e6b9..ae54dc2bd 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/servervariable/Builder.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/servervariable/Builder.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.fn.builders.servervariable;
@@ -32,37 +34,32 @@
/**
* The type Server variable builder.
+ *
* @author bnasslahsen
*/
public class Builder {
/**
* Required. The name of this variable.
- *
*/
private String name;
/**
* An array of allowable values for this variable. This field map to the enum property in the OAS schema.
- *
- * @return String array of allowableValues
*/
private String[] allowableValues = {};
/**
* Required. The default value of this variable.
- *
*/
private String defaultValue;
/**
* An optional description for the server variable.
- *
*/
private String description = "";
/**
* The list of optional extensions
- *
*/
private Extension[] extensions = {};
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedOpenAPIMixin.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedOpenAPIMixin.java
index dcd9afd3a..a9e8bd3cf 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedOpenAPIMixin.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedOpenAPIMixin.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.mixins;
@@ -37,6 +39,7 @@
/**
* The interface Sorted open api mixin.
+ *
* @author bnasslashen
*/
@JsonPropertyOrder(value = { "openapi", "info", "externalDocs", "servers", "security", "tags", "paths", "components" }, alphabetic = true)
@@ -55,7 +58,7 @@ public interface SortedOpenAPIMixin {
/**
* Add extension.
*
- * @param name the name
+ * @param name the name
* @param value the value
*/
@JsonAnySetter
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedOpenAPIMixin31.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedOpenAPIMixin31.java
index 77c14fdc8..d1f9392f3 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedOpenAPIMixin31.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedOpenAPIMixin31.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.mixins;
@@ -37,6 +39,7 @@
/**
* The interface Sorted open api mixin 31.
+ *
* @author bnasslashen
*/
@JsonPropertyOrder(value = { "openapi", "info", "externalDocs", "servers", "security", "tags", "paths", "components", "webhooks" }, alphabetic = true)
@@ -55,7 +58,7 @@ public interface SortedOpenAPIMixin31 {
/**
* Add extension.
*
- * @param name the name
+ * @param name the name
* @param value the value
*/
@JsonAnySetter
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedSchemaMixin.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedSchemaMixin.java
index 17113e2ca..38f3aba05 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedSchemaMixin.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedSchemaMixin.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.mixins;
@@ -37,6 +39,7 @@
/**
* The interface Sorted schema mixin.
+ *
* @author bnasslashen
*/
@JsonPropertyOrder(value = { "type", "format" }, alphabetic = true)
@@ -54,7 +57,7 @@ public interface SortedSchemaMixin {
/**
* Add extension.
*
- * @param name the name
+ * @param name the name
* @param value the value
*/
@JsonAnySetter
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedSchemaMixin31.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedSchemaMixin31.java
index f7bb66f28..f7775f55a 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedSchemaMixin31.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/mixins/SortedSchemaMixin31.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.mixins;
@@ -37,6 +39,7 @@
/**
* The interface Sorted schema mixin 31.
+ *
* @author bnasslashen
*/
@JsonPropertyOrder(value = { "type", "format" }, alphabetic = true)
@@ -118,7 +121,7 @@ public interface SortedSchemaMixin31 {
/**
* Add extension.
*
- * @param name the name
+ * @param name the name
* @param value the value
*/
@JsonAnySetter
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/models/ControllerAdviceInfo.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/models/ControllerAdviceInfo.java
index 745775fcd..3008aa98a 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/models/ControllerAdviceInfo.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/models/ControllerAdviceInfo.java
@@ -3,23 +3,25 @@
* *
* * *
* * * *
- * * * * * 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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.models;
@@ -81,10 +83,20 @@ public Map getApiResponseMap() {
return apiResponseMap;
}
+ /**
+ * Gets method advice infos.
+ *
+ * @return the method advice infos
+ */
public List getMethodAdviceInfos() {
return methodAdviceInfos;
}
+ /**
+ * Add method advice infos.
+ *
+ * @param methodAdviceInfo the method advice info
+ */
public void addMethodAdviceInfos(MethodAdviceInfo methodAdviceInfo) {
this.methodAdviceInfos.add(methodAdviceInfo);
}
diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/models/GroupedOpenApi.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/models/GroupedOpenApi.java
index 1727b4479..1fce141de 100644
--- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/models/GroupedOpenApi.java
+++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/models/GroupedOpenApi.java
@@ -3,32 +3,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
+ * * * * * * Copyright 2019-2024 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.
* * * * *
- * * * * * 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 org.springdoc.core.models;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
+import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.springdoc.core.customizers.OpenApiCustomizer;
@@ -43,6 +46,7 @@
/**
* The type Grouped open api.
+ *
* @author bnasslahsen
*/
public class GroupedOpenApi {
@@ -95,22 +99,22 @@ public class GroupedOpenApi {
/**
* The Open api customisers.
*/
- private List openApiCustomizers;
+ private Set openApiCustomizers;
/**
* The Operation customizers.
*/
- private List operationCustomizers;
+ private Set operationCustomizers;
/**
* The Router Operation customizers.
*/
- private List routerOperationCustomizers;
+ private Set routerOperationCustomizers;
/**
* The method filters to use.
*/
- private List openApiMethodFilters;
+ private Set openApiMethodFilters;
/**
* Instantiates a new Grouped open api.
@@ -231,7 +235,7 @@ public List getPathsToExclude() {
*
* @return the open api customisers
*/
- public List getOpenApiCustomizers() {
+ public Set getOpenApiCustomizers() {
return openApiCustomizers;
}
@@ -240,7 +244,7 @@ public List