[BUG][kotlin-spring] Fix defaultValue for RequestHeader is not generated (#20504)#21003
[BUG][kotlin-spring] Fix defaultValue for RequestHeader is not generated (#20504)#21003wing328 merged 4 commits intoOpenAPITools:masterfrom
Conversation
|
please follow step 3 to update the samples (in windows, you may need to run the command in WSL) |
|
@wing328 , thanks! I've updated the samples. |
|
i did a test with the spec provided in the issue but got errors: does it work for your use cases locally with this fix? |
|
and here is the change with this fix (compared with master) --- a/src/main/kotlin/org/openapitools/api/PetApiController.kt
+++ b/src/main/kotlin/org/openapitools/api/PetApiController.kt
@@ -65,7 +65,7 @@ class PetApiController() {
method = [RequestMethod.DELETE],
value = ["/pet/{petId}"]
)
- fun deletePet(@Parameter(description = "Pet id to delete", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "", `in` = ParameterIn.HEADER, schema = Schema(allowableValues = ["de", "at"], defaultValue = "de")) @RequestHeader(value = "x-tenant", required = false) xTenant: kotlin.String,@Parameter(description = "", `in` = ParameterIn.HEADER) @RequestHeader(value = "api_key", required = false) apiKey: kotlin.String?): ResponseEntity<Unit> {
+ fun deletePet(@Parameter(description = "Pet id to delete", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "", `in` = ParameterIn.HEADER, schema = Schema(allowableValues = ["de", "at"], defaultValue = "de")) @RequestHeader(value = "x-tenant", required = false, defaultValue = de) xTenant: kotlin.String,@Parameter(description = "", `in` = ParameterIn.HEADER) @RequestHeader(value = "api_key", required = false) apiKey: kotlin.String?): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
|
|
I just did a |
|
please use https://gist.github.com/wing328/bb5ce7ec9a91527a67b4c0f1a3c95737 to reproduce the issue |
|
Thanks @wing328, I have the same error, will debug further. |
|
tested again and the output builds without issue thanks for the pr |
|
Thanks @wing328 for your review :) |
This PR will fix 20504. Copied the current Java spring generator logic for the Kotlin Spring generator.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)@jimschubert (2017/09) ❤️, @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03)