swagger-editor
swagger-editor copied to clipboard
oneOf fails to render response body when application type is XML
Q&A (please complete the following information)
- OS: Ubuntu
- Browser: Chrome
- Version: 18.04
- Method of installation: ?
- Swagger-Editor version: ?
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Example Swagger/OpenAPI definition:
openapi: 3.0.0
info:
description: Test API
version: v1
title: Test API
tags:
- name: Test
description: Test API
servers:
- url: /v1
paths:
/test:
post:
tags:
- Test
summary: Test endpoint
description: Test
operationId: postTest
responses:
'200':
description: Returns response
content:
# Rendered successfully
# application/json:
# schema:
# oneOf:
# - $ref: '#/components/schemas/test'
# Rendered successfully
# application/xml:
# schema:
# $ref: '#/components/schemas/test'
# Rendered Failed!
application/xml:
schema:
oneOf:
- $ref: '#/components/schemas/test'
components:
schemas:
test:
type: object
properties:
a:
type: string
example: "test"
b:
type: integer
example: 1
Describe the bug you're encountering
If I add oneOf
, it fails to render the response body when the application type is XML but it successfully renders when the application type is JSON. Therefore I believe this unexpected behavior is a bug.
To reproduce...
Steps to reproduce the behavior:
- Go to https://editor.swagger.io/
- Copy-paste the YAML above
- See the bug
Expected behavior
Successfully rendering the XML response.
Actual behavior
Displaying (no example available)
Additional context or thoughts
If I change the application type to JSON
then it renders the body successfully.