Skip to content

fix(http): honor schema examples on anyOf static mocks - #2855

Open
breken-ai wants to merge 1 commit into
stoplightio:mainfrom
breken-ai:fix/2726-honor-union-property-examples
Open

breken-ai wants to merge 1 commit into
stoplightio:mainfrom
breken-ai:fix/2726-honor-union-property-examples

Conversation

@breken-ai

Copy link
Copy Markdown

Addresses #2726

Summary

Prism's static sampler walks into anyOf and oneOf before reading examples on the enclosing schema. Promote the first such example to example on a cloned schema before sampling. This leaves the caller's schema and existing example payloads unchanged and preserves current behavior for schemas without unions.

Checklist

  • I tested these changes manually in my local or dev environment. The issue schema now produces {"title":"Some kind of title"} through the static HttpMocker path.
  • Tests: Added or updated. HttpMocker.spec.ts fails on base 2426fc0900717a9039b23fc901885239871143fe ("string" returned) and passes with this change (29 tests, 2 snapshots).
  • Event Tracking: N/A; this change adds no event tracking.
  • Error Reporting: N/A; this change does not change error reporting.

@breken-ai
breken-ai requested a review from a team as a code owner September 28, 2026 03:20
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