-
-
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
[C++][Restbed] Fix default values for Restbed Server generator #761
[C++][Restbed] Fix default values for Restbed Server generator #761
Conversation
Currently what seems to be not working is that if the variable is a string, the default value specified in the java file is not taken, but if it is a bool for example, it does work. |
@stkrwork |
So somewhere in the codegen base it doesnt get forwarded? |
I just fixed the default value in C# (12.3F instead of 12.3). I can take a look at this |
UPDATE: I've pushed the fix (80b3eff). Please take a look. I also did some tests to confirm the default value is now working fine with the cpp restbed server generator. Since the fix is in DefaultCodegen, I've copied the core team as well. cc @OpenAPITools/generator-core-team (I'm verifying the impact to other generators) |
@@ -287,25 +291,63 @@ public String getTypeDeclaration(Schema p) { | |||
@Override | |||
public String toDefaultValue(Schema p) { | |||
if (ModelUtils.isStringSchema(p)) { | |||
return "\"\""; | |||
if (p.getDefault() != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we need to do this for other generators as well right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most other generators are following this approach but I'll double check to make sure.
I'm thinking about another PR to clean up the default, example value as the fix in DefaultCodegen in this PR seems to be partial (which means other generators are showing different default, example values after the change)
Looks good though. |
looks good to me |
can you check if your problem is fixed @vbs96? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in DefaultCodegen looks good to me.
f454625
to
7b42b16
Compare
7b42b16
to
ce69006
Compare
…PITools#761) * Start working on fixing default value in Restbed Server Api Template * fix default value in DefaultCodegen
…r" (OpenAPITools#1027) * Revert "[gradle plugin] Support Gradle 4.10 (OpenAPITools#1011)" This reverts commit 131cf94. * Revert "[C++][Restbed] Fix default values for Restbed Server generator (OpenAPITools#761)" This reverts commit f29ba97.
Sorry, this change is not included in the 3.3.0 release as it has been rolled back. |
…PITools#761) * Start working on fixing default value in Restbed Server Api Template * fix default value in DefaultCodegen
…r" (OpenAPITools#1027) * Revert "[gradle plugin] Support Gradle 4.10 (OpenAPITools#1011)" This reverts commit 131cf94. * Revert "[C++][Restbed] Fix default values for Restbed Server generator (OpenAPITools#761)" This reverts commit f29ba97.
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,4.0.x
. Default:master
.Description of the PR
Fix #760
@ravinikam @fvarose @etherealjoy @MartinDelille @wing328