Open andrieshiemstra opened 2 years ago
Hmm, looks indeed like it is doing something wrong in the default Serde parser. I think this is because of the #[serde(flatten)]
.
Looks like we might need to add #[serde(skip_deserializing)]
to https://github.com/GREsau/okapi/blob/master/okapi/src/openapi3.rs#L272:L273
But would have to look at it when I have some more time to be sure this solves it and does not create other problems. The pub extensions: Object,
is part of more items, so a fix for 1 can then also be applied to all the other once that have a double #[serde(flatten)]
.
(PR is always welcome)
For the moment i'm fixing this post-deser.. which for now is fine for me
Simply ignoring extensions when deserializing seems a bit drastic, so my first thought was to create a simple custom deserializer which ignores the fields already added to flattened ParameterValue enum..
But that got me thinking if this isn't actualy a bug in serde as i don't see how passing a deserialized field to two different flattened members will ever result in a valid structure when serializing again....
When deserializing from json the schemas from a param also get added to the extensions object of a param, resulting in faulty json being outputted when serializing again (schema attribute is added twice)
results in
The same happens when deserializing an operation with responses, deserializing and serializing this
results in this