Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/samples-kotlin-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
- samples/server/petstore/kotlin-springboot-reactive-without-flow
- samples/server/petstore/kotlin-springboot-source-swagger1
- samples/server/petstore/kotlin-springboot-source-swagger2
- samples/server/petstore/kotlin-springboot-springfox
- samples/server/petstore/kotlin-springboot-x-kotlin-implements
- samples/server/petstore/kotlin-springboot-include-http-request-context-delegate
- samples/server/petstore/kotlin-server/ktor2
Expand Down
12 changes: 0 additions & 12 deletions bin/configs/kotlin-spring-boot-springfox.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion docs/generators/kotlin-spring.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|declarativeInterfaceReactiveMode|What type of reactive style to use in Spring Http declarative interface|<dl><dt>**coroutines**</dt><dd>Use kotlin-idiomatic 'suspend' functions</dd><dt>**reactor**</dt><dd>Use reactor return wrappers 'Mono' and 'Flux'</dd></dl>|coroutines|
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|documentationProvider|Select the OpenAPI documentation provider.|<dl><dt>**none**</dt><dd>Do not publish an OpenAPI specification.</dd><dt>**source**</dt><dd>Publish the original input OpenAPI specification.</dd><dt>**springfox**</dt><dd>Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.</dd><dt>**springdoc**</dt><dd>Generate an OpenAPI 3 specification using SpringDoc.</dd></dl>|springdoc|
|documentationProvider|Select the OpenAPI documentation provider.|<dl><dt>**none**</dt><dd>Do not publish an OpenAPI specification.</dd><dt>**source**</dt><dd>Publish the original input OpenAPI specification.</dd><dt>**springdoc**</dt><dd>Generate an OpenAPI 3 specification using SpringDoc.</dd></dl>|springdoc|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
|exceptionHandler|generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )| |true|
|gradleBuildFile|generate a gradle build file using the Kotlin DSL| |true|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ public List<DocumentationProvider> supportedDocumentationProvider() {
return Arrays.asList(
DocumentationProvider.NONE,
DocumentationProvider.SOURCE,
DocumentationProvider.SPRINGFOX,
DocumentationProvider.SPRINGDOC
);
}
Expand All @@ -369,8 +368,7 @@ public List<AnnotationLibrary> supportedAnnotationLibraries() {
* @return true if the selected DocumentationProvider requires us to bootstrap swagger-ui.
*/
private boolean selectedDocumentationProviderRequiresSwaggerUiBootstrap() {
return getDocumentationProvider().equals(DocumentationProvider.SPRINGFOX) ||
getDocumentationProvider().equals(DocumentationProvider.SOURCE);
return getDocumentationProvider().equals(DocumentationProvider.SOURCE);
}

public boolean getExceptionHandler() {
Expand Down Expand Up @@ -433,10 +431,6 @@ public void processOpts() {

super.processOpts();

if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {
LOGGER.warn("The springfox documentation provider is deprecated for removal. Use the springdoc provider instead.");
}

if (null != defaultDocumentationProvider()) {
documentationProvider = DocumentationProvider.ofCliOption(
(String) additionalProperties.getOrDefault(DOCUMENTATION_PROVIDER,
Expand Down Expand Up @@ -514,7 +508,6 @@ public void processOpts() {
}

// Spring-specific import mappings for x-spring-paginated support
importMapping.put("ApiIgnore", "springfox.documentation.annotations.ApiIgnore");
importMapping.put("ParameterObject", "org.springdoc.api.annotations.ParameterObject");
importMapping.put("PageableAsQueryParam", "org.springdoc.core.converters.models.PageableAsQueryParam");
if (useSpringBoot3) {
Expand Down Expand Up @@ -725,9 +718,6 @@ public void processOpts() {
}

if (isUseSpringBoot3() || isUseSpringBoot4()) {
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {
throw new IllegalArgumentException(DocumentationProvider.SPRINGFOX.getPropertyName() + " is not supported with Spring Boot > 3.x");
}
if (AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) {
throw new IllegalArgumentException(AnnotationLibrary.SWAGGER1.getPropertyName() + " is not supported with Spring Boot > 3.x");
}
Expand Down Expand Up @@ -899,11 +889,7 @@ public void processOpts() {
}

if (!reactive && !(library.equals(SPRING_CLOUD_LIBRARY) || library.equals(SPRING_DECLARATIVE_HTTP_INTERFACE_LIBRARY))) {
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {
supportingFiles.add(new SupportingFile("springfoxDocumentationConfig.mustache",
(sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator),
"SpringFoxConfiguration.kt"));
} else if (DocumentationProvider.SPRINGDOC.equals(getDocumentationProvider())) {
if (DocumentationProvider.SPRINGDOC.equals(getDocumentationProvider())) {
supportingFiles.add(new SupportingFile("springdocDocumentationConfig.mustache",
(sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator),
"SpringDocConfiguration.kt"));
Expand Down Expand Up @@ -970,7 +956,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera
* When x-spring-paginated is set to true on an operation, this method:
* - Adds org.springframework.data.domain.Pageable parameter to the method signature
* - Removes the default Spring Data Web pagination query parameters (page, size, sort)
* - Adds appropriate imports (Pageable, ApiIgnore for springfox, ParameterObject for springdoc)
* - Adds appropriate imports (Pageable, ParameterObject for springdoc)
*
* Auto-detection (when autoXSpringPaginated is enabled):
* - Automatically detects operations with 'page', 'size', and 'sort' query parameters (case-sensitive)
Expand Down Expand Up @@ -1037,9 +1023,6 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
// add org.springframework.data.domain.Pageable import when needed (server libraries only)
if (operation.getExtensions() != null && Boolean.TRUE.equals(operation.getExtensions().get("x-spring-paginated"))) {
codegenOperation.imports.add("Pageable");
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {
codegenOperation.imports.add("ApiIgnore");
}
if (DocumentationProvider.SPRINGDOC.equals(getDocumentationProvider())) {
codegenOperation.imports.add("PageableAsQueryParam");
// Prepend @PageableAsQueryParam to existing x-operation-extra-annotation if present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ enum DocumentationProvider {
SWAGGER2("swagger2DocumentationProvider", "Generate an OpenAPI 3 specification using Swagger-Core 2.x.",
AnnotationLibrary.SWAGGER2, AnnotationLibrary.SWAGGER2),

SPRINGFOX("springFoxDocumentationProvider", "Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.",
AnnotationLibrary.SWAGGER1, AnnotationLibrary.SWAGGER1),

SPRINGDOC("springDocDocumentationProvider", "Generate an OpenAPI 3 specification using SpringDoc.",
AnnotationLibrary.SWAGGER2, AnnotationLibrary.SWAGGER2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,8 @@ public void useTargetOnInterfaceAnnotationsWithSwagger1() throws IOException {
KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen();
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(ANNOTATION_LIBRARY, AnnotationLibrary.SWAGGER1.toCliOptValue());
codegen.additionalProperties().put(DOCUMENTATION_PROVIDER, DocumentationProvider.SPRINGFOX.toCliOptValue());
codegen.additionalProperties().put(DOCUMENTATION_PROVIDER, DocumentationProvider.NONE.toCliOptValue());


new DefaultGenerator().opts(new ClientOptInput()
.openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue3596-use-correct-get-annotation-target.yaml"))
Expand Down Expand Up @@ -3260,20 +3261,6 @@ public Object[][] issue17997DocumentationProviders() {
"allowableValues = [\"sleeping\", \"awake\"]", "@PathVariable",
"@PathVariable"
)
},
{ DocumentationProviderFeatures.DocumentationProvider.SPRINGFOX.name(),
(Consumer<Path>) outputPath ->
assertFileContains(
outputPath,
"allowableValues = \"0, 1\", defaultValue = \"0\"",
"@PathVariable"
),
(Consumer<Path>) outputPath ->
assertFileContains(
outputPath,
"allowableValues = \"sleeping, awake\"", "@PathVariable",
"@PathVariable"
)
}
};
}
Expand Down Expand Up @@ -3701,23 +3688,6 @@ public void springPaginatedWithSpringDocAndSpringBoot3() throws Exception {
assertFileContains(petApi.toPath(), "pageable: Pageable");
}

@Test
public void springPaginatedWithSpringFox() throws Exception {
Map<String, Object> additionalProperties = new HashMap<>();
additionalProperties.put(USE_TAGS, "true");
additionalProperties.put(DOCUMENTATION_PROVIDER, "springfox");
additionalProperties.put(INTERFACE_ONLY, "true");
additionalProperties.put(SKIP_DEFAULT_INTERFACE, "true");

Map<String, File> files = generateFromContract("src/test/resources/3_0/spring/petstore-with-spring-pageable.yaml", additionalProperties);

File petApi = files.get("PetApi.kt");
assertFileContains(petApi.toPath(), "import org.springframework.data.domain.Pageable");
assertFileContains(petApi.toPath(), "import springfox.documentation.annotations.ApiIgnore");
assertFileContains(petApi.toPath(), "pageable: Pageable");
assertFileContains(petApi.toPath(), "@ApiParam(hidden = true) pageable: Pageable");
}

@Test
public void springPaginatedQueryParamsRemoved() throws Exception {
Map<String, Object> additionalProperties = new HashMap<>();
Expand Down Expand Up @@ -3845,24 +3815,6 @@ public void springPaginatedWithNoDocumentationProvider() throws Exception {
assertFileNotContains(petApi.toPath(), "@ParameterObject pageable");
}

@Test
public void springPaginatedWithSwagger1AnnotationLibrary() throws Exception {
Map<String, Object> additionalProperties = new HashMap<>();
additionalProperties.put(USE_TAGS, "true");
additionalProperties.put(DOCUMENTATION_PROVIDER, "springfox");
additionalProperties.put(ANNOTATION_LIBRARY, "swagger1");
additionalProperties.put(INTERFACE_ONLY, "true");
additionalProperties.put(SKIP_DEFAULT_INTERFACE, "true");

Map<String, File> files = generateFromContract("src/test/resources/3_0/spring/petstore-with-spring-pageable.yaml", additionalProperties);

// Test with swagger1 annotations
File petApi = files.get("PetApi.kt");
assertFileContains(petApi.toPath(), "import org.springframework.data.domain.Pageable");
assertFileContains(petApi.toPath(), "import springfox.documentation.annotations.ApiIgnore");
assertFileContains(petApi.toPath(), "@ApiParam(hidden = true) pageable: Pageable");
}

@Test
public void springPaginatedWithSpringDocUsesPageableAsQueryParam() throws Exception {
Map<String, Object> additionalProperties = new HashMap<>();
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions samples/server/petstore/kotlin-springboot-springfox/README.md

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

Loading
Loading