Skip to content

Commit c33e5ba

Browse files
authored
Merge pull request #4917 from karenetheridge/v3.1-example-examples-mutually-exclusive
v3.1: "example" and "examples" cannot appear together
2 parents f505d31 + f34083a commit c33e5ba

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/schemas/validation/schema.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,10 @@ $defs:
951951
type: object
952952
additionalProperties:
953953
$ref: '#/$defs/example-or-reference'
954+
not:
955+
required:
956+
- example
957+
- examples
954958

955959
map-of-strings:
956960
type: object
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
openapi: 3.1.1
2+
3+
# this example should fail, as example cannot be used together with examples.
4+
5+
info:
6+
title: API
7+
version: 1.0.0
8+
components:
9+
parameters:
10+
animal:
11+
name: animal
12+
in: header
13+
schema: {}
14+
example: bear
15+
examples:
16+
a mammalian example:
17+
value: bear
18+
19+
20+

0 commit comments

Comments
 (0)