swagger-api / swagger-api/swagger-ui

Option to disable example pre-population in Try It Out feature

Open
#8,276 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

I would like the option to disable pre-populating examples from the spec for OAS 3.0

I have a GET request that allows filtering by many different parameters. When the user clicks 'Try it out' ALL the parameters are pre-populated. There are never any results, due the the sheer number of filtering options selected.

If the user wants to make any meaningful request, they must first go in and remove every single example.

This seems to have been the default for Swagger 2.0, but OAS 3.0 does not seem to have an option.

I've tried changing various settings without success.

The only thing that works is changing the definition from OAS 3.0 to Swagger 2.0. But this obviously isn't a workable solution.

When the spec is defined as OAS 3.0:

{
  "openapi": "3.0.0",
  "paths": {...}
}

Swagger UI defaults to autofill all the examples in Try it Out

When the spec is defined as Swagger 2.0:

{
  "swagger": "2.0",
  "paths": {...}
}

Swagger UI defaults to leave all the examples blank

Notes:

  • The rest of the spec and all settings remain unchanged in the examples above.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/usage/configuration.md and the supportedSubmitMethods configuration referenced in the issue, then reproduce the Try It Out behavior with the provided OAS 3.0 and Swagger 2.0 examples. Done means users can configure OAS 3.0 requests so examples are not pre-populated, while existing behavior remains available when desired.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
api, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.