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

Although Supported by JSON Schema, String Array Examples Do Not Display #254

Open
kentbulza opened this issue Mar 31, 2024 · 2 comments
Open

Comments

@kentbulza
Copy link

When examples are included for an array of strings, the examples do not display in the request body schema.

Context

Would like to display examples just like one gets for standard strings. Attached is an example OpenAPI 3.1.0. document demonstrating the issue.
noarrayexamples.example.json

Current Behavior

Array examples do not display.

Expected Behavior

Would like to see array examples.

@brendarearden brendarearden added enhancement New feature or request triaged labels Apr 5, 2024
@daniel-white
Copy link

hey @kentbulza while this is supported in JSON Schema, but we'll take this as an enhancement request of @stoplight/json-schema-viewer. As a workaround, you can declare examples of the array itself.

{
"type": "object",
"properties": {
  "x": {
     "type": "array",
      "items": {
        "type": "string",
        "examples": ["bar"] // Don't use this example here
      },
      "examples": [["foo"], ["abc"]] // Examples here 
  }
}
}

@daniel-white daniel-white transferred this issue from stoplightio/elements Apr 5, 2024
Copy link

github-actions bot commented Apr 8, 2024

This ticket has been labeled jira. A tracking ticket in Stoplight's Jira (STOP-447) has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants