Skip to content
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

[Core, Rust Server] anyOf / oneOf support for Rust Server #6690

Merged
merged 15 commits into from Jan 23, 2021

Conversation

richardwhiuk
Copy link
Contributor

@richardwhiuk richardwhiuk commented Jun 16, 2020

This adds anyOf/oneOf support for the Rust Server generator using the support added in Metaswitch/swagger-rs#112

There's a couple of minor core changes to InlineModelResolver - @OpenAPITools/generator-core-team:

  • If we get a model named 12345AnyOfObject, rename it to _12345AnyOfObject, not _2345AnyOfObject.

    This means for Rust Server, it'll end up as Model12345AnyOfObject, instead of Model2345AnyOfObject, which is nonsensical.

    ⚠️ I think this is technically breaking, but it's clearly bugged at the moment.

  • Perform inline model resolution for enums, and pass the type through when performing inline model resolution.

There's a couple of minor fixups in Rust Server:

  • Some minor template tweaking, including putting the IntoHeader implementation below the model definition.

  • Update the supported features - we've support XML Structure Definition for a while - but the global feature flag is wrong - see user feedback in [REQ] [rust] Support XML objects in requests and responses #5594.

  • Handle FromStr properly, which breaks for the oneOf model otherwise.

Optimistically, I'd like to merge this before 5.0 gets cut.

This change is by @mirw and myself on behalf of @Metaswitch.

Rust Server Technical Committee

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. 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/config/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@wing328 wing328 modified the milestones: 5.0.0, 5.0.1 Dec 21, 2020
@richardwhiuk
Copy link
Contributor Author

@richardwhiuk richardwhiuk merged commit 5f2ca61 into OpenAPITools:master Jan 23, 2021
@richardwhiuk richardwhiuk deleted the rust-server-any-of branch January 23, 2021 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants