Skip to content

v0.1.14

Choose a tag to compare

@lightsofapollo lightsofapollo released this 06 May 06:11

Fix oneOf with {"type": "null"} variants (#7).

Previously, an inline oneOf: [{"type": "null"}, {"type": "string"}] schema generated an untagged enum with a phantom SerdeJsonValue(SerdeJsonValue) variant — a non-existent type produced by mangling serde_json::Value into a single ident. anyOf already handled the same shape correctly.

oneOf now matches anyOf:

  • oneOf: [Type, null] reduces to the non-null type with the property marked nullable (Option<T>).
  • oneOf with 3+ variants including {"type": "null"} filters the null branch out instead of leaking it through.
  • The generator emits serde_json::Value as a path defensively, so any future analyzer path that pushes it as a union variant target stays valid Rust.

Fixes #7.