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

feat: json schemas for bindings #60

Merged
merged 32 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7f66c46
Schema for amqp added.
KhudaDad414 Apr 18, 2021
a2f98be
moved schemas inside the folder.
KhudaDad414 Apr 20, 2021
a32f639
schema names changed.
KhudaDad414 Apr 20, 2021
c00b43a
http json schema added.
KhudaDad414 Apr 20, 2021
d7f34f8
schema object reference added.
KhudaDad414 Apr 20, 2021
f434741
ibmmq json schema added.
KhudaDad414 Apr 21, 2021
3031e71
kafka json schema added.
KhudaDad414 Apr 21, 2021
51255e6
mqtt json schema added.
KhudaDad414 Apr 23, 2021
a39c4a9
websockets json schema added.
KhudaDad414 Apr 23, 2021
7249f57
changed to draft-7
KhudaDad414 Apr 28, 2021
4dd8b87
ids added
KhudaDad414 Apr 28, 2021
221a302
used asyncapi specification instead of local definitions and draft-07…
KhudaDad414 Apr 28, 2021
e4cf8e8
final touches
KhudaDad414 Apr 28, 2021
5c187d7
conditional checks added
KhudaDad414 May 6, 2021
069854d
removed default from bindingVersion
KhudaDad414 May 8, 2021
5905fd4
defaults added
KhudaDad414 May 8, 2021
dc460c1
$ids corrected
KhudaDad414 May 8, 2021
58d3a0a
used correct file in $refs
KhudaDad414 May 8, 2021
d75caeb
added description for amqp, ibmmq, kafka and http
KhudaDad414 May 18, 2021
b9acfb6
added description for mqtt
KhudaDad414 May 19, 2021
5d9be8e
added description for Websockets
KhudaDad414 May 19, 2021
d2f26d8
added bindingVersion value
KhudaDad414 May 19, 2021
8977a5d
updated amqp schema version in README.md
KhudaDad414 May 19, 2021
908b266
added examples for amqp schemas
KhudaDad414 May 19, 2021
08c69b0
added examples for http schemas
KhudaDad414 May 20, 2021
f489a86
message binding example for ibmmq corrected
KhudaDad414 May 20, 2021
4bbb4a6
added examples for ibmmq schemas
KhudaDad414 May 20, 2021
472ca60
added examples for kafka bindings
KhudaDad414 May 20, 2021
32bdcc6
added examples for mqtt bindings
KhudaDad414 May 22, 2021
8bf0a38
added examples for websockets bindings
KhudaDad414 May 22, 2021
080769d
added required to queue.objectName
KhudaDad414 May 22, 2021
85f9116
Merge branch 'master' into json-schema-bindings
derberg May 24, 2021
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
6 changes: 3 additions & 3 deletions amqp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ channels:
durable: true
autoDelete: false
vhost: /
bindingVersion: 0.1.0
bindingVersion: 0.2.0
```


Expand Down Expand Up @@ -111,7 +111,7 @@ channels:
replyTo: user.signedup
timestamp: true
ack: false
bindingVersion: 0.1.0
bindingVersion: 0.2.0
```


Expand Down Expand Up @@ -140,5 +140,5 @@ channels:
amqp:
contentEncoding: gzip
messageType: 'user.signup'
bindingVersion: 0.1.0
bindingVersion: 0.2.0
```
137 changes: 137 additions & 0 deletions amqp/json_schemas/channel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/bindings/amqp/channel.json",
"title": "Channel Schema",
"description": "This object contains information about the channel representation in AMQP.",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-[\\w\\d\\.\\-\\_]+$": {
"$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension"
}
},
"properties": {
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
"is": {
"type": "string",
derberg marked this conversation as resolved.
Show resolved Hide resolved
"enum": ["queue", "routingKey"],
"description": "Defines what type of channel is it. Can be either 'queue' or 'routingKey' (default)."
},
"exchange": {
"type": "object",
"properties": {
"name": {
"type": "string",
"maxLength": 255,
"description": "The name of the exchange. It MUST NOT exceed 255 characters long."
},
"type": {
"type": "string",
"enum": ["topic", "direct", "fanout", "default", "headers"],
"description": "The type of the exchange. Can be either 'topic', 'direct', 'fanout', 'default' or 'headers'."
},
"durable": {
"type": "boolean",
"description": "Whether the exchange should survive broker restarts or not."
},
"autoDelete": {
"type": "boolean",
"description": "Whether the exchange should be deleted when the last queue is unbound from it."
},
"vhost": {
"type": "string",
"default": "/",
"description": "The virtual host of the exchange. Defaults to '/'."
}
},
"description": "When is=routingKey, this object defines the exchange properties."
},
"queue": {
"type": "object",
"properties": {
"name": {
"type": "string",
"maxLength": 255,
"description": "The name of the queue. It MUST NOT exceed 255 characters long."
},
"durable": {
"type": "boolean",
"description": "Whether the queue should survive broker restarts or not."
},
"exclusive": {
"type": "boolean",
"description": "Whether the queue should be used only by one connection or not."
},
"autoDelete": {
"type": "boolean",
"description": "Whether the queue should be deleted when the last consumer unsubscribes."
},
"vhost": {
"type": "string",
"default": "/",
"description": "The virtual host of the queue. Defaults to '/'."
}
},
"description": "When is=queue, this object defines the queue properties."
},
"bindingVersion": {
"type": "string",
"enum": [
"0.2.0"
],
"description": "The version of this binding. If omitted, 'latest' MUST be assumed."
}

},
"oneOf": [
{
"properties": {
"is": { "const": "routingKey" }
},
"required": [
"exchange"
],
"not": {
"required": [
"queue"
]
}
},
{
"properties": {
"is": { "const": "queue" }
},
"required": [
"queue"
],
"not": {
"required": [
"exchange"
]
}
}
],
"examples": [
{
"is": "routingKey",
"exchange": {
"name": "myExchange",
"type": "topic",
"durable": true,
"autoDelete": false,
"vhost": "/"
},
"bindingVersion": "0.2.0"
},
{
"is": "queue",
"queue": {
"name": "my-queue-name",
"durable": true,
"exclusive": true,
"autoDelete": false,
"vhost": "/"
},
"bindingVersion": "0.2.0"
}
]
}
37 changes: 37 additions & 0 deletions amqp/json_schemas/message.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/bindings/amqp/message.json",
"title": "Message Schema",
"description": "This object contains information about the message representation in AMQP.",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-[\\w\\d\\.\\-\\_]+$": {
"$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension"
}
},
"properties": {
"contentEncoding": {
"type": "string",
"description": "A MIME encoding for the message content."
},
"messageType": {
"type": "string",
"description": "Application-specific message type."
},
"bindingVersion": {
"type": "string",
"enum": [
"0.2.0"
],
"description": "The version of this binding. If omitted, \"latest\" MUST be assumed."
}
},
"examples": [
{
"contentEncoding": "gzip",
"messageType": "user.signup",
"bindingVersion": "0.2.0"
}
]
}
89 changes: 89 additions & 0 deletions amqp/json_schemas/operation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/bindings/amqp/operation.json",
"title": "Operation Schema",
"description": "This object contains information about the operation representation in AMQP.",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-[\\w\\d\\.\\-\\_]+$": {
"$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension"
}
},
"properties": {
"expiration": {
"type": "integer",
"minimum": 0,
"description": "TTL (Time-To-Live) for the message. It MUST be greater than or equal to zero."
},
"userId": {
"type": "string",
"description": "Identifies the user who has sent the message."
},
"cc": {
"type": "array",
"items": {
"type": "string"
},
"description": "The routing keys the message should be routed to at the time of publishing."
},
"priority": {
"type": "integer",
"description": "A priority for the message."
},
"deliveryMode": {
"type": "integer",
"enum": [1,2],
"description": "Delivery mode of the message. Its value MUST be either 1 (transient) or 2 (persistent)."
},
"mandatory": {
"type": "boolean",
"description": "Whether the message is mandatory or not."
},
"bcc": {
"type": "array",
"items": {
"type": "string"
},
"description": "Like cc but consumers will not receive this information."
},
"replyTo": {
"type": "string",
"description": "Name of the queue where the consumer should send the response."
},
"timestamp": {
"type": "boolean",
"description": "Whether the message should include a timestamp or not."
},
"ack": {
"type": "boolean",
"description": "Whether the consumer should ack the message or not."
},
"bindingVersion": {
"type": "string",
"enum": [
"0.2.0"
],
"description": "The version of this binding. If omitted, \"latest\" MUST be assumed."
}
},
"examples": [
{
"expiration": 100000,
"userId": "guest",
"cc": [
"user.logs"
],
"priority": 10,
"deliveryMode": 2,
"mandatory": false,
"bcc": [
"external.audit"
],
"replyTo": "user.signedup",
"timestamp": true,
"ack": false,
"bindingVersion": "0.2.0"
}
]
}
42 changes: 42 additions & 0 deletions http/json_schemas/message.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/bindings/http/message.json",
"title": "Message Schema",
"description": "This object contains information about the message representation in HTTP.",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-[\\w\\d\\.\\-\\_]+$": {
"$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension"
}
},
"properties": {
"headers": {
"$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/schema",
"description": "\tA Schema object containing the definitions for HTTP-specific headers. This schema MUST be of type 'object' and have a 'properties' key."
},
"bindingVersion": {
"type": "string",
"enum": [
"0.1.0"
],
"description": "The version of this binding. If omitted, \"latest\" MUST be assumed."
}
},
"examples": [
{
"headers": {
"type": "object",
"properties": {
"Content-Type": {
"type": "string",
"enum": [
"application/json"
]
}
}
},
"bindingVersion": "0.1.0"
}
]
}
Loading