Skip to content

Convert nested-intersection-union unit test to a schema fixture test#1

Merged
Ankur Goyal (ankrgyl) merged 1 commit into
braintrustdata:intersection-fixfrom
glideapps:fixture-test-2914
Jul 12, 2026
Merged

Convert nested-intersection-union unit test to a schema fixture test#1
Ankur Goyal (ankrgyl) merged 1 commit into
braintrustdata:intersection-fixfrom
glideapps:fixture-test-2914

Conversation

@schani

Copy link
Copy Markdown

What this does

Converts the Vitest unit test from glideapps#2914 (test/unit/nested-intersection-union.test.ts) into a standard JSON Schema fixture test:

  • Adds test/inputs/schema/nested-intersection-union.schema — a trimmed repro of FlattenUnions fails when unifying an array element union that indirectly contains an intersection. glideapps/quicktype#2913: an intersection (allOf) nested inside a union (oneOf), reached through an array, which crashed FlattenUnions with "Internal error: Unknown type intersection" before the fix on this branch.
  • Adds nested-intersection-union.1.json — positive instance covering all union variants (fully-populated item plus Message-only, FunctionOutput-only, and ReasoningItem-only partials), round-tripped by the harness.
  • Adds nested-intersection-union.1.fail.union.json — negative example (structural mismatch: array where an item object is expected), following the class-map-union fixture precedent.
  • Removes the unit test — it only asserted three substrings in Rust output; the fixture strictly supersedes it: it exercises the fix across every language in CI, with real round-trip verification and a negative case.

Why

quicktype's maintainers prefer regression coverage for type-graph fixes as schema fixtures rather than renderer-output string assertions — fixtures run for all 22 CI target languages automatically, so the fix is exercised end-to-end everywhere, not just in Rust.

Verification

  • Full monorepo build; unit test suite passes after the removal (59/59).
  • All 22 CI target languages generate successfully from the new schema (no skipSchema entries needed).
  • End-to-end fixture harness pass locally for schema-golang and schema-typescript (positive round-trip + expected failure both run); remaining compiled-language toolchains are covered by CI.

Merging this into intersection-fix will update glideapps#2914 automatically.

🤖 Generated with Claude Code

Replace the Vitest unit test (which checked Rust output strings for one
language) with a standard JSON Schema fixture exercising the same shape:
an allOf nested inside a oneOf inside another oneOf, taken from the
issue #2913 repro. The fixture runs against every language in CI,
round-trips a positive instance, and expects failure on a malformed
union member for languages with the "union" feature.

Verified end-to-end locally with schema-golang and schema-typescript;
all 22 CI target languages generate successfully from the schema.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants