Breaking Changes
Error Handling Changes
- YAML
!!settags now rejected -load_yamlnow validates all YAML input and raises ayaml.YAMLErrorwhen it encounters the unsupportedtag:yaml.org,2002:set(!!set) tag. Previously such input was loaded silently (constructed as a Python set). YAML schemas or sample data that relied on!!settags will now fail to load with an "Unsupported YAML tag" error. This validation runs unconditionally on every YAML load and is not gated behind any opt-in flag (#3447)
Code Generation Changes
- msgspec.Struct boolean const fields now generate
boolinstead ofLiteral[True]/Literal[False]- When generatingmsgspec.Structmodels (--output-model-type msgspec.Struct), a JSON Schemaconstwith a boolean value now produces a plainbooltype instead of a booleanLiteral, because msgspec does not support booleanLiteraltag values at runtime. Output for other model types (e.g. Pydantic) is unchanged. Existing msgspec users with boolean-const fields will see different generated output. (#3462) - msgspec.Struct combined object unions now render as tagged Struct unions - For
msgspec.Structoutput, combined (oneOf/anyOf) object schemas that share a required literal discriminator field with int/str values now have a discriminator inferred and are emitted as taggedStructunions (tag_field=...,tag=...). This changes the generated class definitions for existing msgspec users whose schemas match this shape. (#3462)
What's Changed
- Update CHANGELOG for 0.64.1 by @dcg-generated-docs[bot] in #3439
- Fix release draft breaking change notes by @koxudaxi in #3440
- Update CHANGELOG for 0.64.1 by @dcg-generated-docs[bot] in #3441
- Add inferred union variant names by @koxudaxi in #3442
- Add model metadata output by @koxudaxi in #3443
- Add model name mapping by @koxudaxi in #3444
- Handle nested schema namespaces by @koxudaxi in #3445
- Resolve external discriminator mappings by @koxudaxi in #3446
- Unify JSON config loading by @koxudaxi in #3451
- Add RootModel sequence methods option by @koxudaxi in #3447
- Add dynamic model module names and filtering by @koxudaxi in #3448
- Sync generated docs by @dcg-generated-docs[bot] in #3452
- Skip YAML tag scan without unsupported markers by @koxudaxi in #3454
- Sync generated docs by @dcg-generated-docs[bot] in #3455
- Skip full schema dumps for type constraints by @koxudaxi in #3456
- Skip typeguard when importing inflect by @koxudaxi in #3458
- Reuse loaded sources for local refs by @koxudaxi in #3459
- Reduce startup imports by @koxudaxi in #3460
- Optimize field import collection by @koxudaxi in #3461
- Fix msgspec tagged union validation by @koxudaxi in #3462
- Document fast formatter choices by @koxudaxi in #3463
- Add architecture documentation by @koxudaxi in #3464
- Reuse validated JSON Schema objects by @koxudaxi in #3466
- Reuse validated schema definitions by @koxudaxi in #3467
- Revert schema object reuse by @koxudaxi in #3469
Full Changelog: 0.64.1...0.65.0