Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report - Examples Pre-populating parameters #762

Closed
hansena opened this issue Jun 2, 2022 · 2 comments
Closed

Bug Report - Examples Pre-populating parameters #762

hansena opened this issue Jun 2, 2022 · 2 comments

Comments

@hansena
Copy link

hansena commented Jun 2, 2022

Expected Behavior: parameter examples display as help text below the parameter field in the request pane and are used to populate request fields when the 'fill example' button is clicked.

Actual Behavior:

  • array examples on array parameters pre-populate the field on load.
  • boolean true examples pre-populate the field on load.
  • boolean false examples do not appear as help text below the field.

Reproduction:

{
  "openapi": "3.0.2",
  "info": {
    "title": "Minimum Reproduction"
  },
  "paths": {
    "/path": {
      "get": {
        "operationId": "get.path",
        "parameters": [
          {
            "name": "param1",
            "in": "query",
            "description": "string examples on array params operate as expected.",
            "required": false,
            "style": "form",
            "explode": true,
            "schema": { "type": "array", "items": { "type": "string" } },
            "example": "example"
          },
          {
            "name": "param2",
            "in": "query",
            "description": "array examples on array params un-expectedly pre-populate the field with the given value(s).",
            "required": false,
            "style": "form",
            "explode": true,
            "schema": { "type": "array", "items": { "type": "string" } },
            "example": ["example1", "example2"]
          },
          {
            "name": "param3",
            "in": "query",
            "description": "boolean `true` examples un-expectedly pre-populate the field as well.",
            "required": false,
            "style": "form",
            "explode": true,
            "schema": { "type": "boolean" },
            "example": true
          },
          {
            "name": "param4",
            "in": "query",
            "description": "boolean `false` examples don't pre-populate the field, but they fail to render as an example.",
            "required": false,
            "style": "form",
            "explode": true,
            "schema": { "type": "boolean" },
            "example": false
          }
        ]
      }
    }
  }
}

screenshot

@mrin9
Copy link
Collaborator

mrin9 commented Jun 12, 2022

First of all thanks for putting up a nice test case and the screenshots !!!

However there is a little misunderstanding on how the feature works

Here is what is expected

  • if you specify an example for a parameter it will always be filled
  • if you do not want to fill the examples by default then set the attribute fill-request-fields-with-example = 'false'

Having said that, the feature is little buggy, which will be fixed

@mrin9 mrin9 closed this as completed in 145a5ce Jun 12, 2022
@mrin9
Copy link
Collaborator

mrin9 commented Jun 12, 2022

here is the test case
https://rapidocweb.com/examples/fill-example-test.html

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

No branches or pull requests

2 participants