Skip to content

showObjectSchemaExamples doesn't render examples for object properties #2610

@kai687

Description

@kai687

Describe the bug

With the option showObjectSchemaExamples set to true, I only see Example: [object Object] in the description for objects. Other examples, like strings, render fine.

Used [email protected].

Expected behavior

I expected the provided examples for properties of type object to be rendered out.

Example OpenAPI schema
openapi: 3.1.0
info:
  title: Minimal POST API
  version: 1.0.0
paths:
  /example:
    post:
      summary: Example request
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Request body
              properties:
                config:
                  type: object
                  description: Config object
                  example:
                    language: German
                    mode: slow
                  properties:
                    language:
                      type: string
                      description: Language setting
                    mode:
                      type: string
                      enum:
                        - fast
                        - normal
                        - slow
      responses:
        "200":
          description: Success

Screenshots

Image

Additional context

While for objects with defined properties, I can just provide the examples with the properties,
but for objects that accept additionalProperties, it'll be difficult.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions