Skip to content

fix(differs.openapi): classify response enums by output compatibility - #59

Merged
omermorad merged 1 commit into
nextfrom
fix/response-enum-compatibility
Nov 8, 2026
Merged

omermorad merged 1 commit into
nextfrom
fix/response-enum-compatibility

Conversation

@omermorad

Copy link
Copy Markdown
Contributor

Change

Classify response enum widening as breaking and narrowing as non-breaking, including adding/removing the enum or const constraint. Preserve request compatibility and keep const replacements breaking in both directions. This follows compatible API extension guidance: existing clients may validate responses against their original enum.

Validation

pnpm build, pnpm lint, and pnpm test pass (30 tests, including 16 new directional cases). pnpm test:e2e passes (361 passed, 1 skipped). The regression suite fails 6 cases against the previous classifier. git diff --check passes.

Release impact

Corrects response enum severity and resulting version bump recommendations. No package versions changed. Consumers of published @contractual/differs.openapi@0.1.0-beta.2 still need a separately approved package/action release containing this fix; this PR does not authorize publishing or tag changes.

@omermorad omermorad changed the title fix(openapi): classify response enums by output compatibility fix(differs.openapi): classify response enums by output compatibility Nov 8, 2026
@omermorad omermorad self-assigned this Nov 8, 2026
@omermorad
omermorad requested a review from qballer November 8, 2026 19:20
@omermorad
omermorad merged commit a89e95c into next Nov 8, 2026
9 of 10 checks passed
@omermorad
omermorad deleted the fix/response-enum-compatibility branch November 8, 2026 19:21
omermorad added a commit that referenced this pull request Nov 9, 2026
## Change

Fix enum compatibility false negatives following #59. The shared walker
retains simultaneous enum and const changes, so response `const: a` →
`enum: [a, b]` and input `enum: [a, b]` → `const: a` require major
bumps.

Preserve minor recommendations for equivalent const/singleton-enum
substitutions. Equivalence is proven from both schema objects inside the
walker, including JSON object key-order independence; raw changes remain
complete. Coexisting constraints and unrelated same-name parameters
cannot share equivalence evidence. JSON arrays and objects with numeric
keys remain distinct values. Object comparisons require matching own
keys, including JSON `__proto__` properties, so inherited properties
cannot prove equivalence.

Treat enum changes inside actual `oneOf` branches conservatively as
breaking: exactly-one matching defeats branch-local subset reasoning.
Equivalent substitutions remain compatible. Escape parameter names so
names containing `/oneOf/0/` cannot imitate composition paths.

## Validation

`pnpm build`, `pnpm lint`, changed-file ESLint, and `pnpm test` pass (46
tests). `pnpm test:e2e` passes (361 passed, 1 skipped). The original six
interaction regressions fail against the previous implementation.
Independent rereview passed 51 tests/probes, including the original
findings, same-name query/header collision, and 100
enum/const/coexisting-constraint pairs; no actionable findings remain.
`git diff --check` passes.

## Release impact

Corrects missed changes, retains equivalent substitutions, and makes
enum changes under `oneOf` conservative without proving branch
disjointness. No package versions changed. Published consumers require a
separately approved package/action release containing the fix; this PR
does not authorize publishing, tags, or merging.
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