fix(oas3): switching media types should update schema properties (#6518)
* When the media-type is changed, there is a new `onChangeMediaType` method to handle actions. * If target schema properties key/value pairs does NOT equals current schema properties, clear the requestBodyValue, try-it-out request/response and validation params. * If target schema properties key/value pairs DOES equals current schema properties, do not change or re-render schema properties * oas3Selector `validateShallowRequired` now also validates required keys against target media-type Fixes #6201, #6250, #6476
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: Switching between multiple content-type test
|
||||
version: 1.0.0
|
||||
servers:
|
||||
- url: https://httpbin.org
|
||||
paths:
|
||||
/post:
|
||||
post:
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Bar'
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Foo'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/FooBar'
|
||||
responses:
|
||||
'200':
|
||||
description: ok
|
||||
|
||||
components:
|
||||
schemas:
|
||||
Foo:
|
||||
type: object
|
||||
properties:
|
||||
foo:
|
||||
type: string
|
||||
example: ''
|
||||
Bar:
|
||||
type: object
|
||||
required: [bar]
|
||||
properties:
|
||||
bar:
|
||||
type: integer
|
||||
example: 1
|
||||
FooBar:
|
||||
type: object
|
||||
required:
|
||||
- bar
|
||||
properties:
|
||||
foo:
|
||||
type: string
|
||||
example: ''
|
||||
bar:
|
||||
type: integer
|
||||
example: 1
|
||||
Reference in New Issue
Block a user