Closed swlynch99 closed 9 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
6ecde3c
) 65.16% compared to head (1c9131f
) 65.16%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
The
#[schemars]
annotation emitted by#[serde_as]
will cause errors if the user has already added an existing#[schemars(with = ...)]
annotation. This ends up being rather annoying since there's no way to work around the error other than to manually expand what#[serde_as]
does.I ended up running into this when I was trying to convert some of my existing code to use the new integration instead of manually sticking
#[schemars(with = "blah")]
everywhere.This PR fixes the issue by making
#[serde_as]
avoid emitting the schemars attribute if there is an existing one of the field that specifies any one of#[schemars(with = "...")]
#[schemars(serialize_with = "...")]
#[schemars(deserialize_with = "...")]
The actual code is a bit more involved (e.g.
serialize_as
doesn't conflict with#[schemars(deserialize_with = "...")]
) but that's the gist of it.I have also included a test case to validate that this works as expected.