Skip to content

Releases: barbacane-dev/typify

v1.0.0 — first major release of the barbacane-dev fork

13 May 09:56
f947665

Choose a tag to compare

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-typify

New features

  • JSON Schema 2020-12 and 2019-09 support via automatic normalization ($defs, prefixItems, dependentRequired, dependentSchemas, unevaluatedProperties, $dynamicRef) — oxidecomputer#579
  • External $ref support: reference types in other schema files — oxidecomputer#201, oxidecomputer#933
  • Non-$defs internal $ref support: any JSON Pointer path — oxidecomputer#828
  • if / then / else support via transformation to oneOfoxidecomputer#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 typify CLI: auto-discovers external schemas from the input directory; new --schema-dir flag; transparent 2020-12 normalization

Bug fixes

  • Fix untagged enum variant ordering: Integer now comes before Number — oxidecomputer#991
  • Honour the JSON Schema required contract on serialization for fields whose Rust type has an intrinsic default (Vec, HashMap, Option<T>). Wire-format change — see migration notes below.
  • Generate Default impl for structs where all required fields have explicit defaults — oxidecomputer#918
  • Generate TryFrom instead of From for bounded integer newtypes — oxidecomputer#986
  • Render integer minimum/maximum as integers (not floats) in doc comments — oxidecomputer#843
  • Handle special characters in enum variant names (=, >, , etc.) without panicking — oxidecomputer#948
  • Replace broken anyOf flattened struct with proper untagged enum generation — oxidecomputer#414, oxidecomputer#895, oxidecomputer#710, oxidecomputer#790
  • Replace patternProperties and propertyNames assertion panics with best-effort behaviour — oxidecomputer#882
  • Select smallest integer type for bounded ranges (e.g., [1..32]NonZeroU8) — oxidecomputer#975
  • Replace panics in not schema handling with graceful fallback to serde_json::Valueoxidecomputer#954, oxidecomputer#489, oxidecomputer#435
  • Replace panics in ref_key() and convert_reference() with proper error returns
  • Generate Rust tuples from 2020-12 prefixItems + items: falseoxidecomputer#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 tempdir dev-dependency with tempfile, clearing RUSTSEC-2023-0018 (remove_dir_all race-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