Skip to content

Use schema.example values instead of schema.default in API playground pre-fill #1807

@vollmarj

Description

@vollmarj

Description:
The API playground currently uses schema.default values to pre-fill request parameters, which creates a poor UX when developers want to quickly test endpoints. This forces documentation authors to choose between two bad options:

  1. Set incorrect "default" values just to make the playground work
  2. Leave the playground with empty/invalid parameters that require manual input

Proposed Solution:
Change the API playground to prioritize schema.example values over schema.default values when pre-filling request parameters. This would allow developers to hit "play" and immediately send a valid request with meaningful test data.

Expected Behavior
When both schema.example and schema.default exist, use schema.example for playground pre-fill
Fall back to schema.default only when no example is provided
This maintains semantic correctness while improving the testing workflow

Current Behavior
The playground displays schema.default values as implemented in #1065, which prioritizes showing actual default values rather than example values.

Impact
This change would significantly improve the developer experience by enabling one-click API testing with realistic data while maintaining proper OpenAPI schema semantics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions