fix(schema example): xml gen should follow json gen behavior (#6555)
* ref: #6470 * fixes: #6540 * fixes: #4943 * add example override option to json * add example override option to xml * added basic oneOf and anyOf support * fix anyof|oneof * only lift xml to items Co-authored-by: Tim Lai <timothy.lai@gmail.com>
This commit is contained in:
43
test/e2e-cypress/static/documents/bugs/4943.yaml
Normal file
43
test/e2e-cypress/static/documents/bugs/4943.yaml
Normal file
@@ -0,0 +1,43 @@
|
||||
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:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/test'
|
||||
components:
|
||||
schemas:
|
||||
test:
|
||||
type: object
|
||||
properties:
|
||||
a:
|
||||
type: string
|
||||
b:
|
||||
type: integer
|
||||
c:
|
||||
oneOf:
|
||||
- type: object
|
||||
- type: array
|
||||
items:
|
||||
type: string
|
||||
- type: boolean
|
||||
- type: integer
|
||||
- type: number
|
||||
85
test/e2e-cypress/static/documents/bugs/6540.yaml
Normal file
85
test/e2e-cypress/static/documents/bugs/6540.yaml
Normal file
@@ -0,0 +1,85 @@
|
||||
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:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/test'
|
||||
components:
|
||||
schemas:
|
||||
test:
|
||||
type: object
|
||||
properties:
|
||||
a:
|
||||
type: string
|
||||
b:
|
||||
type: integer
|
||||
c:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Things'
|
||||
d:
|
||||
type: array
|
||||
items:
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/TextObject'
|
||||
- $ref: '#/components/schemas/ImageObject'
|
||||
|
||||
|
||||
Things:
|
||||
type: object
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/TextObject'
|
||||
- $ref: '#/components/schemas/ImageObject'
|
||||
|
||||
TextObject:
|
||||
required:
|
||||
- data
|
||||
type: object
|
||||
properties:
|
||||
objectType:
|
||||
type: string
|
||||
example: Text
|
||||
xml:
|
||||
name: ObjectType
|
||||
data:
|
||||
type: string
|
||||
example: This is a text
|
||||
xml:
|
||||
name: Data
|
||||
description: Contains a text
|
||||
|
||||
ImageObject:
|
||||
required:
|
||||
- data
|
||||
type: object
|
||||
properties:
|
||||
objectType:
|
||||
type: string
|
||||
example: image
|
||||
xml:
|
||||
name: ObjectType
|
||||
data:
|
||||
type: string
|
||||
example: This is a image
|
||||
xml:
|
||||
name: Data
|
||||
description: Contains a image
|
||||
Reference in New Issue
Block a user