diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 0123b9f645..0be8d7f0d8 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -405,16 +405,36 @@ definitions: oneOf: - $ref: '#/definitions/Example' - $ref: '#/definitions/Reference' - encoding: - type: object - additionalProperties: - $ref: '#/definitions/Encoding' patternProperties: '^x-': {} additionalProperties: false allOf: - $ref: '#/definitions/ExampleXORExamples' + MediaTypeWithEncoding: + type: object + properties: + schema: + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' + example: {} + examples: + type: object + additionalProperties: + oneOf: + - $ref: '#/definitions/Example' + - $ref: '#/definitions/Reference' + encoding: + type: object + additionalProperties: + $ref: '#/definitions/Encoding' + patternProperties: + '^x-': {} + additionalProperties: false + allOf: + - $ref: '#/definitions/ExampleXORExamples' + Example: type: object properties: @@ -763,6 +783,9 @@ definitions: type: object additionalProperties: $ref: '#/definitions/MediaType' + patternProperties: + '^\*\/\*$|^application/x-www-form-urlencoded$|^multipart\/.+$': + $ref: '#/definitions/MediaTypeWithEncoding' required: type: boolean default: false diff --git a/schemas/v3.1/schema.yaml b/schemas/v3.1/schema.yaml index bd1925ca9c..57c2b53eb7 100644 --- a/schemas/v3.1/schema.yaml +++ b/schemas/v3.1/schema.yaml @@ -474,22 +474,34 @@ $defs: type: object additionalProperties: $ref: '#/$defs/media-type' + patternProperties: + '^\*\/\*$|^application/x-www-form-urlencoded$|^multipart\/.+$': + $ref: '#/$defs/media-type-with-encoding' propertyNames: format: media-range - media-type: + media-type-common: $comment: https://spec.openapis.org/oas/v3.1.0#media-type-object type: object properties: schema: $dynamicRef: '#meta' - encoding: - type: object - additionalProperties: - $ref: '#/$defs/encoding' allOf: - $ref: '#/$defs/specification-extensions' - $ref: '#/$defs/examples' + + media-type: + $comment: https://spec.openapis.org/oas/v3.1.0#media-type-object + $ref: '#/$defs/media-type-common' + unevaluatedProperties: false + + media-type-with-encoding: + $comment: https://spec.openapis.org/oas/v3.1.0#media-type-object + $ref: '#/$defs/media-type-common' + type: object + properties: + encoding: + $ref: '#/$defs/encoding' unevaluatedProperties: false encoding: