Skip to content

fix(differs.openapi): account for property addition constraints - #63

Merged
omermorad merged 4 commits into
nextfrom
fix/optional-property-compatibility
Nov 10, 2026
Merged

omermorad merged 4 commits into
nextfrom
fix/optional-property-compatibility

Conversation

@omermorad

@omermorad omermorad commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Change

Optional property additions could be classified as nonbreaking even when they invalidate existing consumers. For example, adding task.progress to a response whose old parent has additionalProperties: false permits responses old clients reject; adding a typed request property to an open object rejects values previously allowed under that name.

Carry the actual old/new parent context on named property additions and classify their value constraints in the input/output direction. Respect matching patternProperties, schema-valued additionalProperties, requiredness, Boolean schemas and annotations. Mark non-monotonic or unsupported evaluation contexts conservatively breaking. Context comes from the walker rather than reconstructed display paths, including same-name parameters. The default JSON Schema differ policy is unchanged.

OpenAPI 3.0 nullable types are normalized before implication checks; OpenAPI 3.1 keeps JSON Schema type semantics. Enum constraints remain intact, and cross-dialect comparisons are conservative. Explicit document, ancestor, and embedded JSON Schema dialects are checked before proving property compatibility; unsupported dialects require review. Dialect scanning visits schema locations, preserving ordinary JSON data and properties named $schema.

This is a bounded compatibility proof, not a general JSON Schema subset solver. Complex implications that cannot be proved remain conservatively breaking and may need manual review.

Validation

  • Three focused reproductions failed before the fix; their compatible controls passed.
  • pnpm build, pnpm lint, direct ESLint for all changed files, formatting and whitespace checks passed.
  • pnpm test: 97 passed, including 51 property-addition cases and all 38 existing OpenAPI tests.
  • pnpm test:e2e: 361 passed, one existing skip.
  • Independent validator matrix: 768 cases, no false-negative compatibility classifications found. A separate matrix checked 5,184 nullable/type/enum cases with zero missed breaks. A fresh review also checked 21 schema positions and 13,552 validator cases with zero missed breaks, and reported no remaining actionable findings.
  • Exact platform PR #3206 snapshot replay: 117 changes remain; 22 property additions move to breaking, yielding 55 breaking, 60 nonbreaking and two patch changes. All 33 existing enum findings remain unchanged; the compatible open-object response stats addition stays nonbreaking.

Release impact

OpenAPI consumers can receive a major-bump recommendation for property additions previously labeled nonbreaking. No package versions, release tags or publications are changed in this PR.

@omermorad omermorad self-assigned this Nov 10, 2026
@omermorad
omermorad merged commit b63fd34 into next Nov 10, 2026
10 checks passed
@omermorad
omermorad deleted the fix/optional-property-compatibility branch November 10, 2026 06:46
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.

1 participant