Skip to content

Commit ff414dd

Browse files
authored
[Spring] Defaulting for Spring HTTP Interface library (OpenAPITools#15689) (fix OpenAPITools#15631)
1 parent 0bcf9d8 commit ff414dd

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

bin/configs/spring-http-interface-reactive.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,11 @@ additionalProperties:
88
snapshotVersion: "true"
99
hideGenerationTimestamp: "true"
1010
reactive: "true"
11+
# documentation provider should be ignored
12+
documentationProvider: "springfox"
13+
# annotation provider should be ignored
14+
annotationLibrary: "swagger1"
15+
# validation should be ignored
16+
useBeanValidation: "true"
17+
performBeanValidation: "true"
1118

bin/configs/spring-http-interface.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ additionalProperties:
99
hideGenerationTimestamp: "true"
1010
modelNameSuffix: 'Dto'
1111
generatedConstructorWithRequiredArgs: "false"
12+
# documentation provider should be ignored
13+
documentationProvider: "springdoc"
14+
# annotation provider should be ignored
15+
annotationLibrary: "swagger2"
16+
# validation should be ignored
17+
useBeanValidation: "true"
18+
performBeanValidation: "true"

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public String getHelp() {
295295

296296
@Override
297297
public DocumentationProvider defaultDocumentationProvider() {
298-
return SPRING_HTTP_INTERFACE.equals(library) ? DocumentationProvider.NONE : DocumentationProvider.SPRINGDOC;
298+
return isLibrary(SPRING_HTTP_INTERFACE) ? null : DocumentationProvider.SPRINGDOC;
299299
}
300300

301301
public List<DocumentationProvider> supportedDocumentationProvider() {
@@ -370,8 +370,21 @@ public void processOpts() {
370370
documentationProvider = DocumentationProvider.NONE;
371371
annotationLibrary = AnnotationLibrary.NONE;
372372
useJakartaEe=true;
373+
useBeanValidation = false;
374+
performBeanValidation = false;
375+
373376
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);
377+
additionalProperties.put(USE_BEANVALIDATION, useBeanValidation);
378+
additionalProperties.put(PERFORM_BEANVALIDATION, performBeanValidation);
379+
additionalProperties.put(DOCUMENTATION_PROVIDER, documentationProvider.toCliOptValue());
380+
additionalProperties.put(documentationProvider.getPropertyName(), true);
381+
additionalProperties.put(ANNOTATION_LIBRARY, annotationLibrary.toCliOptValue());
382+
additionalProperties.put(annotationLibrary.getPropertyName(), true);
383+
374384
applyJakartaPackage();
385+
386+
LOGGER.warn("For Spring HTTP Interface following options are disabled: documentProvider, annotationLibrary, useBeanValidation, performBeanValidation. "
387+
+ "useJakartaEe defaulted to 'true'");
375388
}
376389

377390
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {

0 commit comments

Comments
 (0)