Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: message can have nested oneOf #333

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 2 additions & 156 deletions definitions/3.0.0/message.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,167 +15,13 @@
"oneOf": {
"type": "array",
"items": {
"$ref": "http://asyncapi.com/definitions/3.0.0/message.json"
"$ref": "http://asyncapi.com/definitions/3.0.0/messageObject.json"
}
}
}
},
{
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"properties": {
"schemaFormat": {
"type": "string"
},
"contentType": {
"type": "string"
},
"headers": {
"allOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/schema.json"
},
{
"properties": {
"type": {
"const": "object"
}
}
}
]
},
"messageId": {
"type": "string"
},
"payload": {},
"correlationId": {
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/correlationId.json"
}
]
},
"tags": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/tag.json"
}
]
},
"uniqueItems": true
},
"summary": {
"type": "string",
"description": "A brief summary of the message."
},
"name": {
"type": "string",
"description": "Name of the message."
},
"title": {
"type": "string",
"description": "A human-friendly title for the message."
},
"description": {
"type": "string",
"description": "A longer description of the message. CommonMark is allowed."
},
"externalDocs": {
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json"
}
]
},
"deprecated": {
"type": "boolean",
"default": false
},
"examples": {
"type": "array",
"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"
},
"payload": {}
}
}
},
"bindings": {
"$ref": "http://asyncapi.com/definitions/3.0.0/messageBindingsObject.json"
},
"traits": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/messageTrait.json"
},
{
"type": "array",
"items": [
{
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/messageTrait.json"
}
]
},
{
"type": "object",
"additionalItems": true
}
]
}
]
}
}
}
"$ref": "http://asyncapi.com/definitions/3.0.0/messageObject.json"
}
]
}
Expand Down
159 changes: 159 additions & 0 deletions definitions/3.0.0/messageObject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"properties": {
"schemaFormat": {
"type": "string"
},
"contentType": {
"type": "string"
},
"headers": {
"allOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/schema.json"
},
{
"properties": {
"type": {
"const": "object"
}
}
}
]
},
"messageId": {
"type": "string"
},
"payload": {},
"correlationId": {
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/correlationId.json"
}
]
},
"tags": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/tag.json"
}
]
},
"uniqueItems": true
},
"summary": {
"type": "string",
"description": "A brief summary of the message."
},
"name": {
"type": "string",
"description": "Name of the message."
},
"title": {
"type": "string",
"description": "A human-friendly title for the message."
},
"description": {
"type": "string",
"description": "A longer description of the message. CommonMark is allowed."
},
"externalDocs": {
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/externalDocs.json"
}
]
},
"deprecated": {
"type": "boolean",
"default": false
},
"examples": {
"type": "array",
"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"
},
"payload": {}
}
}
},
"bindings": {
"$ref": "http://asyncapi.com/definitions/3.0.0/messageBindingsObject.json"
},
"traits": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/messageTrait.json"
},
{
"type": "array",
"items": [
{
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/messageTrait.json"
}
]
},
{
"type": "object",
"additionalItems": true
}
]
}
]
}
}
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/messageObject.json"
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing EOF

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just a notice from GitHub, incase it's relevant for your setup to have newlines at the end of files, in this case I am pretty sure it's not 🙂