Request Body examples should respect media-type (#6739)

* fix: request body.jsx should rely on the getSampleSchema utility

* test: add test to ensure xml request body
This commit is contained in:
Mahtis Michel
2021-01-04 19:23:23 +01:00
committed by GitHub
parent f35acced49
commit 68e9b1b439
3 changed files with 151 additions and 34 deletions

View File

@@ -0,0 +1,57 @@
openapi: 3.0.1
info:
title: Example Swagger
version: '1.0'
servers:
- url: /api/v1
paths:
/xmlTest/examples:
post:
summary: sample issues
operationId: xmlTest_examples
parameters: []
requestBody:
description: Simple Test xml examples
content:
application/xml:
schema:
$ref: "#/components/schemas/Test"
examples:
test:
value:
x: should be xml
responses:
'200':
description: Simple Test xml examples
content: {}
/xmlTest/example:
post:
summary: sample issues
operationId: xmlTest_example
parameters: []
requestBody:
description: Simple Test xml example
content:
application/xml:
schema:
$ref: "#/components/schemas/Test"
example:
x: should be xml
responses:
'200':
description: Simple Test xml example
content: {}
components:
schemas:
Test:
type: object
xml:
name: root
properties:
x:
type: string
other:
type: string
format: email
example:
x: what the f