Skip to content

Commit 4888232

Browse files
thiswasdumbCopilot
andcommitted
Addressing comment
Co-authored-by: Copilot <copilot@github.com>
1 parent ca60f58 commit 4888232

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

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

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -430,25 +430,14 @@ public void processOpts() {
430430
documentationProvider = DocumentationProvider.NONE;
431431
annotationLibrary = AnnotationLibrary.NONE;
432432
useJakartaEe = true;
433-
if (!additionalProperties.containsKey(USE_BEANVALIDATION)) {
434-
useBeanValidation = false;
435-
} else {
436-
Object beanValidationValue = additionalProperties.get(USE_BEANVALIDATION);
437-
if (beanValidationValue instanceof Boolean) {
438-
useBeanValidation = (Boolean) beanValidationValue;
439-
} else if (beanValidationValue instanceof String) {
440-
useBeanValidation = Boolean.parseBoolean((String) beanValidationValue);
441-
}
433+
434+
if (configOptions.stream().noneMatch(opt -> USE_BEANVALIDATION.equals(opt.getLeft()))) {
435+
Object val = additionalProperties.get(USE_BEANVALIDATION);
436+
useBeanValidation = val instanceof Boolean ? (Boolean) val : Boolean.parseBoolean(val.toString());
442437
}
443-
if (!additionalProperties.containsKey(PERFORM_BEANVALIDATION)) {
444-
performBeanValidation = false;
445-
} else {
446-
Object performBeanValidationValue = additionalProperties.get(PERFORM_BEANVALIDATION);
447-
if (performBeanValidationValue instanceof Boolean) {
448-
performBeanValidation = (Boolean) performBeanValidationValue;
449-
} else if (performBeanValidationValue instanceof String) {
450-
performBeanValidation = Boolean.parseBoolean((String) performBeanValidationValue);
451-
}
438+
if (configOptions.stream().noneMatch(opt -> PERFORM_BEANVALIDATION.equals(opt.getLeft()))) {
439+
Object val = additionalProperties.get(PERFORM_BEANVALIDATION);
440+
performBeanValidation = val instanceof Boolean ? (Boolean) val : Boolean.parseBoolean(val.toString());
452441
}
453442

454443
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);

0 commit comments

Comments
 (0)