-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG][kotlin-spring] Fix defaultValue for RequestHeader is not generated (#20504) #21003
base: master
Are you sure you want to change the base?
Conversation
https://github.com/OpenAPITools/openapi-generator/actions/runs/14189376808/job/39750844839?pr=21003 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 |
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.0
minor 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)