UNPKG

@asyncapi/specs

Version:
1,347 lines (1,346 loc) 379 kB
{ "$schema": "http://json-schema.org/draft-07/schema", "title": "AsyncAPI 3.0.0 schema.", "type": "object", "required": [ "asyncapi", "info" ], "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "properties": { "asyncapi": { "type": "string", "const": "3.0.0", "description": "The AsyncAPI specification version of this document." }, "id": { "type": "string", "description": "A unique id representing the application.", "format": "uri" }, "info": { "$ref": "#/definitions/info" }, "servers": { "$ref": "#/definitions/servers" }, "defaultContentType": { "type": "string", "description": "Default content type to use when encoding/decoding a message's payload." }, "channels": { "$ref": "#/definitions/channels" }, "operations": { "$ref": "#/definitions/operations" }, "components": { "$ref": "#/definitions/components" } }, "definitions": { "specificationExtension": { "description": "Any property starting with x- is valid.", "additionalProperties": true, "additionalItems": true }, "info": { "description": "The object provides metadata about the API. The metadata can be used by the clients if needed.", "allOf": [ { "type": "object", "required": [ "version", "title" ], "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "properties": { "title": { "type": "string", "description": "A unique and precise title of the API." }, "version": { "type": "string", "description": "A semantic version number of the API." }, "description": { "type": "string", "description": "A longer description of the API. Should be different from the title. CommonMark is allowed." }, "termsOfService": { "type": "string", "description": "A URL to the Terms of Service for the API. MUST be in the format of a URL.", "format": "uri" }, "contact": { "$ref": "#/definitions/contact" }, "license": { "$ref": "#/definitions/license" }, "tags": { "type": "array", "description": "A list of tags for application API documentation control. Tags can be used for logical grouping of applications.", "items": { "oneOf": [ { "$ref": "#/definitions/Reference" }, { "$ref": "#/definitions/tag" } ] }, "uniqueItems": true }, "externalDocs": { "oneOf": [ { "$ref": "#/definitions/Reference" }, { "$ref": "#/definitions/externalDocs" } ] } } }, { "$ref": "#/definitions/infoExtensions" } ], "examples": [ { "title": "AsyncAPI Sample App", "version": "1.0.1", "description": "This is a sample app.", "termsOfService": "https://asyncapi.org/terms/", "contact": { "name": "API Support", "url": "https://www.asyncapi.org/support", "email": "support@asyncapi.org" }, "license": { "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, "externalDocs": { "description": "Find more info here", "url": "https://www.asyncapi.org" }, "tags": [ { "name": "e-commerce" } ] } ] }, "contact": { "type": "object", "description": "Contact information for the exposed API.", "additionalProperties": false, "properties": { "name": { "type": "string", "description": "The identifying name of the contact person/organization." }, "url": { "type": "string", "description": "The URL pointing to the contact information.", "format": "uri" }, "email": { "type": "string", "description": "The email address of the contact person/organization.", "format": "email" } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "examples": [ { "name": "API Support", "url": "https://www.example.com/support", "email": "support@example.com" } ] }, "license": { "type": "object", "required": [ "name" ], "additionalProperties": false, "properties": { "name": { "type": "string", "description": "The name of the license type. It's encouraged to use an OSI compatible license." }, "url": { "type": "string", "description": "The URL pointing to the license.", "format": "uri" } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "examples": [ { "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" } ] }, "Reference": { "type": "object", "description": "A simple object to allow referencing other components in the specification, internally and externally.", "required": [ "$ref" ], "properties": { "$ref": { "description": "The reference string.", "$ref": "#/definitions/ReferenceObject" } }, "examples": [ { "$ref": "#/components/schemas/Pet" } ] }, "ReferenceObject": { "type": "string", "format": "uri-reference" }, "tag": { "type": "object", "description": "Allows adding metadata to a single tag.", "additionalProperties": false, "required": [ "name" ], "properties": { "name": { "type": "string", "description": "The name of the tag." }, "description": { "type": "string", "description": "A short description for the tag. CommonMark syntax can be used for rich text representation." }, "externalDocs": { "oneOf": [ { "$ref": "#/definitions/Reference" }, { "$ref": "#/definitions/externalDocs" } ] } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "examples": [ { "name": "user", "description": "User-related messages" } ] }, "externalDocs": { "type": "object", "additionalProperties": false, "description": "Allows referencing an external resource for extended documentation.", "required": [ "url" ], "properties": { "description": { "type": "string", "description": "A short description of the target documentation. CommonMark syntax can be used for rich text representation." }, "url": { "type": "string", "description": "The URL for the target documentation. This MUST be in the form of an absolute URL.", "format": "uri" } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "examples": [ { "description": "Find more info here", "url": "https://example.com" } ] }, "infoExtensions": { "type": "object", "description": "The object that lists all the extensions of Info", "properties": { "x-x": { "$ref": "#/definitions/extensions-x-0.1.0-schema" }, "x-linkedin": { "$ref": "#/definitions/extensions-linkedin-0.1.0-schema" } } }, "extensions-x-0.1.0-schema": { "type": "string", "description": "This extension allows you to provide the Twitter username of the account representing the team/company of the API.", "example": [ "sambhavgupta75", "AsyncAPISpec" ] }, "extensions-linkedin-0.1.0-schema": { "type": "string", "pattern": "^http(s)?://(www\\.)?linkedin\\.com.*$", "description": "This extension allows you to provide the Linkedin profile URL of the account representing the team/company of the API.", "example": [ "https://www.linkedin.com/company/asyncapi/", "https://www.linkedin.com/in/sambhavgupta0705/" ] }, "servers": { "description": "An object representing multiple servers.", "type": "object", "additionalProperties": { "oneOf": [ { "$ref": "#/definitions/Reference" }, { "$ref": "#/definitions/server" } ] }, "examples": [ { "development": { "host": "localhost:5672", "description": "Development AMQP broker.", "protocol": "amqp", "protocolVersion": "0-9-1", "tags": [ { "name": "env:development", "description": "This environment is meant for developers to run their own tests." } ] }, "staging": { "host": "rabbitmq-staging.in.mycompany.com:5672", "description": "RabbitMQ broker for the staging environment.", "protocol": "amqp", "protocolVersion": "0-9-1", "tags": [ { "name": "env:staging", "description": "This environment is a replica of the production environment." } ] }, "production": { "host": "rabbitmq.in.mycompany.com:5672", "description": "RabbitMQ broker for the production environment.", "protocol": "amqp", "protocolVersion": "0-9-1", "tags": [ { "name": "env:production", "description": "This environment is the live environment available for final users." } ] } } ] }, "server": { "type": "object", "description": "An object representing a message broker, a server or any other kind of computer program capable of sending and/or receiving data.", "required": [ "host", "protocol" ], "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "properties": { "host": { "type": "string", "description": "The server host name. It MAY include the port. This field supports Server Variables. Variable substitutions will be made when a variable is named in {braces}." }, "pathname": { "type": "string", "description": "The path to a resource in the host. This field supports Server Variables. Variable substitutions will be made when a variable is named in {braces}." }, "title": { "type": "string", "description": "A human-friendly title for the server." }, "summary": { "type": "string", "description": "A brief summary of the server." }, "description": { "type": "string", "description": "A longer description of the server. CommonMark is allowed." }, "protocol": { "type": "string", "description": "The protocol this server supports for connection." }, "protocolVersion": { "type": "string", "description": "An optional string describing the server. CommonMark syntax MAY be used for rich text representation." }, "variables": { "$ref": "#/definitions/serverVariables" }, "security": { "$ref": "#/definitions/securityRequirements" }, "tags": { "type": "array", "items": { "oneOf": [ { "$ref": "#/definitions/Reference" }, { "$ref": "#/definitions/tag" } ] }, "uniqueItems": true }, "externalDocs": { "oneOf": [ { "$ref": "#/definitions/Reference" }, { "$ref": "#/definitions/externalDocs" } ] }, "bindings": { "oneOf": [ { "$ref": "#/definitions/Reference" }, { "$ref": "#/definitions/serverBindingsObject" } ] } }, "examples": [ { "host": "kafka.in.mycompany.com:9092", "description": "Production Kafka broker.", "protocol": "kafka", "protocolVersion": "3.2" }, { "host": "rabbitmq.in.mycompany.com:5672", "pathname": "/production", "protocol": "amqp", "description": "Production RabbitMQ broker (uses the `production` vhost)." } ] }, "serverVariables": { "type": "object", "additionalProperties": { "oneOf": [ { "$ref": "#/definitions/Reference" }, { "$ref": "#/definitions/serverVariable" } ] } }, "serverVariable": { "type": "object", "description": "An object representing a Server Variable for server URL template substitution.", "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "properties": { "enum": { "type": "array", "description": "An enumeration of string values to be used if the substitution options are from a limited set.", "items": { "type": "string" }, "uniqueItems": true }, "default": { "type": "string", "description": "The default value to use for substitution, and to send, if an alternate value is not supplied." }, "description": { "type": "string", "description": "An optional description for the server variable. CommonMark syntax MAY be used for rich text representation." }, "examples": { "type": "array", "description": "An array of examples of the server variable.", "items": { "type": "string" } } }, "examples": [ { "host": "rabbitmq.in.mycompany.com:5672", "pathname": "/{env}", "protocol": "amqp", "description": "RabbitMQ broker. Use the `env` variable to point to either `production` or `staging`.", "variables": { "env": { "description": "Environment to connect to. It can be either `production` or `staging`.", "enum": [ "production", "staging" ] } } } ] }, "securityRequirements": { "description": "An array representing security requirements.", "type": "array", "items": { "oneOf": [ { "$ref": "#/definitions/Reference" }, { "$ref": "#/definitions/SecurityScheme" } ] } }, "SecurityScheme": { "description": "Defines a security scheme that can be used by the operations.", "oneOf": [ { "$ref": "#/definitions/userPassword" }, { "$ref": "#/definitions/apiKey" }, { "$ref": "#/definitions/X509" }, { "$ref": "#/definitions/symmetricEncryption" }, { "$ref": "#/definitions/asymmetricEncryption" }, { "$ref": "#/definitions/HTTPSecurityScheme" }, { "$ref": "#/definitions/oauth2Flows" }, { "$ref": "#/definitions/openIdConnect" }, { "$ref": "#/definitions/SaslSecurityScheme" } ], "examples": [ { "type": "userPassword" } ] }, "userPassword": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "userPassword" ] }, "description": { "type": "string" } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false, "examples": [ { "type": "userPassword" } ] }, "apiKey": { "type": "object", "required": [ "type", "in" ], "properties": { "type": { "type": "string", "description": "The type of the security scheme", "enum": [ "apiKey" ] }, "in": { "type": "string", "description": " The location of the API key.", "enum": [ "user", "password" ] }, "description": { "type": "string", "description": "A short description for security scheme. CommonMark syntax MAY be used for rich text representation." } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false, "examples": [ { "type": "apiKey", "in": "user" } ] }, "X509": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "X509" ] }, "description": { "type": "string" } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false, "examples": [ { "type": "X509" } ] }, "symmetricEncryption": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "symmetricEncryption" ] }, "description": { "type": "string" } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false, "examples": [ { "type": "symmetricEncryption" } ] }, "asymmetricEncryption": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "description": "The type of the security scheme.", "enum": [ "asymmetricEncryption" ] }, "description": { "type": "string", "description": "A short description for security scheme." } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false }, "HTTPSecurityScheme": { "oneOf": [ { "$ref": "#/definitions/NonBearerHTTPSecurityScheme" }, { "$ref": "#/definitions/BearerHTTPSecurityScheme" }, { "$ref": "#/definitions/APIKeyHTTPSecurityScheme" } ] }, "NonBearerHTTPSecurityScheme": { "not": { "type": "object", "properties": { "scheme": { "type": "string", "description": "A short description for security scheme.", "enum": [ "bearer" ] } } }, "type": "object", "required": [ "scheme", "type" ], "properties": { "scheme": { "type": "string", "description": "The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235." }, "description": { "type": "string", "description": "A short description for security scheme." }, "type": { "type": "string", "description": "The type of the security scheme.", "enum": [ "http" ] } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false }, "BearerHTTPSecurityScheme": { "type": "object", "required": [ "type", "scheme" ], "properties": { "scheme": { "type": "string", "description": "The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235.", "enum": [ "bearer" ] }, "bearerFormat": { "type": "string", "description": "A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes." }, "type": { "type": "string", "description": "The type of the security scheme.", "enum": [ "http" ] }, "description": { "type": "string", "description": "A short description for security scheme. CommonMark syntax MAY be used for rich text representation." } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false }, "APIKeyHTTPSecurityScheme": { "type": "object", "required": [ "type", "name", "in" ], "properties": { "type": { "type": "string", "description": "The type of the security scheme.", "enum": [ "httpApiKey" ] }, "name": { "type": "string", "description": "The name of the header, query or cookie parameter to be used." }, "in": { "type": "string", "description": "The location of the API key", "enum": [ "header", "query", "cookie" ] }, "description": { "type": "string", "description": "A short description for security scheme. CommonMark syntax MAY be used for rich text representation." } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false, "examples": [ { "type": "httpApiKey", "name": "api_key", "in": "header" } ] }, "oauth2Flows": { "type": "object", "description": "Allows configuration of the supported OAuth Flows.", "required": [ "type", "flows" ], "properties": { "type": { "type": "string", "description": "The type of the security scheme.", "enum": [ "oauth2" ] }, "description": { "type": "string", "description": "A short description for security scheme." }, "flows": { "type": "object", "properties": { "implicit": { "description": "Configuration for the OAuth Implicit flow.", "allOf": [ { "$ref": "#/definitions/oauth2Flow" }, { "required": [ "authorizationUrl", "availableScopes" ] }, { "not": { "required": [ "tokenUrl" ] } } ] }, "password": { "description": "Configuration for the OAuth Resource Owner Protected Credentials flow.", "allOf": [ { "$ref": "#/definitions/oauth2Flow" }, { "required": [ "tokenUrl", "availableScopes" ] }, { "not": { "required": [ "authorizationUrl" ] } } ] }, "clientCredentials": { "description": "Configuration for the OAuth Client Credentials flow.", "allOf": [ { "$ref": "#/definitions/oauth2Flow" }, { "required": [ "tokenUrl", "availableScopes" ] }, { "not": { "required": [ "authorizationUrl" ] } } ] }, "authorizationCode": { "description": "Configuration for the OAuth Authorization Code flow.", "allOf": [ { "$ref": "#/definitions/oauth2Flow" }, { "required": [ "authorizationUrl", "tokenUrl", "availableScopes" ] } ] } }, "additionalProperties": false }, "scopes": { "type": "array", "description": "List of the needed scope names.", "items": { "type": "string" } } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } } }, "oauth2Flow": { "type": "object", "description": "Configuration details for a supported OAuth Flow", "properties": { "authorizationUrl": { "type": "string", "format": "uri", "description": "The authorization URL to be used for this flow. This MUST be in the form of an absolute URL." }, "tokenUrl": { "type": "string", "format": "uri", "description": "The token URL to be used for this flow. This MUST be in the form of an absolute URL." }, "refreshUrl": { "type": "string", "format": "uri", "description": "The URL to be used for obtaining refresh tokens. This MUST be in the form of an absolute URL." }, "availableScopes": { "$ref": "#/definitions/oauth2Scopes", "description": "The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it." } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false, "examples": [ { "authorizationUrl": "https://example.com/api/oauth/dialog", "tokenUrl": "https://example.com/api/oauth/token", "availableScopes": { "write:pets": "modify pets in your account", "read:pets": "read your pets" } } ] }, "oauth2Scopes": { "type": "object", "additionalProperties": { "type": "string" } }, "openIdConnect": { "type": "object", "required": [ "type", "openIdConnectUrl" ], "properties": { "type": { "type": "string", "description": "The type of the security scheme.", "enum": [ "openIdConnect" ] }, "description": { "type": "string", "description": "A short description for security scheme. CommonMark syntax MAY be used for rich text representation." }, "openIdConnectUrl": { "type": "string", "format": "uri", "description": "OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of an absolute URL." }, "scopes": { "type": "array", "description": "List of the needed scope names. An empty array means no scopes are needed.", "items": { "type": "string" } } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false }, "SaslSecurityScheme": { "oneOf": [ { "$ref": "#/definitions/SaslPlainSecurityScheme" }, { "$ref": "#/definitions/SaslScramSecurityScheme" }, { "$ref": "#/definitions/SaslGssapiSecurityScheme" } ] }, "SaslPlainSecurityScheme": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "description": "The type of the security scheme. Valid values", "enum": [ "plain" ] }, "description": { "type": "string", "description": "A short description for security scheme." } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false, "examples": [ { "type": "scramSha512" } ] }, "SaslScramSecurityScheme": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "description": "The type of the security scheme.", "enum": [ "scramSha256", "scramSha512" ] }, "description": { "type": "string", "description": "A short description for security scheme." } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false, "examples": [ { "type": "scramSha512" } ] }, "SaslGssapiSecurityScheme": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "description": "The type of the security scheme.", "enum": [ "gssapi" ] }, "description": { "type": "string", "description": "A short description for security scheme." } }, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "additionalProperties": false, "examples": [ { "type": "scramSha512" } ] }, "serverBindingsObject": { "type": "object", "description": "Map describing protocol-specific definitions for a server.", "additionalProperties": false, "patternProperties": { "^x-[\\w\\d\\.\\x2d_]+$": { "$ref": "#/definitions/specificationExtension" } }, "properties": { "http": {}, "ws": {}, "amqp": {}, "amqp1": {}, "mqtt": { "properties": { "bindingVersion": { "enum": [ "0.2.0" ] } }, "allOf": [ { "description": "If no bindingVersion specified, use the latest binding", "if": { "not": { "required": [ "bindingVersion" ] } }, "then": { "$ref": "#/definitions/bindings-mqtt-0.2.0-server" } }, { "if": { "required": [ "bindingVersion" ], "properties": { "bindingVersion": { "const": "0.2.0" } } }, "then": { "$ref": "#/definitions/bindings-mqtt-0.2.0-server" } } ] }, "kafka": { "properties": { "bindingVersion": { "enum": [ "0.5.0", "0.4.0", "0.3.0" ] } }, "allOf": [ { "description": "If no bindingVersion specified, use the latest binding", "if": { "not": { "required": [ "bindingVersion" ] } }, "then": { "$ref": "#/definitions/bindings-kafka-0.5.0-server" } }, { "if": { "required": [ "bindingVersion" ], "properties": { "bindingVersion": { "const": "0.5.0" } } }, "then": { "$ref": "#/definitions/bindings-kafka-0.5.0-server" } }, { "if": { "required": [ "bindingVersion" ], "properties": { "bindingVersion": { "const": "0.4.0" } } }, "then": { "$ref": "#/definitions/bindings-kafka-0.4.0-server" } }, { "if": { "required": [ "bindingVersion" ], "properties": { "bindingVersion": { "const": "0.3.0" } } }, "then": { "$ref": "#/definitions/bindings-kafka-0.3.0-server" } } ] }, "anypointmq": {}, "nats": {}, "jms": { "properties": { "bindingVersion": { "enum": [ "0.0.1" ] } }, "allOf": [ { "description": "If no bindingVersion specified, use the latest binding", "if": { "not": { "required": [ "bindingVersion" ] } }, "then": { "$ref": "#/definitions/bindings-jms-0.0.1-server" } }, { "if": { "required": [ "bindingVersion" ], "properties": {