Skip to content

Releases: gpu-cli/openapi-to-rust

v0.1.15

06 May 18:26

Choose a tag to compare

Two follow-ups to issue #7 that surfaced after 0.1.14:

  • anyOf with {"type": "null"} and 3+ variants previously panicked with "()" is not a valid Ident because the null branch produced a phantom () type alias. analyze_anyof_union now filters {"type": "null"} variants up front, mirroring the oneOf fix.
  • oneOf with an array variant whose items reduce to serde_json::Value (e.g. items: {}) previously emitted Vec<SerdeJsonValue>. The generator now emits Vec<serde_json::Value> (and Vec<Vec<serde_json::Value>>) as path tokens instead of mangling the :: into a single ident.

Fixes #7.

v0.1.14

06 May 06:11

Choose a tag to compare

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.

v0.1.3

04 Apr 23:14
230becf

Choose a tag to compare

What's New

Bug Fixes (#2)

  • Resolve $ref parameter references — Parameters defined via $ref in components/parameters are now properly resolved before extraction
  • Merge path-item-level parameters — Parameters defined at the PathItem level are now inherited by all operations on that path (operation-level params take precedence per the OpenAPI spec)
  • Fix url variable name collision — Renamed internal URL construction variable to request_url to avoid shadowing when an operation has a parameter named url

Improvements (#3)

  • Use raw identifiers for Rust keywords — Fields like type now generate r#type instead of type_, producing more idiomatic Rust code

New Features

  • Operation registry generator — New registry_generator that emits static operation metadata (method, path, params, body, response schema) for CLI/proxy routing use cases
  • Robust YAML/JSON parsing — Handle integers exceeding i64/u64 range, lossy JSON fallback for specs with large numbers
  • 50+ real-world OpenAPI specs — Added specs from Stripe, GitHub, Cloudflare, OpenAI, and more with download script and batch test harness

Breaking Changes

  • Generated field names for Rust keywords changed from type_ to r#type (affects consumers of generated code)
  • Info.version is now Option<String> instead of String