rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.71k stars 285 forks source link

Arrays do not display examples #39

Closed muttleyxd closed 5 years ago

muttleyxd commented 5 years ago

I didn't find a way to display array items as an example.

openapi: 3.0.0
info:
  description: Some description
  version: 0.0.1
  title: Some title

tags:
  - name: hello

paths:
  "/there":
    get:
      operationId: helloThereGet
      tags:
        - hello
      summary: Do something
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ComplicatedResponse"
servers:
  - url: http://localhost:8080
components:
  schemas:
    ComplicatedResponse:
      type: object
      properties:
        stringProperty:
          type: string
          example: hello
        arrayStringProperty:
          type: array
          items:
            type: string
          example:
            - Some
            - Nice
            - Array

Expected result: rapidoc_expected

Actual result: rapidoc_actual

muttleyxd commented 5 years ago

Okay, I've just realized that I can do examples like that

    ComplicatedResponse:
      type: object
      properties:
        stringProperty:
          type: string
        arrayStringProperty:
          type: array
          items:
            type: string
      example:
        - stringProperty: hello
          arrayStringProperty:
            - Some
            - Nice
            - Array