-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[Rust] Add support for discriminator #3895
Conversation
Co-authored-by: Adi Ritman <55248441+ritmanadi@users.noreply.github.com>
Errors reported by the Travis CI:
ref: https://travis-ci.org/OpenAPITools/openapi-generator/builds/585652775 |
We can't re-export those types because their name is derived from the property name, which might be duplicated.
e3a81e4
to
3c1d778
Compare
good catch, sorry for that. I've adapted my changes. |
Pinging @bjgill and @richardwhiuk for a review |
Thanks. I'm quite busy this week, so will take a look next week unless this is urgent. |
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.
Looks like a sensible change. Just a couple of questions.
FYI - I'm about to merge #3543, which will conflict with this. You should just need to regenerate the samples to sort out the conflicts.
...es/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java
Show resolved
Hide resolved
I've just merged the conflicting PR. You should just need to rebase onto master and re-generate the samples again. |
Done, I added a small change to the template files to remove some |
Thanks. I'll merge this, which should fix #4079 |
This patch includes: - Add all missing explicit dyn to trait types to remove warnings OpenAPITools/openapi-generator#3895 - Add missing re-export for properties that are enum OpenAPITools/openapi-generator#3895 - Handle optional parameters OpenAPITools/openapi-generator#4016 - Derive more traits borsboom/openapi-generator@4e3bc31
Built using borsboom/openapi-generator@4e3bc31 This patch includes: - Add all missing explicit dyn to trait types to remove warnings OpenAPITools/openapi-generator#3895 - Add missing re-export for properties that are enum OpenAPITools/openapi-generator#3895 - Handle optional parameters OpenAPITools/openapi-generator#4016 - Derive more traits borsboom/openapi-generator@4e3bc31
@gferon thanks for the PR, which has been included in v4.2.0 release: https://twitter.com/oas_generator/status/1189824932345069569 |
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{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\
. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.master
,4.1.x
,5.0.x
. Default:master
.Description of the PR
discriminator
feature of OpenAPI 3, and implement it withenum
in Rustdyn
to trait types to remove warningsrust
and skip none option serialization in clients #2244).Example
A schema that looks like:
would generate a Rust enum like: