Skip to content

Commit

Permalink
fix: message can have nested oneOf (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni authored Feb 22, 2023
1 parent cfba936 commit a2f0bb7
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 156 deletions.
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"
}

0 comments on commit a2f0bb7

Please sign in to comment.