Repository navigation
fix(generator): preserve owner assertions when deduplicating allOf unions - #107
Merged
Merged
Conversation
An allOf whose members are the same union, once annotations are ignored, failed with "intersects multiple union members". The current Cloudflare spec types its Workers Observability query filters as allOf: [$ref filter_node, anyOf: [group, leaf]], where the inline anyOf repeats filter_node's branches with added descriptions. That error stopped the whole spec from generating. Repeated union members are now dropped before composition, comparing assertions only: annotation keywords are stripped recursively, member names under properties are kept, and `type: object` on the named union is ignored. A restatement next to a single $ref becomes an alias of that schema. Unions that differ still report the diagnostic. The pinned corpus has no such schema, so its output is unchanged.
…f-restated-union-owner-fields
Keep deduplicated allOf compositions with owner properties or required names on the merge path instead of returning a bare alias. Add an anyOf/oneOf member-order matrix and generated recursive-filter round trips with missing-required rejection. Continues Giles Westwood’s work in PR #104; his original commits remain in the branch history.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
lightsofapollo
marked this pull request as ready for review
October 17, 2026 02:54
lightsofapollo
marked this pull request as draft
October 17, 2026 02:59
Only collapse a deduplicated allOf owner when it has no sibling assertions. Preserve object-type and not constraints around mixed object/scalar unions, with JSON Schema witnesses and compiled scalar-rejection coverage. Keep annotation-only owners eligible for aliases.
lightsofapollo
marked this pull request as ready for review
October 17, 2026 03:21
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cloudflare's Workers Observability schemas repeat the same union in
allOf, once by reference and once inline with descriptions. Resolve those restatements instead of rejecting the whole spec, while preserving fields and required names declared besideallOf.This continues Giles Westwood's (@gilesw) work in #104. His three original commits are retained unchanged, including the fixes for assertion data and mixed object/scalar unions. The follow-up commits keep owners with assertion siblings on the normal merge path instead of taking an alias or single-member shortcut that drops their object shape or fields.
Generated compatibility
dependentRequireddata and nonredundant object-type constraints are preserved.tests/corpus-manifest.txtis unchanged (56 specs, 224 files).Validation
anyOf/oneOf, reference/inline member ordering, optional declared fields, required-only fields, and object/scalar unions constrained by the owner.type: objectornotassertions.cargo fmt --check,cargo clippy --all-features -- -D warnings, doctests, and rustdoc with warnings denied pass.cargo nextest run --profile ci --all-featurespassed in CI at the final commit: 743 passed, 7 skipped. Doctests and conformance-report verification also pass.scripts/spec-compile.sh anthropic openai: both generated crates compile and pass schema round trips (1,333 component schemas, 4,984 samples; 64 schema skips).Notes for reviewers
The follow-up change is in
analyze_allof_composition; compositions reduced by union deduplication bypass the collapse shortcuts unless the owner has only annotations besideallOf. Existing scalar/array recovery is unchanged.Use a merge commit when landing to retain Giles's original commit identities and attribution.