Skip to content

Commit a2f0bb7

Browse files
authored
fix: message can have nested oneOf (#333)
1 parent cfba936 commit a2f0bb7

File tree

2 files changed

+161
-156
lines changed

2 files changed

+161
-156
lines changed

definitions/3.0.0/message.json

Lines changed: 2 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -15,167 +15,13 @@
1515
"oneOf": {
1616
"type": "array",
1717
"items": {
18-
"$ref": "http://asyncapi.com/definitions/3.0.0/message.json"
18+
"$ref": "http://asyncapi.com/definitions/3.0.0/messageObject.json"
1919
}
2020
}
2121
}
2222
},
2323
{
24-
"type": "object",
25-
"additionalProperties": false,
26-
"patternProperties": {
27-
"^x-[\\w\\d\\.\\x2d_]+$": {
28-
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
29-
}
30-
},
31-
"properties": {
32-
"schemaFormat": {
33-
"type": "string"
34-
},
35-
"contentType": {
36-
"type": "string"
37-
},
38-
"headers": {
39-
"allOf": [
40-
{
41-
"$ref": "http://asyncapi.com/definitions/3.0.0/schema.json"
42-
},
43-
{
44-
"properties": {
45-
"type": {
46-
"const": "object"
47-
}
48-
}
49-
}
50-
]
51-
},
52-
"messageId": {
53-
"type": "string"
54-
},
55-
"payload": {},
56-
"correlationId": {
57-
"oneOf": [
58-
{
59-
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
60-
},
61-
{
62-
"$ref": "http://asyncapi.com/definitions/3.0.0/correlationId.json"
63-
}
64-
]
65-
},
66-
"tags": {
67-
"type": "array",
68-
"items": {
69-
"oneOf": [
70-
{
71-
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
72-
},
73-
{
74-
"$ref": "http://asyncapi.com/definitions/3.0.0/tag.json"
75-
}
76-
]
77-
},
78-
"uniqueItems": true
79-
},
80-
"summary": {
81-
"type": "string",
82-
"description": "A brief summary of the message."
83-
},
84-
"name": {
85-
"type": "string",
86-
"description": "Name of the message."
87-
},
88-
"title": {
89-
"type": "string",
90-
"description": "A human-friendly title for the message."
91-
},
92-
"description": {
93-
"type": "string",
94-
"description": "A longer description of the message. CommonMark is allowed."
95-
},
96-
"externalDocs": {
97-
"oneOf": [
98-
{
99-
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
100-
},
101-
{
102-
"$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json"
103-
}
104-
]
105-
},
106-
"deprecated": {
107-
"type": "boolean",
108-
"default": false
109-
},
110-
"examples": {
111-
"type": "array",
112-
"items": {
113-
"type": "object",
114-
"additionalProperties": false,
115-
"anyOf": [
116-
{
117-
"required": [
118-
"payload"
119-
]
120-
},
121-
{
122-
"required": [
123-
"headers"
124-
]
125-
}
126-
],
127-
"properties": {
128-
"name": {
129-
"type": "string",
130-
"description": "Machine readable name of the message example."
131-
},
132-
"summary": {
133-
"type": "string",
134-
"description": "A brief summary of the message example."
135-
},
136-
"headers": {
137-
"type": "object"
138-
},
139-
"payload": {}
140-
}
141-
}
142-
},
143-
"bindings": {
144-
"$ref": "http://asyncapi.com/definitions/3.0.0/messageBindingsObject.json"
145-
},
146-
"traits": {
147-
"type": "array",
148-
"items": {
149-
"oneOf": [
150-
{
151-
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
152-
},
153-
{
154-
"$ref": "http://asyncapi.com/definitions/3.0.0/messageTrait.json"
155-
},
156-
{
157-
"type": "array",
158-
"items": [
159-
{
160-
"oneOf": [
161-
{
162-
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
163-
},
164-
{
165-
"$ref": "http://asyncapi.com/definitions/3.0.0/messageTrait.json"
166-
}
167-
]
168-
},
169-
{
170-
"type": "object",
171-
"additionalItems": true
172-
}
173-
]
174-
}
175-
]
176-
}
177-
}
178-
}
24+
"$ref": "http://asyncapi.com/definitions/3.0.0/messageObject.json"
17925
}
18026
]
18127
}
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"type": "object",
3+
"additionalProperties": false,
4+
"patternProperties": {
5+
"^x-[\\w\\d\\.\\x2d_]+$": {
6+
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
7+
}
8+
},
9+
"properties": {
10+
"schemaFormat": {
11+
"type": "string"
12+
},
13+
"contentType": {
14+
"type": "string"
15+
},
16+
"headers": {
17+
"allOf": [
18+
{
19+
"$ref": "http://asyncapi.com/definitions/3.0.0/schema.json"
20+
},
21+
{
22+
"properties": {
23+
"type": {
24+
"const": "object"
25+
}
26+
}
27+
}
28+
]
29+
},
30+
"messageId": {
31+
"type": "string"
32+
},
33+
"payload": {},
34+
"correlationId": {
35+
"oneOf": [
36+
{
37+
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
38+
},
39+
{
40+
"$ref": "http://asyncapi.com/definitions/3.0.0/correlationId.json"
41+
}
42+
]
43+
},
44+
"tags": {
45+
"type": "array",
46+
"items": {
47+
"oneOf": [
48+
{
49+
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
50+
},
51+
{
52+
"$ref": "http://asyncapi.com/definitions/3.0.0/tag.json"
53+
}
54+
]
55+
},
56+
"uniqueItems": true
57+
},
58+
"summary": {
59+
"type": "string",
60+
"description": "A brief summary of the message."
61+
},
62+
"name": {
63+
"type": "string",
64+
"description": "Name of the message."
65+
},
66+
"title": {
67+
"type": "string",
68+
"description": "A human-friendly title for the message."
69+
},
70+
"description": {
71+
"type": "string",
72+
"description": "A longer description of the message. CommonMark is allowed."
73+
},
74+
"externalDocs": {
75+
"oneOf": [
76+
{
77+
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
78+
},
79+
{
80+
"$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json"
81+
}
82+
]
83+
},
84+
"deprecated": {
85+
"type": "boolean",
86+
"default": false
87+
},
88+
"examples": {
89+
"type": "array",
90+
"items": {
91+
"type": "object",
92+
"additionalProperties": false,
93+
"anyOf": [
94+
{
95+
"required": [
96+
"payload"
97+
]
98+
},
99+
{
100+
"required": [
101+
"headers"
102+
]
103+
}
104+
],
105+
"properties": {
106+
"name": {
107+
"type": "string",
108+
"description": "Machine readable name of the message example."
109+
},
110+
"summary": {
111+
"type": "string",
112+
"description": "A brief summary of the message example."
113+
},
114+
"headers": {
115+
"type": "object"
116+
},
117+
"payload": {}
118+
}
119+
}
120+
},
121+
"bindings": {
122+
"$ref": "http://asyncapi.com/definitions/3.0.0/messageBindingsObject.json"
123+
},
124+
"traits": {
125+
"type": "array",
126+
"items": {
127+
"oneOf": [
128+
{
129+
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
130+
},
131+
{
132+
"$ref": "http://asyncapi.com/definitions/3.0.0/messageTrait.json"
133+
},
134+
{
135+
"type": "array",
136+
"items": [
137+
{
138+
"oneOf": [
139+
{
140+
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
141+
},
142+
{
143+
"$ref": "http://asyncapi.com/definitions/3.0.0/messageTrait.json"
144+
}
145+
]
146+
},
147+
{
148+
"type": "object",
149+
"additionalItems": true
150+
}
151+
]
152+
}
153+
]
154+
}
155+
}
156+
},
157+
"$schema": "http://json-schema.org/draft-07/schema#",
158+
"$id": "http://asyncapi.com/definitions/3.0.0/messageObject.json"
159+
}

0 commit comments

Comments
 (0)