Authress-Engineering / openapi-explorer

OpenAPI Web component to generate a UI from the spec.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Examples not used?

splitbrain opened this issue · comments

When adding examples to individual parameters in a requestBody, they seem not to be picked up. The suggested body is still empty:

screenshot-localhost-2023 12 01-17_25_50

When using the swagger editor, the values show up as expected:

screenshot-editor-next swagger io-2023 12 01-17_27_07

Here's the setup (OpenAPI 3.1):

{
  "requestBody": {
    "required": true,
    "content": {
      "application\/json": {
        "schema": {
          "type": "object",
          "properties": {
            "user": {
              "type": "string",
              "description": "The Username",
              "examples": [
                "some-user"
              ]
            },
            "pass": {
              "type": "string",
              "description": "The Password",
              "examples": [
                "some-pass"
              ]
            }
          }
        }
      }
    }
  }
}

There was a protection in place, because we don't want to default certain values. Realistically the defaults should only be restricted to fields that likely end in id, so I'm updating this to enable the other ones to work.