Releases: barbacane-dev/typify
v1.0.0 — first major release of the barbacane-dev fork
First major release of the barbacane-dev fork. Aggregates every fix and feature carried since the 0.6.1 upstream baseline. Bumped to 1.0.0 to signal that this fork is now an independent line of development with at least one wire-format breaking change.
Install
[dependencies]
typify = { git = "https://github.com/barbacane-dev/typify", tag = "v1.0.0" }For the CLI:
$ cargo install --git https://github.com/barbacane-dev/typify --tag v1.0.0 cargo-typifyNew features
- JSON Schema 2020-12 and 2019-09 support via automatic normalization (
$defs,prefixItems,dependentRequired,dependentSchemas,unevaluatedProperties,$dynamicRef) — oxidecomputer#579 - External
$refsupport: reference types in other schema files — oxidecomputer#201, oxidecomputer#933 - Non-
$defsinternal$refsupport: any JSON Pointer path — oxidecomputer#828 if/then/elsesupport via transformation tooneOf— oxidecomputer#480- New API:
TypeSpace::add_schema_from_value()— auto-detects and normalizes any JSON Schema draft - New API:
TypeSpace::add_schema_with_externals()— handles multi-file schema bundles cargo typifyCLI: auto-discovers external schemas from the input directory; new--schema-dirflag; transparent 2020-12 normalization
Bug fixes
- Fix untagged enum variant ordering: Integer now comes before Number — oxidecomputer#991
- Honour the JSON Schema
requiredcontract on serialization for fields whose Rust type has an intrinsic default (Vec,HashMap,Option<T>). Wire-format change — see migration notes below. - Generate
Defaultimpl for structs where all required fields have explicit defaults — oxidecomputer#918 - Generate
TryFrominstead ofFromfor bounded integer newtypes — oxidecomputer#986 - Render integer
minimum/maximumas integers (not floats) in doc comments — oxidecomputer#843 - Handle special characters in enum variant names (
=,>,≥, etc.) without panicking — oxidecomputer#948 - Replace broken
anyOfflattened struct with proper untagged enum generation — oxidecomputer#414, oxidecomputer#895, oxidecomputer#710, oxidecomputer#790 - Replace
patternPropertiesandpropertyNamesassertion panics with best-effort behaviour — oxidecomputer#882 - Select smallest integer type for bounded ranges (e.g.,
[1..32]→NonZeroU8) — oxidecomputer#975 - Replace panics in
notschema handling with graceful fallback toserde_json::Value— oxidecomputer#954, oxidecomputer#489, oxidecomputer#435 - Replace panics in
ref_key()andconvert_reference()with proper error returns - Generate Rust tuples from 2020-12
prefixItems+items: false— oxidecomputer#955 - Preserve multi-type
type: [a,b,c]unions when schema also has subschemas — oxidecomputer#954 - Bundle internal sibling refs inside external schemas correctly
Chores
- Replace deprecated
tempdirdev-dependency withtempfile, clearing RUSTSEC-2023-0018 (remove_dir_allrace-condition CVE) and RUSTSEC-2018-0017.
Migration notes from 0.6.1
Wire-format change: when the schema marks a field required but its Rust type has an intrinsic default (Vec, HashMap, Option<T>), the generated code no longer emits skip_serializing_if. Deserialize stays lenient; serialize now always renders the field, satisfying the schema's required contract.
For schema { required: ["tags"], properties: { tags: { type: "array" } } } and value Foo { tags: vec![] }:
| 0.6.1 | 1.0.0 | |
|---|---|---|
Deserialize {} |
OK | OK |
Serialize Foo { tags: vec![] } |
{} |
{"tags":[]} |
Snapshot tests and diff-based consumers will see previously-omitted required fields appear as [], {}, or null. Round trips are now lossless.
Relationship to upstream
This release is based on oxidecomputer/typify 0.6.1. The barbacane-dev fork is an independent line of development; see the README for full attribution.
Full diff: v0.6.1...v1.0.0