Skip to content

Commit 5dc3829

Browse files
committed
openapi-processor/openapi-processor-spring#229, add compatibility mapping option to keep @Valid on the wrapped type
1 parent fa6f8cf commit 5dc3829

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/OptionsConverter.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class OptionsConverter(private val checkObsoleteProcessorOptions: Boolean = fals
6868
options.oneOfInterface = mapping.options.oneOfInterface
6969
options.formatCode = mapping.options.formatCode
7070
options.generatedDate = mapping.options.generatedDate
71+
options.beanValidationValidOnReactive = mapping.options.beanValidationValidOnReactive
7172
}
7273
}
7374

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/processor/mapping/v2/Options.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,12 @@ data class Options(
6060
/**
6161
* enable/disable the @Generated date (optional)
6262
*/
63-
val generatedDate: Boolean = true
63+
val generatedDate: Boolean = true,
64+
65+
/**
66+
* bean validation (compatibility)
67+
*
68+
* add @Valid on reactive type and not on the wrapped type
69+
*/
70+
val beanValidationValidOnReactive: Boolean = true
6471
)

openapi-processor-core/src/main/resources/mapping/v6/mapping.example.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ options: # general processor options [required]
1313
# validation annotation (optional): true or false (default), javax, jakarta.
1414
bean-validation: jakarta
1515

16+
# compatibility
17+
bean-validation-valid-on-reactive: true
18+
1619
# generate javadoc from OpenAPI 'description' properties.
1720
javadoc: true
1821

openapi-processor-core/src/main/resources/mapping/v6/mapping.yaml.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
"default": false,
3636
"enum": [false, true, "javax", "jakarta"]
3737
},
38+
"bean-validation-valid-on-reactive": {
39+
"description": "(compatibility) add bean validation @Valid annotation to reactive types.",
40+
"default": true
41+
},
3842
"javadoc": {
3943
"description": "generate javadoc from OpenAPI 'description' properties.",
4044
"type": "boolean",

0 commit comments

Comments
 (0)