Skip to content

Commit 6c5b1a7

Browse files
authored
fix: add separate messsage example object (#536)
1 parent dc0d01d commit 6c5b1a7

File tree

5 files changed

+108
-96
lines changed

5 files changed

+108
-96
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"type": "object",
3+
"additionalProperties": false,
4+
"anyOf": [
5+
{
6+
"required": [
7+
"payload"
8+
]
9+
},
10+
{
11+
"required": [
12+
"headers"
13+
]
14+
}
15+
],
16+
"properties": {
17+
"name": {
18+
"type": "string",
19+
"description": "Machine readable name of the message example."
20+
},
21+
"summary": {
22+
"type": "string",
23+
"description": "A brief summary of the message example."
24+
},
25+
"headers": {
26+
"type": "object",
27+
"description": "Example of the application headers. It can be of any type."
28+
},
29+
"payload": {
30+
"description": "Example of the message payload. It can be of any type."
31+
}
32+
},
33+
"$schema": "http://json-schema.org/draft-07/schema#",
34+
"$id": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json"
35+
}

definitions/3.0.0/messageObject.json

+1-31
Original file line numberDiff line numberDiff line change
@@ -76,37 +76,7 @@
7676
"type": "array",
7777
"description": "List of examples.",
7878
"items": {
79-
"type": "object",
80-
"additionalProperties": false,
81-
"anyOf": [
82-
{
83-
"required": [
84-
"payload"
85-
]
86-
},
87-
{
88-
"required": [
89-
"headers"
90-
]
91-
}
92-
],
93-
"properties": {
94-
"name": {
95-
"type": "string",
96-
"description": "Machine readable name of the message example."
97-
},
98-
"summary": {
99-
"type": "string",
100-
"description": "A brief summary of the message example."
101-
},
102-
"headers": {
103-
"type": "object",
104-
"description": "Example of the application headers. It can be of any type."
105-
},
106-
"payload": {
107-
"description": "Example of the message payload. It can be of any type."
108-
}
109-
}
79+
"$ref": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json"
11080
}
11181
},
11282
"bindings": {

definitions/3.0.0/messageTrait.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"type": "array",
7474
"description": "List of examples.",
7575
"items": {
76-
"type": "object"
76+
"$ref": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json"
7777
}
7878
},
7979
"bindings": {

schemas/3.0.0-without-$id.json

+35-32
Original file line numberDiff line numberDiff line change
@@ -2572,37 +2572,7 @@
25722572
"type": "array",
25732573
"description": "List of examples.",
25742574
"items": {
2575-
"type": "object",
2576-
"additionalProperties": false,
2577-
"anyOf": [
2578-
{
2579-
"required": [
2580-
"payload"
2581-
]
2582-
},
2583-
{
2584-
"required": [
2585-
"headers"
2586-
]
2587-
}
2588-
],
2589-
"properties": {
2590-
"name": {
2591-
"type": "string",
2592-
"description": "Machine readable name of the message example."
2593-
},
2594-
"summary": {
2595-
"type": "string",
2596-
"description": "A brief summary of the message example."
2597-
},
2598-
"headers": {
2599-
"type": "object",
2600-
"description": "Example of the application headers. It can be of any type."
2601-
},
2602-
"payload": {
2603-
"description": "Example of the message payload. It can be of any type."
2604-
}
2605-
}
2575+
"$ref": "#/definitions/messageExampleObject"
26062576
}
26072577
},
26082578
"bindings": {
@@ -3564,6 +3534,39 @@
35643534
}
35653535
]
35663536
},
3537+
"messageExampleObject": {
3538+
"type": "object",
3539+
"additionalProperties": false,
3540+
"anyOf": [
3541+
{
3542+
"required": [
3543+
"payload"
3544+
]
3545+
},
3546+
{
3547+
"required": [
3548+
"headers"
3549+
]
3550+
}
3551+
],
3552+
"properties": {
3553+
"name": {
3554+
"type": "string",
3555+
"description": "Machine readable name of the message example."
3556+
},
3557+
"summary": {
3558+
"type": "string",
3559+
"description": "A brief summary of the message example."
3560+
},
3561+
"headers": {
3562+
"type": "object",
3563+
"description": "Example of the application headers. It can be of any type."
3564+
},
3565+
"payload": {
3566+
"description": "Example of the message payload. It can be of any type."
3567+
}
3568+
}
3569+
},
35673570
"messageBindingsObject": {
35683571
"type": "object",
35693572
"description": "Map describing protocol-specific definitions for a message.",
@@ -4678,7 +4681,7 @@
46784681
"type": "array",
46794682
"description": "List of examples.",
46804683
"items": {
4681-
"type": "object"
4684+
"$ref": "#/definitions/messageExampleObject"
46824685
}
46834686
},
46844687
"bindings": {

schemas/3.0.0.json

+36-32
Original file line numberDiff line numberDiff line change
@@ -2624,37 +2624,7 @@
26242624
"type": "array",
26252625
"description": "List of examples.",
26262626
"items": {
2627-
"type": "object",
2628-
"additionalProperties": false,
2629-
"anyOf": [
2630-
{
2631-
"required": [
2632-
"payload"
2633-
]
2634-
},
2635-
{
2636-
"required": [
2637-
"headers"
2638-
]
2639-
}
2640-
],
2641-
"properties": {
2642-
"name": {
2643-
"type": "string",
2644-
"description": "Machine readable name of the message example."
2645-
},
2646-
"summary": {
2647-
"type": "string",
2648-
"description": "A brief summary of the message example."
2649-
},
2650-
"headers": {
2651-
"type": "object",
2652-
"description": "Example of the application headers. It can be of any type."
2653-
},
2654-
"payload": {
2655-
"description": "Example of the message payload. It can be of any type."
2656-
}
2657-
}
2627+
"$ref": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json"
26582628
}
26592629
},
26602630
"bindings": {
@@ -3621,6 +3591,40 @@
36213591
}
36223592
]
36233593
},
3594+
"http://asyncapi.com/definitions/3.0.0/messageExampleObject.json": {
3595+
"$id": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json",
3596+
"type": "object",
3597+
"additionalProperties": false,
3598+
"anyOf": [
3599+
{
3600+
"required": [
3601+
"payload"
3602+
]
3603+
},
3604+
{
3605+
"required": [
3606+
"headers"
3607+
]
3608+
}
3609+
],
3610+
"properties": {
3611+
"name": {
3612+
"type": "string",
3613+
"description": "Machine readable name of the message example."
3614+
},
3615+
"summary": {
3616+
"type": "string",
3617+
"description": "A brief summary of the message example."
3618+
},
3619+
"headers": {
3620+
"type": "object",
3621+
"description": "Example of the application headers. It can be of any type."
3622+
},
3623+
"payload": {
3624+
"description": "Example of the message payload. It can be of any type."
3625+
}
3626+
}
3627+
},
36243628
"http://asyncapi.com/definitions/3.0.0/messageBindingsObject.json": {
36253629
"$id": "http://asyncapi.com/definitions/3.0.0/messageBindingsObject.json",
36263630
"type": "object",
@@ -4748,7 +4752,7 @@
47484752
"type": "array",
47494753
"description": "List of examples.",
47504754
"items": {
4751-
"type": "object"
4755+
"$ref": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json"
47524756
}
47534757
},
47544758
"bindings": {

0 commit comments

Comments
 (0)