spec

package
v0.0.0-...-7fdec46 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package spec parses and writes AsyncAPIv2 specification documents.

Does not cover all elements of AsyncAPIv2.

See https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerKeyInvalid = fmt.Errorf("server should match pattern %q", serverKeyRegexp.String())
)
View Source
var (
	ErrUnresolvedRef = errors.New("found unresolved ref")
)
View Source
var IdentifierRegExp = regexp.MustCompile(identifierPattern)

IdentifierRegExp verifies whether Component object key matches 'identifierPattern' pattern, according to OpenAPI v3.x.0. However, to be able supporting legacy OpenAPI v2.x, there is a need to customize above pattern in order not to fail converted v2-v3 validation

Functions

func ValidateIdentifier

func ValidateIdentifier(value string) error

Types

type Channel

type Channel struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Description string              `json:"description,omitempty" yaml:"description,omitempty"`
	Subscribe   *OperationRef       `json:"subscribe,omitempty" yaml:"subscribe,omitempty"`
	Publish     *OperationRef       `json:"publish,omitempty" yaml:"publish,omitempty"`
	Parameters  ParametersRefs      `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Bindings    *ChannelBindingsRef `json:"bindings,omitempty" yaml:"bindings,omitempty"`
}

Channel is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#channel-item-object

func (*Channel) MarshalJSON

func (value *Channel) MarshalJSON() ([]byte, error)

func (*Channel) UnmarshalJSON

func (value *Channel) UnmarshalJSON(data []byte) error

func (*Channel) Validate

func (value *Channel) Validate(ctx context.Context) error

type ChannelBindings

type ChannelBindings struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Http  *bindings.HttpChannel  `json:"http,omitempty" yaml:"http,omitempty"`
	Ws    *bindings.WsChannel    `json:"ws,omitempty" yaml:"ws,omitempty"`
	Kafka *bindings.KafkaChannel `json:"kafka,omitempty" yaml:"kafka,omitempty"`
	Amqp  interface{}            `json:"amqp,omitempty" yaml:"amqp,omitempty"`
	Amqp1 interface{}            `json:"amqp1,omitempty" yaml:"amqp1,omitempty"`
	Mqtt  interface{}            `json:"mqtt,omitempty" yaml:"mqtt,omitempty"`
	Mqtt5 interface{}            `json:"mqtt5,omitempty" yaml:"mqtt5,omitempty"`
	Nats  interface{}            `json:"nats,omitempty" yaml:"nats,omitempty"`
	Jms   interface{}            `json:"jms,omitempty" yaml:"jms,omitempty"`
	Sns   interface{}            `json:"sns,omitempty" yaml:"sns,omitempty"`
	Sqs   interface{}            `json:"sqs,omitempty" yaml:"sqs,omitempty"`
	Stomp interface{}            `json:"stomp,omitempty" yaml:"stomp,omitempty"`
	Redis interface{}            `json:"redis,omitempty" yaml:"redis,omitempty"`
}

ChannelBindings is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#channel-bindings-object

func (*ChannelBindings) MarshalJSON

func (value *ChannelBindings) MarshalJSON() ([]byte, error)

func (*ChannelBindings) UnmarshalJSON

func (value *ChannelBindings) UnmarshalJSON(data []byte) error

func (*ChannelBindings) Validate

func (value *ChannelBindings) Validate(ctx context.Context) error

type ChannelBindingsRef

type ChannelBindingsRef = RefG[*ChannelBindings]

type ChannelRef

type ChannelRef = RefG[*Channel]

type Channels

type Channels map[string]*Channel

Channels is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#channels-object

func (Channels) Validate

func (h Channels) Validate(ctx context.Context) error

type ChannelsBindings

type ChannelsBindings map[string]*ChannelBindings

type Components

type Components struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Schemas           openapi3.Schemas   `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	Messages          Messages           `json:"messages,omitempty" yaml:"messages,omitempty"`
	SecuritySchemes   SecuritySchemes    `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"`
	Parameters        Parameters         `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	CorrelationIds    CorrelationIDs     `json:"correlationIds,omitempty" yaml:"correlationIds,omitempty"`
	OperationTraits   OperationsTraits   `json:"operationTraits,omitempty" yaml:"operationTraits,omitempty"`
	MessageTraits     MessagesTraits     `json:"messageTraits,omitempty" yaml:"messageTraits,omitempty"`
	ServerBindings    ServersBindings    `json:"serverBindings,omitempty" yaml:"serverBindings,omitempty"`
	ChannelBindings   ChannelsBindings   `json:"channelBindings,omitempty" yaml:"channelBindings,omitempty"`
	OperationBindings OperationsBindings `json:"operationBindings,omitempty" yaml:"operationBindings,omitempty"`
	MessageBindings   MessagesBindings   `json:"messageBindings,omitempty" yaml:"messageBindings,omitempty"`
}

Components scheme is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#componentsObject

func (*Components) MarshalJSON

func (components *Components) MarshalJSON() ([]byte, error)

func (*Components) UnmarshalJSON

func (components *Components) UnmarshalJSON(data []byte) error

func (*Components) Validate

func (components *Components) Validate(ctx context.Context) (err error)

type CorrelationID

type CorrelationID struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Location    string `json:"location" yaml:"location"`
}

CorrelationID is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#correlationIdObject

func (*CorrelationID) MarshalJSON

func (value *CorrelationID) MarshalJSON() ([]byte, error)

func (*CorrelationID) UnmarshalJSON

func (value *CorrelationID) UnmarshalJSON(data []byte) error

func (*CorrelationID) Validate

func (value *CorrelationID) Validate(context.Context) error

type CorrelationIDRef

type CorrelationIDRef = RefG[*CorrelationID]

type CorrelationIDs

type CorrelationIDs map[string]*CorrelationID

type Message

type Message struct {
	MessageTrait

	Payload *openapi3.SchemaRef `json:"payload,omitempty" yaml:"payload,omitempty"`
	Traits  []*MessageTraitRef  `json:"traits,omitempty" yaml:"traits,omitempty"`
}

Message is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#message-object

func (*Message) MarshalJSON

func (value *Message) MarshalJSON() ([]byte, error)

func (*Message) UnmarshalJSON

func (value *Message) UnmarshalJSON(data []byte) error

func (*Message) Validate

func (value *Message) Validate(ctx context.Context) error

type MessageBindings

type MessageBindings struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Http  *bindings.HttpMessage  `json:"http,omitempty" yaml:"http,omitempty"`
	Ws    *bindings.WsMessage    `json:"ws,omitempty" yaml:"ws,omitempty"`
	Kafka *bindings.KafkaMessage `json:"kafka,omitempty" yaml:"kafka,omitempty"`

	Amqp  interface{} `json:"amqp,omitempty" yaml:"amqp,omitempty"`
	Amqp1 interface{} `json:"amqp1,omitempty" yaml:"amqp1,omitempty"`
	Mqtt  interface{} `json:"mqtt,omitempty" yaml:"mqtt,omitempty"`
	Mqtt5 interface{} `json:"mqtt5,omitempty" yaml:"mqtt5,omitempty"`
	Nats  interface{} `json:"nats,omitempty" yaml:"nats,omitempty"`
	Jms   interface{} `json:"jms,omitempty" yaml:"jms,omitempty"`
	Sns   interface{} `json:"sns,omitempty" yaml:"sns,omitempty"`
	Sqs   interface{} `json:"sqs,omitempty" yaml:"sqs,omitempty"`
	Stomp interface{} `json:"stomp,omitempty" yaml:"stomp,omitempty"`
	Redis interface{} `json:"redis,omitempty" yaml:"redis,omitempty"`
}

MessageBindings is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#message-bindings-object

func (*MessageBindings) MarshalJSON

func (value *MessageBindings) MarshalJSON() ([]byte, error)

func (*MessageBindings) UnmarshalJSON

func (value *MessageBindings) UnmarshalJSON(data []byte) error

func (*MessageBindings) Validate

func (value *MessageBindings) Validate(ctx context.Context) error

type MessageBindingsRef

type MessageBindingsRef = RefG[*MessageBindings]

type MessageOneOf

type MessageOneOf struct {
	MessageRef

	OneOf []*MessageRef
}

func (*MessageOneOf) MarshalJSON

func (value *MessageOneOf) MarshalJSON() ([]byte, error)

func (*MessageOneOf) UnmarshalJSON

func (value *MessageOneOf) UnmarshalJSON(data []byte) error

func (*MessageOneOf) Validate

func (value *MessageOneOf) Validate(ctx context.Context) error

type MessageRef

type MessageRef = RefG[*Message]

type MessageTrait

type MessageTrait struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Headers       *openapi3.SchemaRef      `json:"headers,omitempty" yaml:"headers,omitempty"`
	CorrelationID *CorrelationIDRef        `json:"correlationId,omitempty" yaml:"correlationId,omitempty"`
	SchemaFormat  string                   `json:"schemaFormat,omitempty" yaml:"schemaFormat,omitempty"`
	ContentType   string                   `json:"contentType,omitempty" yaml:"contentType,omitempty"`
	Name          string                   `json:"name,omitempty" yaml:"name,omitempty"`
	Title         string                   `json:"title,omitempty" yaml:"title,omitempty"`
	Summary       string                   `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description   string                   `json:"description,omitempty" yaml:"description,omitempty"`
	Tags          openapi3.Tags            `json:"tags,omitempty" yaml:"tags,omitempty"`
	ExternalDocs  *openapi3.ExternalDocs   `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	Bindings      *MessageBindings         `json:"bindings,omitempty" yaml:"bindings,omitempty"`
	Examples      []map[string]interface{} `json:"examples,omitempty" yaml:"examples,omitempty"`
}

MessageTrait is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#message-trait-object

func (*MessageTrait) MarshalJSON

func (value *MessageTrait) MarshalJSON() ([]byte, error)

func (*MessageTrait) UnmarshalJSON

func (value *MessageTrait) UnmarshalJSON(data []byte) error

func (*MessageTrait) Validate

func (value *MessageTrait) Validate(ctx context.Context) error

type MessageTraitRef

type MessageTraitRef = RefG[*MessageTrait]

type Messages

type Messages map[string]*Message

type MessagesBindings

type MessagesBindings map[string]*MessageBindings

type MessagesTraits

type MessagesTraits map[string]*MessageTrait

type OAuthFlowObject

type OAuthFlowObject struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	AuthorizationUrl string            `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"`
	TokenUrl         string            `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"`
	RefreshUrl       string            `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"`
	Scopes           map[string]string `json:"scopes" yaml:"scopes"`
}

OAuthFlowObject is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#oauth-flow-object

func (*OAuthFlowObject) MarshalJSON

func (value *OAuthFlowObject) MarshalJSON() ([]byte, error)

func (*OAuthFlowObject) UnmarshalJSON

func (value *OAuthFlowObject) UnmarshalJSON(data []byte) error

func (*OAuthFlowObject) Validate

func (value *OAuthFlowObject) Validate(ctx context.Context) error

type OAuthFlows

type OAuthFlows struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Implicit          *OAuthFlowObject `json:"implicit,omitempty" yaml:"implicit,omitempty"`
	Password          *OAuthFlowObject `json:"password,omitempty" yaml:"password,omitempty"`
	ClientCredentials *OAuthFlowObject `json:"clientCredentials,omitempty" yaml:"clientCredentials,omitempty"`
	AuthorizationCode *OAuthFlowObject `json:"authorizationCode,omitempty" yaml:"authorizationCode,omitempty"`
}

OAuthFlows is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#oauthFlowsObject

func (*OAuthFlows) MarshalJSON

func (value *OAuthFlows) MarshalJSON() ([]byte, error)

func (*OAuthFlows) UnmarshalJSON

func (value *OAuthFlows) UnmarshalJSON(data []byte) error

func (*OAuthFlows) Validate

func (value *OAuthFlows) Validate(ctx context.Context) error

type Operation

type Operation struct {
	OperationTrait

	Traits  []*OperationTraitRef `json:"traits,omitempty" yaml:"traits,omitempty"`
	Message *MessageOneOf        `json:"message,omitempty" yaml:"message,omitempty"`
}

Operation is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#operation-object

func (*Operation) MarshalJSON

func (value *Operation) MarshalJSON() ([]byte, error)

func (*Operation) UnmarshalJSON

func (value *Operation) UnmarshalJSON(data []byte) error

func (*Operation) Validate

func (value *Operation) Validate(ctx context.Context) error

type OperationBindings

type OperationBindings struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Http  *bindings.HttpOperation  `json:"http,omitempty" yaml:"http,omitempty"`
	Ws    *bindings.WsOperation    `json:"ws,omitempty" yaml:"ws,omitempty"`
	Kafka *bindings.KafkaOperation `json:"kafka,omitempty" yaml:"kafka,omitempty"`

	Amqp  interface{} `json:"amqp,omitempty" yaml:"amqp,omitempty"`
	Amqp1 interface{} `json:"amqp1,omitempty" yaml:"amqp1,omitempty"`
	Mqtt  interface{} `json:"mqtt,omitempty" yaml:"mqtt,omitempty"`
	Mqtt5 interface{} `json:"mqtt5,omitempty" yaml:"mqtt5,omitempty"`
	Nats  interface{} `json:"nats,omitempty" yaml:"nats,omitempty"`
	Jms   interface{} `json:"jms,omitempty" yaml:"jms,omitempty"`
	Sns   interface{} `json:"sns,omitempty" yaml:"sns,omitempty"`
	Sqs   interface{} `json:"sqs,omitempty" yaml:"sqs,omitempty"`
	Stomp interface{} `json:"stomp,omitempty" yaml:"stomp,omitempty"`
	Redis interface{} `json:"redis,omitempty" yaml:"redis,omitempty"`
}

OperationBindings is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#operation-bindings-object

func (*OperationBindings) MarshalJSON

func (value *OperationBindings) MarshalJSON() ([]byte, error)

func (*OperationBindings) UnmarshalJSON

func (value *OperationBindings) UnmarshalJSON(data []byte) error

func (*OperationBindings) Validate

func (value *OperationBindings) Validate(ctx context.Context) error

type OperationBindingsRef

type OperationBindingsRef = RefG[*OperationBindings]

type OperationRef

type OperationRef = RefG[*Operation]

type OperationTrait

type OperationTrait struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	OperationID  string                 `json:"operationId,omitempty" yaml:"operationId,omitempty"`
	Summary      string                 `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description  string                 `json:"description,omitempty" yaml:"description,omitempty"`
	Tags         openapi3.Tags          `json:"tags,omitempty" yaml:"tags,omitempty"`
	ExternalDocs *openapi3.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	Bindings     *OperationBindings     `json:"bindings,omitempty" yaml:"bindings,omitempty"`
}

OperationTrait is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#operationTraitObject

func (*OperationTrait) MarshalJSON

func (value *OperationTrait) MarshalJSON() ([]byte, error)

func (*OperationTrait) UnmarshalJSON

func (value *OperationTrait) UnmarshalJSON(data []byte) error

func (*OperationTrait) Validate

func (value *OperationTrait) Validate(ctx context.Context) error

type OperationTraitRef

type OperationTraitRef = RefG[*OperationTrait]

type OperationsBindings

type OperationsBindings map[string]*OperationBindings

type OperationsTraits

type OperationsTraits map[string]*OperationTrait

type Parameter

type Parameter struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Description string           `json:"description,omitempty" yaml:"description,omitempty"`
	Schema      *openapi3.Schema `json:"schema,omitempty" yaml:"schema,omitempty"`
	Location    string           `json:"location,omitempty" yaml:"location,omitempty"`
}

Parameter is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#parameterObject

func (*Parameter) MarshalJSON

func (value *Parameter) MarshalJSON() ([]byte, error)

func (*Parameter) UnmarshalJSON

func (value *Parameter) UnmarshalJSON(data []byte) error

func (*Parameter) Validate

func (value *Parameter) Validate(ctx context.Context) error

type ParameterRef

type ParameterRef = RefG[*Parameter]

type Parameters

type Parameters map[string]*Parameter

type ParametersRefs

type ParametersRefs map[string]*ParameterRef

ParametersRefs is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#parameters-object

func (ParametersRefs) Validate

func (h ParametersRefs) Validate(ctx context.Context) error

type Ref

type Ref struct {
	Ref string `json:"$ref" yaml:"$ref"`
}

type RefG

type RefG[V interface {
	comparable

	json.Marshaler
	json.Unmarshaler

	Validate(ctx context.Context) error
}] struct {
	Ref   string
	Value V
}

func (*RefG[V]) MarshalJSON

func (value *RefG[V]) MarshalJSON() ([]byte, error)

func (*RefG[V]) UnmarshalJSON

func (value *RefG[V]) UnmarshalJSON(data []byte) error

func (*RefG[V]) Validate

func (value *RefG[V]) Validate(ctx context.Context) error

type SecurityRequirements

type SecurityRequirements map[string][]string

SecurityRequirements is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#securityRequirementObject

type SecurityScheme

type SecurityScheme struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Type             string      `json:"type" yaml:"type"`
	Description      string      `json:"description,omitempty" yaml:"description,omitempty"`
	Name             string      `json:"name,omitempty" yaml:"name,omitempty"`
	In               string      `json:"in,omitempty" yaml:"in,omitempty"`
	Scheme           string      `json:"scheme,omitempty" yaml:"scheme,omitempty"`
	BearerFormat     string      `json:"bearerFormat,omitempty" yaml:"bearerFormat,omitempty"`
	Flows            *OAuthFlows `json:"flows,omitempty" yaml:"flows,omitempty"`
	OpenIDConnectUrl string      `json:"openIdConnectUrl,omitempty" yaml:"openIdConnectUrl,omitempty"`
}

SecurityScheme is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#security-scheme-object

func (*SecurityScheme) MarshalJSON

func (value *SecurityScheme) MarshalJSON() ([]byte, error)

func (*SecurityScheme) UnmarshalJSON

func (value *SecurityScheme) UnmarshalJSON(data []byte) error

func (*SecurityScheme) Validate

func (value *SecurityScheme) Validate(ctx context.Context) error

type SecuritySchemes

type SecuritySchemes map[string]*SecurityScheme

type Server

type Server struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	URL             string                     `json:"url" yaml:"url"`
	Protocol        string                     `json:"protocol" yaml:"protocol"`
	ProtocolVersion string                     `json:"protocolVersion,omitempty" yaml:"protocolVersion,omitempty"`
	Description     string                     `json:"description,omitempty" yaml:"description,omitempty"`
	Security        []SecurityRequirements     `json:"security,omitempty" yaml:"security,omitempty"`
	Bindings        *ServerBindings            `json:"bindings,omitempty" yaml:"bindings,omitempty"`
	Variables       map[string]*ServerVariable `json:"variables,omitempty" yaml:"variables,omitempty"`
}

Server is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#serverObject

func (*Server) MarshalJSON

func (value *Server) MarshalJSON() ([]byte, error)

func (*Server) MatchRawURL

func (value *Server) MatchRawURL(input string) ([]string, string, bool)

func (*Server) ParameterNames

func (value *Server) ParameterNames() ([]string, error)

func (*Server) UnmarshalJSON

func (value *Server) UnmarshalJSON(data []byte) error

func (*Server) Validate

func (value *Server) Validate(ctx context.Context) (err error)

type ServerBindings

type ServerBindings struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Http  *bindings.HttpServer  `json:"http,omitempty" yaml:"http,omitempty"`
	Ws    *bindings.WsServer    `json:"ws,omitempty" yaml:"ws,omitempty"`
	Kafka *bindings.KafkaServer `json:"kafka,omitempty" yaml:"kafka,omitempty"`

	Amqp  interface{} `json:"amqp,omitempty" yaml:"amqp,omitempty"`
	Amqp1 interface{} `json:"amqp1,omitempty" yaml:"amqp1,omitempty"`
	Mqtt  interface{} `json:"mqtt,omitempty" yaml:"mqtt,omitempty"`
	Mqtt5 interface{} `json:"mqtt5,omitempty" yaml:"mqtt5,omitempty"`
	Nats  interface{} `json:"nats,omitempty" yaml:"nats,omitempty"`
	Jms   interface{} `json:"jms,omitempty" yaml:"jms,omitempty"`
	Sns   interface{} `json:"sns,omitempty" yaml:"sns,omitempty"`
	Sqs   interface{} `json:"sqs,omitempty" yaml:"sqs,omitempty"`
	Stomp interface{} `json:"stomp,omitempty" yaml:"stomp,omitempty"`
	Redis interface{} `json:"redis,omitempty" yaml:"redis,omitempty"`
}

ServerBindings is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#server-bindings-object

func (*ServerBindings) MarshalJSON

func (value *ServerBindings) MarshalJSON() ([]byte, error)

func (*ServerBindings) UnmarshalJSON

func (value *ServerBindings) UnmarshalJSON(data []byte) error

func (*ServerBindings) Validate

func (value *ServerBindings) Validate(ctx context.Context) error

type ServerBindingsRef

type ServerBindingsRef = RefG[*ServerBindings]

type ServerVariable

type ServerVariable struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	Enum        []string `json:"enum,omitempty" yaml:"enum,omitempty"`
	Default     string   `json:"default,omitempty" yaml:"default,omitempty"`
	Description string   `json:"description,omitempty" yaml:"description,omitempty"`
}

ServerVariable is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#serverVariableObject

func (*ServerVariable) MarshalJSON

func (value *ServerVariable) MarshalJSON() ([]byte, error)

func (*ServerVariable) UnmarshalJSON

func (value *ServerVariable) UnmarshalJSON(data []byte) error

func (*ServerVariable) Validate

func (value *ServerVariable) Validate(context.Context) error

type Servers

type Servers map[string]*Server

Servers object is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#serversObject

func (Servers) MatchURL

func (servers Servers) MatchURL(parsedURL *url.URL) (*Server, []string, string)

func (Servers) Validate

func (servers Servers) Validate(ctx context.Context) error

type ServersBindings

type ServersBindings map[string]*ServerBindings

type T

type T struct {
	Extensions map[string]interface{} `json:"-" yaml:"-"`

	AsyncAPI           string                 `json:"asyncapi" yaml:"asyncapi"`
	ID                 string                 `json:"id,omitempty" yaml:"id,omitempty"`
	Info               *openapi3.Info         `json:"info" yaml:"info"`
	DefaultContentType string                 `json:"defaultContentType" yaml:"defaultContentType"`
	Servers            Servers                `json:"servers,omitempty" yaml:"servers,omitempty"`
	Channels           Channels               `json:"channels,omitempty" yaml:"channels,omitempty"`
	Components         *Components            `json:"components,omitempty" yaml:"components,omitempty"`
	Tags               openapi3.Tags          `json:"tags,omitempty" yaml:"tags,omitempty"`
	ExternalDocs       *openapi3.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}

T is the root of an OpenAPI v3 document T is defined in AsyncAPI spec: https://github.com/asyncapi/spec/blob/2.0.0/versions/2.0.0/asyncapi.md#A2SObject

func (*T) MarshalJSON

func (doc *T) MarshalJSON() ([]byte, error)

func (*T) UnmarshalJSON

func (doc *T) UnmarshalJSON(data []byte) error

func (*T) Validate

func (doc *T) Validate(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL