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

Response examples do not respect media-type #6442

Closed
mathis-m opened this issue Sep 28, 2020 · 0 comments · Fixed by #6456
Closed

Response examples do not respect media-type #6442

mathis-m opened this issue Sep 28, 2020 · 0 comments · Fixed by #6456

Comments

@mathis-m
Copy link
Contributor

mathis-m commented Sep 28, 2020

Q&A (please complete the following information)

OS: [e.g. macOS] Windows 10 Pro
Browser: [e.g. chrome, safari] chrome
Version: [e.g. 22] Version 85.0.4183.102 (Official Build) (64-bit)
Method of installation: [e.g. npm, dist assets] raw code
Swagger-UI version: [e.g. 3.10.0] master
Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0] 3.0.1

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.1
info:
  title: Example Swagger
  version: '1.0'
servers:
  - url: /api/v1
paths:
  /xmlTest:
    get:
      summary: subscribes to a siri vm stream
      operationId: registerSubscription
      parameters: []
      responses:
        '200':
          description: Simple example
          content:
            application/xml:
              schema:
                type: object
                xml:
                  name: root
                properties:
                  x:
                    type: string
                example: 
                  x: what the f
              examples:
                x2:
                  summary: "xml not rendered via 'examples' keyword"
                  value:
                    x: should be xml

Describe the bug you're encountering

When providing examples via examples or example keyword for responses it will not be rendered according to media-type.

To reproduce...

Open yaml at editor and try to view xml response sample. You can delete the examples part and it will render it in xml.

Expected behavior

Examples provided via examples definition should be rendered respecting the content-type.

Screenshots

With examples:
image
Without examples, ok:
image

Additional context or thoughts

@mathis-m mathis-m changed the title 'Examples' keyword definitions can not be rendered as xml Response examples do not respect media-type Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants