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

Plaintext examples are ignored #1632

Closed
mpbzh opened this issue Jun 1, 2021 · 4 comments
Closed

Plaintext examples are ignored #1632

mpbzh opened this issue Jun 1, 2021 · 4 comments
Assignees

Comments

@mpbzh
Copy link

mpbzh commented Jun 1, 2021

The following example is a reduced version of my (afaik) valid OpenApi 3 file defining a request body with both application/json and text/plain mimetypes:

openapi: 3.0.3
info:
  title: 'Test API'
  version: 1.0.0
paths:
  /users:
    post:
      summary: 'Missing CSV examples'
      description: 'This demonstrates missing csv examples'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                records:
                  type: array
                  items:
                    $ref: '#/components/schemas/person'
          text/plain:
            schema:
              type: string
              example: "This is a Test"
        required: true
      responses:
        '200':
          description: 'Placeholder response'
components:
  schemas:
    person:
      required:
        - person_id
        - name
      type: object
      properties:
        person_id:
          type: integer
          description: 'Person identifier in source system'
        name:
          type: string
          description: 'Person name'
      example:
        person_id: 1
        name: 'Hello World'

The official Swagger Editor accepts the plaintext example:
swagger-editor

When I generate a standalone HTML file using redoc-cli (Version 0.11.4), the example is ignored:
nosample

Also, but probably due to the same bug, when I remove the application/json

This issue might be related to #371.

@rishagit
Copy link

rishagit commented Sep 8, 2021

Is there any update on this issue? how can we show example for text/plain type?

@edno
Copy link

edno commented Dec 10, 2021

@RomanHotsiy - Do you have an update on the comment you made in #371

ReDoc 2.0 will support all the mime samples correctly so I am not going to fix it properly for ReDoc 1.x

@aman2457
Copy link

aman2457 commented Feb 4, 2022

Is there any update on this issue?
I'm not able to show the examples of text/plain.
@rishagit did you got any solution for this?

@lornajane
Copy link
Contributor

This should be updated in Redoc >=2.0, so I'll close this issue - but please let us know if you're still seeing something that doesn't look right?

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

7 participants