diff --git a/definitions/3.0.0/messageExampleObject.json b/definitions/3.0.0/messageExampleObject.json new file mode 100644 index 00000000..3a59ffcf --- /dev/null +++ b/definitions/3.0.0/messageExampleObject.json @@ -0,0 +1,35 @@ +{ + "type": "object", + "additionalProperties": false, + "anyOf": [ + { + "required": [ + "payload" + ] + }, + { + "required": [ + "headers" + ] + } + ], + "properties": { + "name": { + "type": "string", + "description": "Machine readable name of the message example." + }, + "summary": { + "type": "string", + "description": "A brief summary of the message example." + }, + "headers": { + "type": "object", + "description": "Example of the application headers. It can be of any type." + }, + "payload": { + "description": "Example of the message payload. It can be of any type." + } + }, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json" +} diff --git a/definitions/3.0.0/messageObject.json b/definitions/3.0.0/messageObject.json index 3c35a299..f8cd37bb 100644 --- a/definitions/3.0.0/messageObject.json +++ b/definitions/3.0.0/messageObject.json @@ -76,37 +76,7 @@ "type": "array", "description": "List of examples.", "items": { - "type": "object", - "additionalProperties": false, - "anyOf": [ - { - "required": [ - "payload" - ] - }, - { - "required": [ - "headers" - ] - } - ], - "properties": { - "name": { - "type": "string", - "description": "Machine readable name of the message example." - }, - "summary": { - "type": "string", - "description": "A brief summary of the message example." - }, - "headers": { - "type": "object", - "description": "Example of the application headers. It can be of any type." - }, - "payload": { - "description": "Example of the message payload. It can be of any type." - } - } + "$ref": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json" } }, "bindings": { diff --git a/definitions/3.0.0/messageTrait.json b/definitions/3.0.0/messageTrait.json index 587d140b..3e5d4829 100644 --- a/definitions/3.0.0/messageTrait.json +++ b/definitions/3.0.0/messageTrait.json @@ -73,7 +73,7 @@ "type": "array", "description": "List of examples.", "items": { - "type": "object" + "$ref": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json" } }, "bindings": { diff --git a/schemas/3.0.0-without-$id.json b/schemas/3.0.0-without-$id.json index 3a8ce1ef..4ca677a4 100644 --- a/schemas/3.0.0-without-$id.json +++ b/schemas/3.0.0-without-$id.json @@ -2572,37 +2572,7 @@ "type": "array", "description": "List of examples.", "items": { - "type": "object", - "additionalProperties": false, - "anyOf": [ - { - "required": [ - "payload" - ] - }, - { - "required": [ - "headers" - ] - } - ], - "properties": { - "name": { - "type": "string", - "description": "Machine readable name of the message example." - }, - "summary": { - "type": "string", - "description": "A brief summary of the message example." - }, - "headers": { - "type": "object", - "description": "Example of the application headers. It can be of any type." - }, - "payload": { - "description": "Example of the message payload. It can be of any type." - } - } + "$ref": "#/definitions/messageExampleObject" } }, "bindings": { @@ -3564,6 +3534,39 @@ } ] }, + "messageExampleObject": { + "type": "object", + "additionalProperties": false, + "anyOf": [ + { + "required": [ + "payload" + ] + }, + { + "required": [ + "headers" + ] + } + ], + "properties": { + "name": { + "type": "string", + "description": "Machine readable name of the message example." + }, + "summary": { + "type": "string", + "description": "A brief summary of the message example." + }, + "headers": { + "type": "object", + "description": "Example of the application headers. It can be of any type." + }, + "payload": { + "description": "Example of the message payload. It can be of any type." + } + } + }, "messageBindingsObject": { "type": "object", "description": "Map describing protocol-specific definitions for a message.", @@ -4678,7 +4681,7 @@ "type": "array", "description": "List of examples.", "items": { - "type": "object" + "$ref": "#/definitions/messageExampleObject" } }, "bindings": { diff --git a/schemas/3.0.0.json b/schemas/3.0.0.json index 889d975f..f86ffae0 100644 --- a/schemas/3.0.0.json +++ b/schemas/3.0.0.json @@ -2624,37 +2624,7 @@ "type": "array", "description": "List of examples.", "items": { - "type": "object", - "additionalProperties": false, - "anyOf": [ - { - "required": [ - "payload" - ] - }, - { - "required": [ - "headers" - ] - } - ], - "properties": { - "name": { - "type": "string", - "description": "Machine readable name of the message example." - }, - "summary": { - "type": "string", - "description": "A brief summary of the message example." - }, - "headers": { - "type": "object", - "description": "Example of the application headers. It can be of any type." - }, - "payload": { - "description": "Example of the message payload. It can be of any type." - } - } + "$ref": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json" } }, "bindings": { @@ -3621,6 +3591,40 @@ } ] }, + "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json": { + "$id": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json", + "type": "object", + "additionalProperties": false, + "anyOf": [ + { + "required": [ + "payload" + ] + }, + { + "required": [ + "headers" + ] + } + ], + "properties": { + "name": { + "type": "string", + "description": "Machine readable name of the message example." + }, + "summary": { + "type": "string", + "description": "A brief summary of the message example." + }, + "headers": { + "type": "object", + "description": "Example of the application headers. It can be of any type." + }, + "payload": { + "description": "Example of the message payload. It can be of any type." + } + } + }, "http://asyncapi.com/definitions/3.0.0/messageBindingsObject.json": { "$id": "http://asyncapi.com/definitions/3.0.0/messageBindingsObject.json", "type": "object", @@ -4748,7 +4752,7 @@ "type": "array", "description": "List of examples.", "items": { - "type": "object" + "$ref": "http://asyncapi.com/definitions/3.0.0/messageExampleObject.json" } }, "bindings": {