-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Fix Kotlin default values for strings and arrays #9865
Fix Kotlin default values for strings and arrays #9865
Conversation
{
"openapi": "3.0.1",
"info": {
"title": "Test file",
"version": "1"
},
"paths": { },
"components":{
"schemas": {
"Test": {
"title": "TestObject",
"type": "object",
"required": [
"testArray", "stringDefault"
],
"properties": {
"stringDefault": {
"type": "string",
"default": "test"
},
"testArray": {
"type": "array",
"default": [],
"items": {
"type": "string"
}
},
"testArrayOptional": {
"type": "array",
"default": ["1"],
"items": {
"type": "string"
}
},
"testArrayInt": {
"type": "array",
"default": [1, 2],
"uniqueItems": true,
"items": {
"type": "integer"
}
}
}
}
}
} |
Does this PR overlap with #9849? |
Yeah, somewhat. |
Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/OpenAPITools/openapi-generator/graphs/contributors. Let me know if you need help fixing it. |
Tested kotlin-spring generator with default values for string, array of string and the result is good. |
honestly, I don't care :) |
To close #9844
This PR fixes two of the three issues mentioned in the linked issue. Enum default values were not a priority, as there is a reasonable workaround. All changes were tested with a minimal spec included below.
PR checklist
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*
.For Windows users, please run the script in Git BASH.
master
,5.1.x
,6.0.x
@jimschubert @dr4ke616 @karismann @Zomzog @andrewemery @4brunu @yutaka0m