From b52c2eeb7838ccd6c4ba4ca70aaa77d25882ed1d Mon Sep 17 00:00:00 2001 From: SiBorea Date: Thu, 21 Nov 2024 09:05:50 +0800 Subject: [PATCH 1/8] Add MigrateSpringdocCommon recipe --- build.gradle.kts | 2 + .../resources/META-INF/rewrite/springdoc.yml | 20 +++++ .../springdoc/MigrateSpringdocCommonTest.java | 86 +++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java diff --git a/build.gradle.kts b/build.gradle.kts index f36685ab1..70b690cdc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -149,6 +149,8 @@ dependencies { runtimeOnly("org.openrewrite.recipe:rewrite-testing-frameworks:$rewriteVersion") testRuntimeOnly("ch.qos.logback:logback-classic:1.+") + testRuntimeOnly("org.springdoc:springdoc-openapi-common:1.+") + testRuntimeOnly("io.swagger.core.v3:swagger-models:2.+") testRuntimeOnly(gradleApi()) testImplementation("org.openrewrite.gradle.tooling:model:$rewriteVersion") diff --git a/src/main/resources/META-INF/rewrite/springdoc.yml b/src/main/resources/META-INF/rewrite/springdoc.yml index 5c3e1b524..088c6508e 100644 --- a/src/main/resources/META-INF/rewrite/springdoc.yml +++ b/src/main/resources/META-INF/rewrite/springdoc.yml @@ -27,6 +27,7 @@ tags: recipeList: - org.openrewrite.java.springdoc.SwaggerToSpringDoc - org.openrewrite.java.springdoc.ReplaceSpringFoxDependencies + - org.openrewrite.java.springdoc.MigrateSpringdocCommon --- type: specs.openrewrite.org/v1beta/recipe @@ -151,3 +152,22 @@ recipeList: groupId: org.springdoc artifactId: "*" newVersion: 2.1.x + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.springdoc.MigrateSpringdocCommon +displayName: Migrate from springdoc-openapi-common to springdoc-openapi-starter-common +description: Migrate from springdoc-openapi-common to springdoc-openapi-starter-common. +tags: + - springdoc + - openapi +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.springdoc.core.customizers.OpenApiCustomiser + newFullyQualifiedTypeName: org.springdoc.core.customizers.OpenApiCustomizer + - org.openrewrite.java.ChangeMethodName: + methodPattern: org.springdoc.core.GroupedOpenApi.Builder addOpenApiCustomiser(..) + newMethodName: addOpenApiCustomizer + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.springdoc.core.GroupedOpenApi + newFullyQualifiedTypeName: org.springdoc.core.models.GroupedOpenApi diff --git a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java new file mode 100644 index 000000000..fe2b3ca68 --- /dev/null +++ b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java @@ -0,0 +1,86 @@ +/* + * Copyright 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.openrewrite.java.springdoc; + +import org.junit.jupiter.api.Test; +import static org.openrewrite.java.Assertions.java; +import org.openrewrite.java.JavaParser; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.RewriteTest; +import org.openrewrite.test.TypeValidation; + +public class MigrateSpringdocCommonTest implements RewriteTest { + @Override + public void defaults(RecipeSpec spec) { + spec.recipeFromResources("org.openrewrite.java.springdoc.MigrateSpringdocCommon") + .parser(JavaParser.fromJavaVersion().classpath( + "springdoc-openapi-common-1.+", + "swagger-models-2.+" + )); + } + + @Test + public void fixCustomiserAndGroupedOpenApi() { + // language=java + rewriteRun( + spec -> spec.afterTypeValidationOptions(TypeValidation.none()), + java( + """ + import io.swagger.v3.oas.models.OpenAPI; + import org.springdoc.core.GroupedOpenApi; + import org.springdoc.core.customizers.OpenApiCustomiser; + + public class OpenApiConfiguration { + + public static void groupedOpenApi() { + GroupedOpenApi.builder() + .group("group") + .pathsToMatch("/api/**") + .addOpenApiCustomiser(new FoobarOpenApiCustomiser()) + .build(); + } + + public static class FoobarOpenApiCustomiser implements OpenApiCustomiser { + @Override + public void customise(OpenAPI openApi) { + } + } + } + """, """ + import io.swagger.v3.oas.models.OpenAPI; + import org.springdoc.core.customizers.OpenApiCustomizer; + import org.springdoc.core.models.GroupedOpenApi; + + public class OpenApiConfiguration { + + public static void groupedOpenApi() { + GroupedOpenApi.builder() + .group("group") + .pathsToMatch("/api/**") + .addOpenApiCustomizer(new FoobarOpenApiCustomiser()) + .build(); + } + + public static class FoobarOpenApiCustomiser implements OpenApiCustomizer { + @Override + public void customise(OpenAPI openApi) { + } + } + } + """ + )); + } +} From 93fe048ae826bb394e3ce6af05222b792af9280b Mon Sep 17 00:00:00 2001 From: SiBorea <108953913+SiBorea@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:18:39 +0800 Subject: [PATCH 2/8] Apply suggestions from bot Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../java/springdoc/MigrateSpringdocCommonTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java index fe2b3ca68..23869a7cd 100644 --- a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java +++ b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java @@ -16,8 +16,10 @@ package org.openrewrite.java.springdoc; import org.junit.jupiter.api.Test; +import org.openrewrite.DocumentExample; import static org.openrewrite.java.Assertions.java; -import org.openrewrite.java.JavaParser; + +class MigrateSpringdocCommonTest implements RewriteTest { import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; import org.openrewrite.test.TypeValidation; @@ -32,7 +34,8 @@ public void defaults(RecipeSpec spec) { )); } - @Test + @DocumentExample + void fixCustomiserAndGroupedOpenApi() { public void fixCustomiserAndGroupedOpenApi() { // language=java rewriteRun( From 3722ad3c71184e942cf6794dc87d4aa6d3c2d1dc Mon Sep 17 00:00:00 2001 From: SiBorea Date: Fri, 22 Nov 2024 10:24:18 +0800 Subject: [PATCH 3/8] Fix syntax messed up by bot --- .../java/springdoc/MigrateSpringdocCommonTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java index 23869a7cd..b509e3a2f 100644 --- a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java +++ b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java @@ -18,8 +18,7 @@ import org.junit.jupiter.api.Test; import org.openrewrite.DocumentExample; import static org.openrewrite.java.Assertions.java; - -class MigrateSpringdocCommonTest implements RewriteTest { +import org.openrewrite.java.JavaParser; import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; import org.openrewrite.test.TypeValidation; @@ -34,8 +33,8 @@ public void defaults(RecipeSpec spec) { )); } + @Test @DocumentExample - void fixCustomiserAndGroupedOpenApi() { public void fixCustomiserAndGroupedOpenApi() { // language=java rewriteRun( From 46dc27446fb8cd5a0d3e306eee8cfb73afea89e3 Mon Sep 17 00:00:00 2001 From: SiBorea Date: Thu, 21 Nov 2024 09:05:50 +0800 Subject: [PATCH 4/8] Add MigrateSpringdocCommon recipe --- build.gradle.kts | 2 + .../resources/META-INF/rewrite/springdoc.yml | 20 +++++ .../springdoc/MigrateSpringdocCommonTest.java | 86 +++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java diff --git a/build.gradle.kts b/build.gradle.kts index d4bf10fae..92eecd143 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -149,6 +149,8 @@ dependencies { runtimeOnly("org.openrewrite.recipe:rewrite-testing-frameworks:$rewriteVersion") testRuntimeOnly("ch.qos.logback:logback-classic:1.+") + testRuntimeOnly("org.springdoc:springdoc-openapi-common:1.+") + testRuntimeOnly("io.swagger.core.v3:swagger-models:2.+") testRuntimeOnly(gradleApi()) testImplementation("org.openrewrite.gradle.tooling:model:$rewriteVersion") diff --git a/src/main/resources/META-INF/rewrite/springdoc.yml b/src/main/resources/META-INF/rewrite/springdoc.yml index 5c3e1b524..088c6508e 100644 --- a/src/main/resources/META-INF/rewrite/springdoc.yml +++ b/src/main/resources/META-INF/rewrite/springdoc.yml @@ -27,6 +27,7 @@ tags: recipeList: - org.openrewrite.java.springdoc.SwaggerToSpringDoc - org.openrewrite.java.springdoc.ReplaceSpringFoxDependencies + - org.openrewrite.java.springdoc.MigrateSpringdocCommon --- type: specs.openrewrite.org/v1beta/recipe @@ -151,3 +152,22 @@ recipeList: groupId: org.springdoc artifactId: "*" newVersion: 2.1.x + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.springdoc.MigrateSpringdocCommon +displayName: Migrate from springdoc-openapi-common to springdoc-openapi-starter-common +description: Migrate from springdoc-openapi-common to springdoc-openapi-starter-common. +tags: + - springdoc + - openapi +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.springdoc.core.customizers.OpenApiCustomiser + newFullyQualifiedTypeName: org.springdoc.core.customizers.OpenApiCustomizer + - org.openrewrite.java.ChangeMethodName: + methodPattern: org.springdoc.core.GroupedOpenApi.Builder addOpenApiCustomiser(..) + newMethodName: addOpenApiCustomizer + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.springdoc.core.GroupedOpenApi + newFullyQualifiedTypeName: org.springdoc.core.models.GroupedOpenApi diff --git a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java new file mode 100644 index 000000000..fe2b3ca68 --- /dev/null +++ b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java @@ -0,0 +1,86 @@ +/* + * Copyright 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.openrewrite.java.springdoc; + +import org.junit.jupiter.api.Test; +import static org.openrewrite.java.Assertions.java; +import org.openrewrite.java.JavaParser; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.RewriteTest; +import org.openrewrite.test.TypeValidation; + +public class MigrateSpringdocCommonTest implements RewriteTest { + @Override + public void defaults(RecipeSpec spec) { + spec.recipeFromResources("org.openrewrite.java.springdoc.MigrateSpringdocCommon") + .parser(JavaParser.fromJavaVersion().classpath( + "springdoc-openapi-common-1.+", + "swagger-models-2.+" + )); + } + + @Test + public void fixCustomiserAndGroupedOpenApi() { + // language=java + rewriteRun( + spec -> spec.afterTypeValidationOptions(TypeValidation.none()), + java( + """ + import io.swagger.v3.oas.models.OpenAPI; + import org.springdoc.core.GroupedOpenApi; + import org.springdoc.core.customizers.OpenApiCustomiser; + + public class OpenApiConfiguration { + + public static void groupedOpenApi() { + GroupedOpenApi.builder() + .group("group") + .pathsToMatch("/api/**") + .addOpenApiCustomiser(new FoobarOpenApiCustomiser()) + .build(); + } + + public static class FoobarOpenApiCustomiser implements OpenApiCustomiser { + @Override + public void customise(OpenAPI openApi) { + } + } + } + """, """ + import io.swagger.v3.oas.models.OpenAPI; + import org.springdoc.core.customizers.OpenApiCustomizer; + import org.springdoc.core.models.GroupedOpenApi; + + public class OpenApiConfiguration { + + public static void groupedOpenApi() { + GroupedOpenApi.builder() + .group("group") + .pathsToMatch("/api/**") + .addOpenApiCustomizer(new FoobarOpenApiCustomiser()) + .build(); + } + + public static class FoobarOpenApiCustomiser implements OpenApiCustomizer { + @Override + public void customise(OpenAPI openApi) { + } + } + } + """ + )); + } +} From e6c3d8cf90fa4099d8b707e601dcdd44ad1f286f Mon Sep 17 00:00:00 2001 From: SiBorea <108953913+SiBorea@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:18:39 +0800 Subject: [PATCH 5/8] Apply suggestions from bot Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../java/springdoc/MigrateSpringdocCommonTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java index fe2b3ca68..23869a7cd 100644 --- a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java +++ b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java @@ -16,8 +16,10 @@ package org.openrewrite.java.springdoc; import org.junit.jupiter.api.Test; +import org.openrewrite.DocumentExample; import static org.openrewrite.java.Assertions.java; -import org.openrewrite.java.JavaParser; + +class MigrateSpringdocCommonTest implements RewriteTest { import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; import org.openrewrite.test.TypeValidation; @@ -32,7 +34,8 @@ public void defaults(RecipeSpec spec) { )); } - @Test + @DocumentExample + void fixCustomiserAndGroupedOpenApi() { public void fixCustomiserAndGroupedOpenApi() { // language=java rewriteRun( From 506062b87c8cfd34c16ff811f251da5d20f5d751 Mon Sep 17 00:00:00 2001 From: SiBorea Date: Fri, 22 Nov 2024 10:24:18 +0800 Subject: [PATCH 6/8] Fix syntax messed up by bot --- .../java/springdoc/MigrateSpringdocCommonTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java index 23869a7cd..b509e3a2f 100644 --- a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java +++ b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java @@ -18,8 +18,7 @@ import org.junit.jupiter.api.Test; import org.openrewrite.DocumentExample; import static org.openrewrite.java.Assertions.java; - -class MigrateSpringdocCommonTest implements RewriteTest { +import org.openrewrite.java.JavaParser; import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; import org.openrewrite.test.TypeValidation; @@ -34,8 +33,8 @@ public void defaults(RecipeSpec spec) { )); } + @Test @DocumentExample - void fixCustomiserAndGroupedOpenApi() { public void fixCustomiserAndGroupedOpenApi() { // language=java rewriteRun( From 496ea57627c27e4fb4f16f1fc14f1248a6610967 Mon Sep 17 00:00:00 2001 From: SiBorea Date: Mon, 25 Nov 2024 10:21:24 +0800 Subject: [PATCH 7/8] Fix build fail on SpringBoot_1_5 --- build.gradle.kts | 5 +++-- .../java/springdoc/MigrateSpringdocCommonTest.java | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) rename src/{test => testWithSpringBoot_3_3}/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java (98%) diff --git a/build.gradle.kts b/build.gradle.kts index 92eecd143..ca2423b11 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -149,8 +149,6 @@ dependencies { runtimeOnly("org.openrewrite.recipe:rewrite-testing-frameworks:$rewriteVersion") testRuntimeOnly("ch.qos.logback:logback-classic:1.+") - testRuntimeOnly("org.springdoc:springdoc-openapi-common:1.+") - testRuntimeOnly("io.swagger.core.v3:swagger-models:2.+") testRuntimeOnly(gradleApi()) testImplementation("org.openrewrite.gradle.tooling:model:$rewriteVersion") @@ -257,6 +255,9 @@ dependencies { "testWithSpringBoot_3_2RuntimeOnly"("org.springframework.boot:spring-boot-starter:3.2.+") "testWithSpringBoot_3_2RuntimeOnly"("org.springframework.boot:spring-boot-starter-test:3.2.+") + "testWithSpringBoot_3_3RuntimeOnly"("org.springdoc:springdoc-openapi-common:1.+") + "testWithSpringBoot_3_3RuntimeOnly"("io.swagger.core.v3:swagger-models:2.+") + "testWithSpringSecurity_5_7RuntimeOnly"("org.springframework:spring-context:5.3.+") "testWithSpringSecurity_5_7RuntimeOnly"("org.springframework.boot:spring-boot-starter:2.7.+") "testWithSpringSecurity_5_7RuntimeOnly"("org.springframework.boot:spring-boot:2.7.+") diff --git a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java b/src/testWithSpringBoot_3_3/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java similarity index 98% rename from src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java rename to src/testWithSpringBoot_3_3/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java index b509e3a2f..847a4d068 100644 --- a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java +++ b/src/testWithSpringBoot_3_3/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java @@ -17,6 +17,7 @@ import org.junit.jupiter.api.Test; import org.openrewrite.DocumentExample; +import org.openrewrite.InMemoryExecutionContext; import static org.openrewrite.java.Assertions.java; import org.openrewrite.java.JavaParser; import org.openrewrite.test.RecipeSpec; From d55f21a2c64769a0a732a0870a8c61a502ad997d Mon Sep 17 00:00:00 2001 From: SiBorea Date: Mon, 25 Nov 2024 10:32:51 +0800 Subject: [PATCH 8/8] Fix rebase error --- build.gradle.kts | 2 - .../springdoc/MigrateSpringdocCommonTest.java | 88 ------------------- 2 files changed, 90 deletions(-) delete mode 100644 src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java diff --git a/build.gradle.kts b/build.gradle.kts index 34bc1b19d..ca2423b11 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -149,8 +149,6 @@ dependencies { runtimeOnly("org.openrewrite.recipe:rewrite-testing-frameworks:$rewriteVersion") testRuntimeOnly("ch.qos.logback:logback-classic:1.+") - testRuntimeOnly("org.springdoc:springdoc-openapi-common:1.+") - testRuntimeOnly("io.swagger.core.v3:swagger-models:2.+") testRuntimeOnly(gradleApi()) testImplementation("org.openrewrite.gradle.tooling:model:$rewriteVersion") diff --git a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java b/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java deleted file mode 100644 index b509e3a2f..000000000 --- a/src/test/java/org/openrewrite/java/springdoc/MigrateSpringdocCommonTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 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.openrewrite.java.springdoc; - -import org.junit.jupiter.api.Test; -import org.openrewrite.DocumentExample; -import static org.openrewrite.java.Assertions.java; -import org.openrewrite.java.JavaParser; -import org.openrewrite.test.RecipeSpec; -import org.openrewrite.test.RewriteTest; -import org.openrewrite.test.TypeValidation; - -public class MigrateSpringdocCommonTest implements RewriteTest { - @Override - public void defaults(RecipeSpec spec) { - spec.recipeFromResources("org.openrewrite.java.springdoc.MigrateSpringdocCommon") - .parser(JavaParser.fromJavaVersion().classpath( - "springdoc-openapi-common-1.+", - "swagger-models-2.+" - )); - } - - @Test - @DocumentExample - public void fixCustomiserAndGroupedOpenApi() { - // language=java - rewriteRun( - spec -> spec.afterTypeValidationOptions(TypeValidation.none()), - java( - """ - import io.swagger.v3.oas.models.OpenAPI; - import org.springdoc.core.GroupedOpenApi; - import org.springdoc.core.customizers.OpenApiCustomiser; - - public class OpenApiConfiguration { - - public static void groupedOpenApi() { - GroupedOpenApi.builder() - .group("group") - .pathsToMatch("/api/**") - .addOpenApiCustomiser(new FoobarOpenApiCustomiser()) - .build(); - } - - public static class FoobarOpenApiCustomiser implements OpenApiCustomiser { - @Override - public void customise(OpenAPI openApi) { - } - } - } - """, """ - import io.swagger.v3.oas.models.OpenAPI; - import org.springdoc.core.customizers.OpenApiCustomizer; - import org.springdoc.core.models.GroupedOpenApi; - - public class OpenApiConfiguration { - - public static void groupedOpenApi() { - GroupedOpenApi.builder() - .group("group") - .pathsToMatch("/api/**") - .addOpenApiCustomizer(new FoobarOpenApiCustomiser()) - .build(); - } - - public static class FoobarOpenApiCustomiser implements OpenApiCustomizer { - @Override - public void customise(OpenAPI openApi) { - } - } - } - """ - )); - } -}