-
Notifications
You must be signed in to change notification settings - Fork 117
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
okapi: fix deserialisation for openapi3 'extensions' fields #108
base: master
Are you sure you want to change the base?
Conversation
The 'extensions' fields of various structs within okapi/src/openapi3.rs was not deserialized correctly. This commit fixes the behavior if the Object is an indexmap. Using rocket_okapi enables the feature 'preserve_order' by default and hence an indexmap is used. If the feature 'preserve_order' is disables, this commit should not change the behavior. Belongs to GREsau#67 Signed-off-by: Philippe Schaaf <[email protected]>
IndexMap has a custom serde function: https://docs.rs/indexmap/latest/indexmap/serde_seq/index.html |
@GREsau does it make sens to you to provide a serde_seq module via the schemars crate depending on the cfg feature? IMO this would be a cleaner way of achieving the desired de-/serialization in a feature-aware way and importing the indexmap crate would not be needed any longer. My suggestion: GREsau/schemars#161 |
So the problem is that the |
Signed-off-by: Simon Bechstedt <[email protected]>
Use patched version until PR GREsau/schemars#161 is merged. Signed-off-by: Simon Bechstedt <[email protected]>
084a824
to
0237c8a
Compare
Signed-off-by: Simon Bechstedt <[email protected]>
…fix-indexmap-serde
The 'extensions' fields of various structs
within okapi/src/openapi3.rs was not
deserialized correctly.
#[serde(flatten)]
was empty.
The 'extensions' fields used a custom type 'Object'.
'Object' is an alias for IndexMap or BTreeMap depending
on feature 'preserve_order'. Deserialisation should work for both.
Using rocket_okapi enables the feature 'preserve_order'
by default.
Belongs to #67