-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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-server] Restore newtype and XML support #1705
Conversation
This breaks the examples rather spectacularly, though.
Rather than re-writing fromRequestBody wholesale, we instead just subclass it. We now run the superclass method. By detecting whether the superclass method has just unwrapped an inner type it should not have, we can then perform the appropriate fiddling to undo the unwrapping.
Meaning that the other can test our behaviour in the absence of XML.
👍 Thanks for opening this issue! Please review the labels and make any necessary changes. |
Hmm. It looks as if #1296 may have broken this PR (I was working off master from early November). |
Indeed - this patch relies on having the original type wrappers for arrays available, so that we can hang XML-handling code off them. It looks as if https://github.com/OpenAPITools/openapi-generator/pull/1296/files#diff-bd1652e990ffe227072a5c8908fd3054R442 is stripping out those wrappers, and hence breaking this PR. I'm not immediately sure how to handle. This stripping happens early enough in openapi-generator that I can't see an easy way of working around it. |
@bjgill What about setting the |
Interesting. I was unaware of that option. I don't know what it is, but it certainly sounds promising. In any case, I'm probably not going to have time to look at this PR in the near future. I'm happy to leave for another week or two in case someone else wants to pick this work up. Otherwise, I'll close this PR. |
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
,. Default:3.4.x
,4.0.x
master
.Description of the PR
As part of the migration from swagger-codegen to openapi-generator, the
rust-server
generator lost support for newtypes (e.g.pub struct OuterString(String)
). Partly as a consequence, XML support was also broken.This PR undoes the change made by the default generator to unwrap references. This restores the old behaviour of
rust-server
.I've added in a sample to verify the XML behaviour. We've also successfully used this branch to generate a Rust client for one of our services currently migrating from swagger-codegen to openapi-generator.
This will be my final PR to openapi-generator on behalf of @Metaswitch. I am leaving the company at the end of the year. @rjw2 will be taking over my role in handling upstream contributions
Fixes #1590