Skip to content

Conversation

@Aggarwalmansi
Copy link

Summary

getExampleData previously returned only the first entry when multiple examples were provided.
This caused example information to be lost and limited downstream features that rely on preserving all examples.

This PR updates the behavior to retain all examples when multiple are defined, while keeping existing behavior unchanged for single or empty example definitions.

What changed

getExampleData now:

returns a single value when exactly one example is defined (unchanged behavior)

returns an object map when multiple examples are defined

returns an empty string when no examples are present (backward compatible)

Why this matters

Enables accurate handling of OpenAPI examples objects

Prevents silent loss of example data

Unblocks future work around generating multiple response examples (e.g. parameter-based permutations)
Tests

Added unit tests covering:

empty example object (legacy behavior)

multiple examples preservation (new behavior)

All existing tests continue to pass.

Scope

This change is intentionally limited to schemaUtils.getExampleData
and does not modify request/response generation logic.

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