-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
fix(cpp-qt-client): add asJsonObject method to OAIEnum class (#19307) #21211
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(cpp-qt-client): add asJsonObject method to OAIEnum class (#19307) #21211
Conversation
|
Can you explain the need for this new method ? Also, you would need to re-generate the example if you want the PR to be merge. |
|
@MartinDelille This PR adds the missing asJsonObject method to the Enum class. When generating the schema for enums, the generated client code does not compile with my FastAPI schemas that use enums, as the client is expecting this method. The issue is also reported by another person here: #19307 I've generated and pushed the examples. |
MartinDelille
left a comment
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.
Thank you for you for your edit and your explanation. I indeed don't use edit and had trouble using it one time in the past!
988e125 to
543675d
Compare
samples/client/petstore/rust/hyper/petstore/src/models/duplicate_one_of.rs
Outdated
Show resolved
Hide resolved
|
Thanks for the fix @wing328 - @MartinDelille: the CI checks are passing now, please reapprove if necessary. |
…qt-enum-asjsonobject
…nd referenced enums
For enum query parameters, the template was incorrectly using asJsonObject()
which returns {"value": "enumValue"} and then iterating over keys, using
"value" as the parameter name instead of the actual parameter name.
This fix adds special handling for both inline enums (isEnum) and referenced
enums (isEnumRef) to use asJson() directly, which returns the correct enum
string value for URL serialization.
Fixes enum query parameters like ?scope=property instead of ?value=property.
Completes the fix started in PR OpenAPITools#21211 which added the asJsonObject() method
to make enum code compile, but the template logic was still incorrect for URL
query parameter serialization.
Note: The petstore samples don't contain enum query parameter tests to
demonstrate this fix (they use string arrays). Future contributors may want
to add enum query parameter examples to better showcase this functionality.
…nd referenced enums (#22559) * fix(cpp-qt): Fix enum query parameter serialization for both inline and referenced enums For enum query parameters, the template was incorrectly using asJsonObject() which returns {"value": "enumValue"} and then iterating over keys, using "value" as the parameter name instead of the actual parameter name. This fix adds special handling for both inline enums (isEnum) and referenced enums (isEnumRef) to use asJson() directly, which returns the correct enum string value for URL serialization. Fixes enum query parameters like ?scope=property instead of ?value=property. Completes the fix started in PR #21211 which added the asJsonObject() method to make enum code compile, but the template logic was still incorrect for URL query parameter serialization. Note: The petstore samples don't contain enum query parameter tests to demonstrate this fix (they use string arrays). Future contributors may want to add enum query parameter examples to better showcase this functionality. * add tests for enum inline, ref for query parameters * update cmake version to 3.5 --------- Co-authored-by: Sohaib Athar <[email protected]>
…nd referenced enums (OpenAPITools#22559) * fix(cpp-qt): Fix enum query parameter serialization for both inline and referenced enums For enum query parameters, the template was incorrectly using asJsonObject() which returns {"value": "enumValue"} and then iterating over keys, using "value" as the parameter name instead of the actual parameter name. This fix adds special handling for both inline enums (isEnum) and referenced enums (isEnumRef) to use asJson() directly, which returns the correct enum string value for URL serialization. Fixes enum query parameters like ?scope=property instead of ?value=property. Completes the fix started in PR OpenAPITools#21211 which added the asJsonObject() method to make enum code compile, but the template logic was still incorrect for URL query parameter serialization. Note: The petstore samples don't contain enum query parameter tests to demonstrate this fix (they use string arrays). Future contributors may want to add enum query parameter examples to better showcase this functionality. * add tests for enum inline, ref for query parameters * update cmake version to 3.5 --------- Co-authored-by: Sohaib Athar <[email protected]>
Add asJsonObject method to OAIEnum class for cpp-qt-client
Adds the missing method to enum moustache file
@etherealjoy @MartinDelille