swagger-api / swagger-api/swagger-ui

Rendering string:string dictionary example in Schemas

Open
#5,307 3 comments 11 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

Q&A (please complete the following information)
  • OS: [e.g. macOS]
  • Browser: [chrome]
  • Version: [73]
  • Method of installation: [editor.swagger.io]
  • Swagger-UI version: [e.g. 3.10.0]
  • Swagger/OpenAPI version: [OpenAPI 3.0]
Content & configuration

Example Swagger/OpenAPI definition:

components:
  schemas:
    Order:
      type: object
      properties:
        testMap:
          type: object
          additionalProperties:
            type: string
          example:
            en-us: Map
            fr: le Map
Describe the bug you're encountering

Per https://swagger.io/docs/specification/data-models/dictionaries/

Examples of Dictionary Contents
You can use the example keyword to specify sample dictionary contents:

type: object
additionalProperties:
type: string
example:
en: Hello!
fr: Bonjour!

UI does not render any of these examples in the schema section, it only shows { < * >: String }

To reproduce...

Steps to reproduce the behavior:

  1. Go to editor.swagger.io
  2. Add a dictionary with examples to a component schema
  3. Look at render
  4. See no examples in the schemas section.
Expected behavior

Component schema preview shows examples in-line.

Screenshots

dictionary

Additional context or thoughts

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

Reproduce the issue in editor.swagger.io with the provided OpenAPI component schema and inspect the schema rendering path for object dictionaries with additionalProperties and example values. Done means the Schemas section displays the supplied en-us and fr example contents inline instead of only showing { < * >: String }.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.