Skip to content

Default Parameter Value Not Prefilled in “Send API Request” Block #1079

@oleksandrh-gh

Description

@oleksandrh-gh

Describe the bug

When using the “Send API Request” block, the default value of a parameter (if defined in the OpenAPI schema) is not prefilled in the input field. This forces users to manually enter the value, even when a default is explicitly set.

Expected behavior

If a parameter has a defined default value in the OpenAPI schema, the input field should automatically be prefilled with that value. For enum parameters, the default option should be preselected.

Possible solution

Respect the default value and prefill proper input or select in case of enum with that value

Steps to reproduce

  1. Define an OpenAPI schema with a parameter that includes a default value:
  /pet:
    post:
      tags:
        - pet
      summary: Add a new pet to the store
      description: Add a new pet to the store
      operationId: addPet
      parameters:
       - in: query
         name: limit
         required: true
         schema:
          type: number
          default: 10
  1. Generate the API documentation page.
  2. Check the input field for the limit query parameter in the “Send API Request” block.

Screenshots

Image

Context

It is annoying to force a user to choose the right value for the parameter, especially in cases when there is one possible value for the parameter, but the parameter is required

Your Environment

Irrelevant to the environment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions