-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fields inside untagged enum #9
Comments
You have x-nullable inside something that is being deserialized as ReferenceOr. The untagged enum is equivalent to deserializing everything in the object to a format-independent variation of serde_json::Value and sequentially attempting to deserialize the Value to each possible untagged variant. It looks like you are expecting to identify ReferenceOr::Reference based on presence of a $ref field. If $ref is guaranteed to be first field, you can write a Deserialize impl which looks for it as the first field to decide whether to deserialize as Reference or Item. If it is not guaranteed to be the first field, there is no way you can avoid deserializing previous fields while looking for $ref, including fields that you don't end up putting into ReferenceOr::Item after not finding a $ref. |
Thank you for digging into it and the explanation. 💟 You renamed this the issue title, so I assume you wish to keep it open. |
-- ❤️ --> Serde is amazing! Thank you for making it.
I wrote an assert_deserialized_without_ignored, hoping that it would catch anything that is ignored, but it misses many items. Did I misunderstand something?
See ctaggart/autorust_openapi#3 (comment) for a specific case about
x-nullable
not showing up as ignored for https://github.com/Azure/azure-rest-api-specs/blob/master/specification/batch/data-plane/Microsoft.Batch/stable/2020-09-01.12.0/BatchService.json.The text was updated successfully, but these errors were encountered: