-
-
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
[Rust] Ignore additional properties #671
[Rust] Ignore additional properties #671
Conversation
// them recognised correctly. | ||
cm.isAlias = false; | ||
cm.dataType = typeMapping.get(cm.dataType); | ||
if (cm.dataType == "map") { |
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.
@bjgill should this be "map".equals(cm.dataType)
instead?
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.
Good point - I'll be consistent with the equivalent 5 lines previously, though - cm.dataType.equals("map")
rust-server doen't yet support them, and they cause quite a bit of havoc at the moment (ending up as the `HashMap` type).
Not sure why travis failed. Doesn't seem to be anything Rust-related, though. Do you have the ability to retry the job?
|
@bjgill Restarted the job. Let's see how it goes |
That passed, thanks. |
* Ignore additionalProperties rust-server doen't yet support them, and they cause quite a bit of havoc at the moment (ending up as the `HashMap` type). * Use .equals() rather than `==`
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
This is a workaround for #318. In swagger-codegen, we did not support
additionalProperties
and so ignored them.In openapi-generator, we now get back a type (
map
), where we got back a null previously.postProcessModels
doesn't have enough context to work out what sort of map is required (we don't know the types of theadditionalProperties
).Thus, this workaround detects this specific failure case and fiddles with the
dataType
to getadditionalProperties
ignored again. This will allow us to generate from specs containingadditionalProperties
and have the resultant crates compile.I've added in a warning to users to let them know what's happening.
I'm building on top of #658 to allow us to add a test to ensure that we don't regress this in future.