diff --git a/schemas/v3.1/schema.json b/schemas/v3.1/schema.json index 468bc7e5f5..edd6d573fb 100644 --- a/schemas/v3.1/schema.json +++ b/schemas/v3.1/schema.json @@ -840,7 +840,16 @@ }, "minProperties": 1, "$ref": "#/$defs/specification-extensions", - "unevaluatedProperties": false + "unevaluatedProperties": false, + "if": { + "$comment": "either default, or at least one response code property must exist", + "patternProperties": { + "^[1-5](?:[0-9]{2}|XX)$": false + } + }, + "then" : { + "required": [ "default" ] + } }, "response": { "$comment": "https://spec.openapis.org/oas/v3.1.0#response-object", diff --git a/schemas/v3.1/schema.yaml b/schemas/v3.1/schema.yaml index 331bba0813..92b8d52c26 100644 --- a/schemas/v3.1/schema.yaml +++ b/schemas/v3.1/schema.yaml @@ -574,6 +574,12 @@ $defs: minProperties: 1 $ref: '#/$defs/specification-extensions' unevaluatedProperties: false + if: + $comment: either default, or at least one response code property must exist + patternProperties: + '^[1-5](?:[0-9]{2}|XX)$': false + then: + required: [default] response: $comment: https://spec.openapis.org/oas/v3.1.0#response-object