[Spring] Defaulting for Spring HTTP Interface library (#15689) (fix #15631)

This commit is contained in:
Oleh Kurpiak 2023-05-31 11:20:58 +03:00 committed by GitHub
parent 0bcf9d8bde
commit ff414dd6da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View File

@ -8,4 +8,11 @@ additionalProperties:
snapshotVersion: "true"
hideGenerationTimestamp: "true"
reactive: "true"
# documentation provider should be ignored
documentationProvider: "springfox"
# annotation provider should be ignored
annotationLibrary: "swagger1"
# validation should be ignored
useBeanValidation: "true"
performBeanValidation: "true"

View File

@ -9,3 +9,10 @@ additionalProperties:
hideGenerationTimestamp: "true"
modelNameSuffix: 'Dto'
generatedConstructorWithRequiredArgs: "false"
# documentation provider should be ignored
documentationProvider: "springdoc"
# annotation provider should be ignored
annotationLibrary: "swagger2"
# validation should be ignored
useBeanValidation: "true"
performBeanValidation: "true"

View File

@ -295,7 +295,7 @@ public class SpringCodegen extends AbstractJavaCodegen
@Override
public DocumentationProvider defaultDocumentationProvider() {
return SPRING_HTTP_INTERFACE.equals(library) ? DocumentationProvider.NONE : DocumentationProvider.SPRINGDOC;
return isLibrary(SPRING_HTTP_INTERFACE) ? null : DocumentationProvider.SPRINGDOC;
}
public List<DocumentationProvider> supportedDocumentationProvider() {
@ -370,8 +370,21 @@ public class SpringCodegen extends AbstractJavaCodegen
documentationProvider = DocumentationProvider.NONE;
annotationLibrary = AnnotationLibrary.NONE;
useJakartaEe=true;
useBeanValidation = false;
performBeanValidation = false;
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);
additionalProperties.put(USE_BEANVALIDATION, useBeanValidation);
additionalProperties.put(PERFORM_BEANVALIDATION, performBeanValidation);
additionalProperties.put(DOCUMENTATION_PROVIDER, documentationProvider.toCliOptValue());
additionalProperties.put(documentationProvider.getPropertyName(), true);
additionalProperties.put(ANNOTATION_LIBRARY, annotationLibrary.toCliOptValue());
additionalProperties.put(annotationLibrary.getPropertyName(), true);
applyJakartaPackage();
LOGGER.warn("For Spring HTTP Interface following options are disabled: documentProvider, annotationLibrary, useBeanValidation, performBeanValidation. "
+ "useJakartaEe defaulted to 'true'");
}
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {