Closed mattChiaravalloti closed 4 months ago
@abr-egn Thanks for the quick review! 2 questions:
- Does the lint failure matter for this PR? It's failing on master as well so I figure this is acceptable but lmk!
Nope, this failure is unrelated to your PR. Thanks for checking though :)
- Since I do not have write-access, would you mind merging this for me?
Done!
This PR updates the extended JSON deserializer to support the
$uuid
documented here. As noted in the ticket, this behavior now required for the Atlas SQL team. I confirmed locally that this change works for our purposes.Looking through the code, it seems
$uuid
is supported in several other places but not for directserde_json::from_str::<bson::Bson>
parsing. I assume this was an accidental omission and not a deliberate choice.I was unsure exactly where/how to test this. I spent a lot of time looking through the test files but I never quite figured out how/where/if you are testing this specific behavior (parsing extended json strings directly into
Bson
values), so I added a single, simple unit test to cover this. Let me know if testing should be done elsewhere or another way.Edit: To be clear, our actual use case is using
serde_yaml
to parse yaml files that contain extended json values. The files are parsed into structs that have nestedBson
fields, which is why this change is relevant and why we can't conveniently use the workaround of parsing into aserde_json::Value
and then usingTryFrom<serde_json::Value> for Bson
. I updated the description to be a bit more lax to make this clear.