From 1bd653f14cb064ffd3539418ee3af123c0f1e601 Mon Sep 17 00:00:00 2001 From: Sergio Moya <1083296+smoya@users.noreply.github.com> Date: Mon, 28 Mar 2022 15:32:32 +0200 Subject: [PATCH] refactor: update API according to latest changes (#54) --- docs/v1.md | 284 ++++++++++++++++++++++++++--------------------------- 1 file changed, 138 insertions(+), 146 deletions(-) diff --git a/docs/v1.md b/docs/v1.md index a310e15..38d673e 100644 --- a/docs/v1.md +++ b/docs/v1.md @@ -1,69 +1,63 @@ -# AsyncAPI Parser API v1.0.0-alpha.1 +# AsyncAPI Parser API v1.0.0-alpha.2 ## AsyncAPIDocument -- applicationPublishableChannels() : `Channel[]` -- applicationPublishableMessages() : `Message[]` -- applicationPublishOperations() : `Operation[]` -- applicationSubscribableChannels() : `Channel[]` -- applicationSubscribableMessages() : `Message[]` -- applicationSubscribeOperations() : `Operation[]` -- channels() : `Channel[]` -- clientPublishableChannels() : `Channel[]` -- clientPublishableMessages() : `Message[]` -- clientPublishOperations() : `Operation[]` -- clientSubscribableChannels() : `Channel[]` -- clientSubscribableMessages() : `Message[]` -- clientSubscribeOperations() : `Operation[]` +- channels() : `Channels` - defaultContentType() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` -- hasChannels() : `boolean` +- extensions : `Extensions` - hasDefaultContentType() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` -- hasServers() : `boolean` - info() : `Info` -- messages() : `Message[]` -- operations() : `Operation[]` -- schemas() : `Schema[]` -- securitySchemes() : `SecurityScheme[]` -- server(server_name) : `Server` | `undefined` - - server_name : `string` -- servers() : `Server[]` +- messages() : `Messages` +- operations() : `Operations` +- schemas() : `Schemas` +- securitySchemes() : `SecuritySchemes` +- servers() : `Servers` - version() : `string` +## Binding +- protocol() : `string` +- version() : `string` +- value() : `any` + +## Bindings +- all() : `Binding[]` +- get(id: `string`) : `Binding` | `undefined` +- has(id: `string`) : `boolean` +- isEmpty() : `boolean` + +## Channels +- all() : `Channel[]` +- filterBy(filter : `(channel: Channel) => boolean`) : `Channel[]` +- filterBySend() : `Channel[]` +- filterByReceive() : `Channel[]` +- get(id: `string`) : `Channel` | `undefined` +- has(id: `string`) : `boolean` +- isEmpty() : `boolean` + ## Channel -- binding(bindingProtocol) : `any` | `undefined` - - bindingProtocol : `enum{'amqp', 'amqps', 'http', 'https', 'jms', 'kafka', 'kafka-secure', 'mqtt', 'secure-mqtt', 'stomp', 'stomps', 'ws', 'wss'}` +- bindings() : `Bindings` - description() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` -- hasBinding(bindingProtocol) : `boolean` - - bindingProtocol : `enum{'amqp', 'amqps', 'http', 'https', 'jms', 'kafka', 'kafka-secure', 'mqtt', 'secure-mqtt', 'stomp', 'stomps', 'ws', 'wss'}` +- extensions() : `Extensions` - hasDescription() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` -- hasParameters() : `boolean` -- messages() : `Message[]` -- operations() : `Operation[]` -- parameters() : `ChannelParameter[]` -- path() : `string` +- messages() : `Messages` +- operations() : `Operations` +- parameters() : `ChannelParameters` +- servers() : `Servers` ## ChannelParameter - description() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` -- hasExtension(name) : `boolean` - - name : `string` -- name() : `string` +- extensions() : `Extensions` +- id() : `string` - schema() : `Schema` +## ChannelParameters +- all() : `ChannelParameter[]` +- get(id: `string`) : `ChannelParameter` | `undefined` +- has(id: `string`) : `boolean` +- isEmpty() : `boolean` + ## Contact - email() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` +- extensions() : `Extensions` - hasEmail() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` - hasName() : `boolean` - hasUrl() : `boolean` - name() : `string` | `undefined` @@ -71,94 +65,91 @@ ## CorrelationId - description() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` +- extensions() : `Extensions` - hasDescription() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` - hasLocation() : `boolean` - location() : `string` | `undefined` +## Extension +- id() : `string` +- version() : `string` +- value() : `any` + +## Extensions +- all() : `Extension[]` +- get(id: `string`) : `Extension` | `undefined` +- has(id: `string`) : `boolean` +- isEmpty() : `boolean` + ## ExternalDocument - description() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` +- extensions() : `Extensions` - hasDescription() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` - hasUrl() : `boolean` - url() : `string` | `undefined` ## Info -- contacts() : `Contact[]` +- contact() : `Contact | undefined` - description() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` +- extensions() : `Extensions` - externalDocs() : `ExternalDocument` | `undefined` -- hasContacts() : `boolean` +- hasContact() : `boolean` - hasDescription() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` - hasExternalDocs() : `boolean` - hasId() : `boolean` - hasLicense() : `boolean` -- hasTags() : `boolean` - hasTermsOfService() : `boolean` - id() : `string` | `undefined` - license() : `License` | `undefined` -- tags() : `Tag[]` | `undefined` +- tags() : `Tags` - termsOfService() : `string` | `undefined` - title() : `string` - version() : `string` ## License -- extension(name) : `any` | `undefined` - - name : `string` -- hasExtension(name) : `boolean` - - name : `string` +- extensions() : `Extensions` - hasUrl() : `boolean` - name() : `string` - url() : `string` | `undefined` +## Messages +- all() : `Message[]` +- filterBy(filter : `(message: Message) => boolean`) : `Message[]` +- filterBySend() : `Message[]` +- filterByReceive() : `Message[]` +- get(id: `string`) : `Message` | `undefined` +- has(id: `string`) : `boolean` +- isEmpty() : `boolean` + ## Message -- binding(bindingProtocol) : `any` | `undefined` - - bindingProtocol : `enum{'amqp', 'amqps', 'http', 'https', 'jms', 'kafka', 'kafka-secure', 'mqtt', 'secure-mqtt', 'stomp', 'stomps', 'ws', 'wss'}` -- channels() : `Channel[]` +- bindings() : `Bindings` +- channels() : `Channels` - contentType() : `string` - correlationId() : `CorrelationId` | `undefined` - description() : `string` | `undefined` - examples() : `Map[string, any][]` -- extension(name) : `any` | `undefined` - - name : `string` -- hasBinding(bindingProtocol) : `boolean` - - bindingProtocol : `enum{'amqp', 'amqps', 'http', 'https', 'jms', 'kafka', 'kafka-secure', 'mqtt', 'secure-mqtt', 'stomp', 'stomps', 'ws', 'wss'}` +- extensions() : `Extensions` - hasCorrelationId() : `boolean` - hasDescription() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` - hasHeaders() : `boolean` - hasKnownSchemaFormat() : `boolean` - hasName() : `boolean` - hasSummary() : `boolean` -- hasTags() : `boolean` - hasTitle() : `boolean` - headers() : `Schema` | `undefined` +- id() : `string` - name() : `string` | `undefined` -- operations() : `Operation[]` +- operations() : `Operations` - payload() : `Schema | any` - - `Schema` type for all [known schema formats](https://www.asyncapi.com/docs/specifications/2.0.0#messageObjectSchemaFormatTable). Otherwise, `any`. - schemaFormat() : `string` +- servers() : `Servers` - summary() : `string` | `undefined` -- tags() : `Tag[]` | `undefined` +- tags() : `Tags` - title() : `string` | `undefined` -- uid() : `string` ## OAuthFlow - authorizationUrl() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` -- hasExtension(name) : `boolean` - - name : `string` +- extensions() : `Extensions` - hasRefreshUrl() : `boolean` - refreshUrl() : `string` | `undefined` - scopes() : `Object.<string, string>` | `undefined` @@ -167,43 +158,31 @@ ## OAuthFlows - authorizationCode() : `OAuthFlow` | `undefined` - clientCredentials() : `OAuthFlow` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` +- extensions() : `Extensions` - hasAuthorizationCode() : `boolean` - hasClientCredentials() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` - hasImplicit() : `boolean` - hasPassword() : `boolean` - implicit() : `OAuthFlow` | `undefined` - password() : `OAuthFlow` | `undefined` ## Operation -- binding(bindingProtocol) : `any` | `undefined` - - bindingProtocol : `enum{'amqp', 'amqps', 'http', 'https', 'jms', 'kafka', 'kafka-secure', 'mqtt', 'secure-mqtt', 'stomp', 'stomps', 'ws', 'wss'}` +- bindings() : `Bindings` - channels() : `Channel[]` - description() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` +- extensions() : `Extensions` - externalDocs() : `ExternalDocument` | `undefined` -- hasBinding(bindingProtocol) : `boolean` - - bindingProtocol : `enum{'amqp', 'amqps', 'http', 'https', 'jms', 'kafka', 'kafka-secure', 'mqtt', 'secure-mqtt', 'stomp', 'stomps', 'ws', 'wss'}` - hasDescription() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` -- hasMultipleMessages() : `boolean` - hasSummary() : `boolean` -- hasTags() : `boolean` - id() : `string` - isApplicationPublishing() : `boolean` - isApplicationSubscribing() : `boolean` - isClientPublishing() : `boolean` - isClientSubscribing() : `boolean` - messages() : `Message[]` -- server() : `Server` - servers() : `Server[]` - summary() : `string` | `undefined` -- tags() : `Tag[]` +- tags() : `Tags` - type() : `enum{'ClientSubscribing', 'ClientPublishing', 'ApplicationSubscribing', 'ApplicationPublishing}` ## Schema @@ -223,16 +202,13 @@ - deprecated : `boolean` - discriminator : `string` | `undefined` - else : `Schema` -- extension(name) : `any` | `undefined` - - name : `string` +- extensions() : `Extensions` - enum : `any[]` - examples : `any[]` - exclusiveMaximum() : `number` | `undefined` - exclusiveMinimum : `number` | `undefined` - format : `string` | `undefined` - circularSchema : `Schema` -- hasExtension(name) : `boolean` - - name : `string` - isBooleanSchema: `boolean` - if : `Schema` - isCircular : `boolean` @@ -251,8 +227,7 @@ - pattern : `string` | `undefined` - patternProperties : `Map[string, Schema]` - properties : `Map[string, Schema]` -- property(name) : `Schema` - - name : `string` +- property(name: `string`) : `Schema` - propertyNames : `Schema` - readOnly : `boolean` | `undefined` - required : `string[]` @@ -263,67 +238,84 @@ - uniqueItems : `boolean` | `undefined` - writeOnly : `boolean` | `undefined` +## Schemas +- all() : `Schema[]` +- get(id: `string`) : `Schema` | `undefined` +- has(id: `string`) : `boolean` +- isEmpty() : `boolean` + ## SecurityScheme +- id() : `string` - bearerFormat() : `string` | `undefined` - description() : `string` -- extension(name) : `any` | `undefined` - - name : `string` +- extensions() : `Extensions` - flows() : `OAuthFlows` - hasBearerFormat() : `boolean` - hasDescription() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` - in() : `enum{'user', 'password', 'query', 'header', 'cookie'}` - openIdConnectUrl() : `string` - scheme() : `string` | `undefined` - scopes() : `string[]` - type() : `enum{'userPassword', 'apiKey', 'X509', 'symmetricEncryption', 'asymmetricEncryption', 'httpApiKey', 'http', 'oauth2', 'openIdConnect'}` -## ServerVariable -- allowedValues() : `any[]` -- defaultValue() : `string` | `undefined` -- description() : `string` | `undefined` -- examples() : `string[]` -- extension(name) : `any` | `undefined` - - name : `string` -- hasAllowedValues() : `boolean` -- hasDefaultValue() : `boolean` -- hasDescription() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` -- hasName() : `boolean` -- name() : `string` | `undefined` +# SecuritySchemes +- all() : `SecurityScheme[]` +- get(id: `string`) : `SecurityScheme` | `undefined` +- has(id: `string`) : `boolean` +- isEmpty() : `boolean` + +## Servers +- all() : `Server[]` +- filterBy(filter : `(server: Server) => boolean`) : `Server[]` +- filterBySend() : `Server[]` +- filterByReceive() : `Server[]` +- get(id: `string`) : `Server` | `undefined` +- has(id: `string`) : `boolean` +- isEmpty() : `boolean` ## Server -- binding(bindingProtocol) : `any` | `undefined` - - bindingProtocol : `enum{'amqp', 'amqps', 'http', 'https', 'jms', 'kafka', 'kafka-secure', 'mqtt', 'secure-mqtt', 'stomp', 'stomps', 'ws', 'wss'}` +- bindings() : `Bindings` +- channels() : `Channels` - description() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` -- hasBinding(bindingProtocol) : `boolean` - - bindingProtocol : `enum{'amqp', 'amqps', 'http', 'https', 'jms', 'kafka', 'kafka-secure', 'mqtt', 'secure-mqtt', 'stomp', 'stomps', 'ws', 'wss'}` +- extensions() : `Extensions` - hasDescription() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` -- hasName() : `boolean` -- hasProtocol() : `boolean` - hasProtocolVersion() : `boolean` -- hasUrl() : `boolean` +- messages() : `Messages` - name() : `string` | `undefined` -- operations() : `Operation[]` +- operations() : `Operations` - protocol() : `string` | `undefined` - protocolVersion() : `string` | `undefined` -- securitySchemes() : `SecurityScheme[]` +- securitySchemes() : `SecuritySchemes` - url() : `string` | `undefined` -- variables() : `ServerVariable[]` +- variables() : `ServerVariables` + +## ServerVariable +- allowedValues() : `any[]` +- defaultValue() : `string` | `undefined` +- description() : `string` | `undefined` +- examples() : `string[]` +- extensions() : `Extensions` +- hasAllowedValues() : `boolean` +- hasDefaultValue() : `boolean` +- hasDescription() : `boolean` +- id() : `string` + +## ServerVariables +- all() : `ServerVariable[]` +- get(name: `string`) : `ServerVariable` | `undefined` +- has(name: `string`) : `boolean` +- isEmpty() : `boolean` ## Tag - description() : `string` | `undefined` -- extension(name) : `any` | `undefined` - - name : `string` +- extensions() : `Extensions` - externalDocs() : `ExternalDocument` | `undefined` - hasDescription() : `boolean` -- hasExtension(name) : `boolean` - - name : `string` - hasExternalDocs() : `boolean` -- name() : `string` \ No newline at end of file +- name() : `string` + +## Tags +- all() : `Tag[]` +- get(name: `string`) : `Tag` | `undefined` +- has(name: `string`) : `boolean` +- isEmpty() : `boolean` \ No newline at end of file