Avoid inlining schemas in internally-tagged enum newtype variants (#355)

Schemas are still inlined in some cases, e.g. when the inner type has `deny_unknown_fields`, because then `$ref` would cause an unsatisfiable schema due to the variant tag not being allowed
This commit is contained in:
Graham Esau 2024-11-25 10:26:37 +00:00 committed by GitHub
parent e5168819a4
commit 95023c2ab0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 278 additions and 62 deletions

View file

@ -10,6 +10,7 @@
- MSRV is now 1.70
- [The `example` attribute](https://graham.cool/schemars/deriving/attributes/#example) value is now an arbitrary expression, rather than a string literal identifying a function to call. To avoid silent behaviour changes, the expression must not be a string literal where the value can be parsed as a function path - e.g. `#[schemars(example = "foo")]` is now a compile error, but `#[schemars(example = foo())]` is allowed (as is `#[schemars(example = &"foo")]` if you want the the literal string value `"foo"` to be the example).
- For newtype variants of internally-tagged enums, prefer referencing the inner type's schema via `$ref` instead of always inlining the schema (https://github.com/GREsau/schemars/pull/355)
### Fixed