Documentation
¶
Index ¶
- Constants
- type AMQP1Binding
- type AMQPBinding
- type AnyPointMqBinding
- type Channel
- type ChannelBindings
- type Components
- type Contact
- type CorrelationID
- type Extensions
- type ExternalDocumentation
- type GoTypeImportExtension
- type GoTypeImportName
- type GoTypeImportPath
- type GooglePubSubBinding
- type HTTPBinding
- type IBMMQBinding
- type Info
- type JMSBinding
- type KafkaBinding
- type License
- type MQTT5Binding
- type MQTTBinding
- type MercureBinding
- type Message
- type MessageBindings
- type MessageExample
- type MessageField
- type MessageTrait
- type MessageType
- type NATSBinding
- type OAuthFlow
- type OAuthFlows
- type Operation
- type OperationAction
- type OperationBindings
- type OperationReply
- type OperationReplyAddress
- type OperationTrait
- type Parameter
- type PulsarBinding
- type RedisBinding
- type SNSBinding
- type SQSBinding
- type Schema
- type SecurityScheme
- type Server
- type ServerBindings
- type ServerVariable
- type SolaceBinding
- type Specification
- func (s Specification) CustomImports() ([]string, error)
- func (s Specification) GetOperationCountByAction() (sendCount, receiveCount uint)
- func (s Specification) MajorVersion() int
- func (s *Specification) Process()
- func (s Specification) ReferenceChannel(ref string) *Channel
- func (s Specification) ReferenceChannelBindings(ref string) *ChannelBindings
- func (s Specification) ReferenceExternalDocumentation(ref string) *ExternalDocumentation
- func (s Specification) ReferenceMessage(ref string) *Message
- func (s Specification) ReferenceMessageBindings(ref string) *MessageBindings
- func (s Specification) ReferenceMessageExample(ref string) *MessageExample
- func (s Specification) ReferenceMessageTrait(ref string) *MessageTrait
- func (s Specification) ReferenceOperation(ref string) *Operation
- func (s Specification) ReferenceOperationBindings(ref string) *OperationBindings
- func (s Specification) ReferenceOperationReply(ref string) *OperationReply
- func (s Specification) ReferenceOperationReplyAddress(ref string) *OperationReplyAddress
- func (s Specification) ReferenceOperationTrait(ref string) *OperationTrait
- func (s Specification) ReferenceParameter(ref string) *Parameter
- func (s Specification) ReferenceSchema(ref string) *Schema
- func (s Specification) ReferenceSecurity(ref string) *SecurityScheme
- func (s Specification) ReferenceServer(ref string) *Server
- func (s Specification) ReferenceServerBindings(ref string) *ServerBindings
- func (s Specification) ReferenceServerVariable(ref string) *ServerVariable
- func (s Specification) ReferenceTag(ref string) *Tag
- type StompBinding
- type Tag
- type WsBinding
Constants ¶
const (
// BindingsSuffix is the suffix added to the bindings name.
BindingsSuffix = "Bindings"
)
const (
// ChannelSuffix is the suffix added to the channels name.
ChannelSuffix = "Channel"
)
const (
// ExternalDocsNameSuffix is the suffix that is added to the name of external docs.
ExternalDocsNameSuffix = "ExternalDocs"
)
const (
// MajorVersion is the major version of this AsyncAPI implementation.
MajorVersion = 3
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AMQP1Binding ¶
type AMQP1Binding any
AMQP1Binding represents protocol-specific information for an AMQP 1.0 channel.
type AMQPBinding ¶
type AMQPBinding any
AMQPBinding represents protocol-specific information for an AMQP 0-9-1 channel.
type AnyPointMqBinding ¶
type AnyPointMqBinding any
AnyPointMqBinding represents protocol-specific information for an Anypoint MQ channel.
type Channel ¶
type Channel struct { Address string `json:"address"` Messages map[string]*Message `json:"messages"` Title string `json:"title"` Summary string `json:"summary"` Description string `json:"description"` Servers []*Server `json:"servers"` Parameters map[string]*Parameter `json:"parameters"` Tags []*Tag `json:"tags"` ExternalDocs *ExternalDocumentation `json:"externalDocs"` Bindings *ChannelBindings `json:"bindings"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *Channel `json:"-"` }
Channel is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#channelObject
func (Channel) GetMessage ¶
GetMessage will return the channel message.
func (*Channel) Process ¶
func (ch *Channel) Process(path string, spec Specification)
Process processes the Channel to make it ready for code generation.
type ChannelBindings ¶
type ChannelBindings struct { HTTP HTTPBinding `json:"http"` WS WsBinding `json:"ws"` Kafka KafkaBinding `json:"kafka"` AnyPointMQ AnyPointMqBinding `json:"anypointmq"` AMQP AMQPBinding `json:"amqp"` AMQP1 AMQP1Binding `json:"amqp1"` MQTT MQTTBinding `json:"mqtt"` MQTT5 MQTT5Binding `json:"mqtt5"` NATS NATSBinding `json:"nats"` JMS JMSBinding `json:"jms"` SNS SNSBinding `json:"sns"` Solace SolaceBinding `json:"solace"` SQS SQSBinding `json:"sqs"` Stomp StompBinding `json:"stomp"` Redis RedisBinding `json:"redis"` Mercure MercureBinding `json:"mercure"` IBMMQ IBMMQBinding `json:"ibmmq"` GooglePubSub GooglePubSubBinding `json:"googlepubsub"` Pulsar PulsarBinding `json:"pulsar"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *ChannelBindings `json:"-"` }
ChannelBindings is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#channelBindingsObject
func (*ChannelBindings) Process ¶
func (chb *ChannelBindings) Process(name string, spec Specification)
Process processes the ChannelBindings to make it ready for code generation.
type Components ¶
type Components struct { Schemas map[string]*Schema `json:"schemas"` Servers map[string]*Server `json:"servers"` Channels map[string]*Channel `json:"channels"` Operations map[string]*Operation `json:"operations"` Messages map[string]*Message `json:"messages"` SecuritySchemes map[string]*SecurityScheme `json:"securitySchemes"` ServerVariables map[string]*ServerVariable `json:"serverVariables"` Parameters map[string]*Parameter `json:"parameters"` CorrelationIDs map[string]*CorrelationID `json:"correlationIds"` Replies map[string]*OperationReply `json:"replies"` ReplyAddresses map[string]*OperationReplyAddress `json:"replyAddresses"` ExternalDocs map[string]*ExternalDocumentation `json:"externalDocs"` Tags map[string]*Tag `json:"tags"` OperationTraits map[string]*OperationTrait `json:"operationTraits"` MessageTraits map[string]*MessageTrait `json:"messageTraits"` ServerBindings map[string]*ServerBindings `json:"serverBindings"` ChannelBindings map[string]*ChannelBindings `json:"channelBindings"` OperationBindings map[string]*OperationBindings `json:"operationBindings"` MessageBindings map[string]*MessageBindings `json:"messageBindings"` }
Components is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#componentsObject
func (*Components) Process ¶
func (c *Components) Process(spec Specification)
Process processes the Components structure to make it ready for code generation.
type Contact ¶
type Contact struct { Name string `json:"name"` URL string `json:"url"` Email string `json:"email"` }
Contact is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#contactObject
type CorrelationID ¶
type CorrelationID struct { Description string `json:"description"` Location string `json:"location"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *Channel `json:"-"` }
CorrelationID is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#correlationIdObject
func (*CorrelationID) Exists ¶ added in v0.33.0
func (c *CorrelationID) Exists() bool
Exists checks that the correlation exists (and that the location is set).
func (*CorrelationID) Process ¶
func (c *CorrelationID) Process(path string, spec Specification)
Process processes the CorrelationID to make it ready for code generation.
type Extensions ¶
type Extensions struct { // Setting custom Go type when generating schemas ExtGoType string `json:"x-go-type"` // Setting custom import statements for ExtGoType ExtGoTypeImport *GoTypeImportExtension `json:"x-go-type-import"` }
Extensions holds additional properties defined for asyncapi-codegen that are out of the AsyncAPI spec.
type ExternalDocumentation ¶
type ExternalDocumentation struct { Description string `json:"description"` URL string `json:"url"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *ExternalDocumentation `json:"-"` }
ExternalDocumentation is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#externalDocumentationObject
func (*ExternalDocumentation) Process ¶
func (doc *ExternalDocumentation) Process(name string, spec Specification)
Process processes the ExternalDocumentation to make it ready for code generation.
type GoTypeImportExtension ¶
type GoTypeImportExtension struct { Name GoTypeImportName `json:"name"` // Package name for import, optional Path GoTypeImportPath `json:"path"` // Path to package to import }
GoTypeImportExtension specifies the required import statement for the x-go-type extension. For example, GoTypeImportExtension{Name: "myuuid", Path: "github.com/google/uuid"} will generate `import myuuid github.com/google/uuid`.
type GoTypeImportName ¶
type GoTypeImportName string
GoTypeImportName is the import name type for x-go-type-import.
type GoTypeImportPath ¶
type GoTypeImportPath string
GoTypeImportPath is the import path type for x-go-type-import.
type GooglePubSubBinding ¶
type GooglePubSubBinding any
GooglePubSubBinding represents protocol-specific information for a Google Cloud Pub/Sub channel.
type HTTPBinding ¶
type HTTPBinding any
HTTPBinding represents protocol-specific information for an HTTP channel.
type IBMMQBinding ¶
type IBMMQBinding any
IBMMQBinding represents protocol-specific information for an IBM MQ channel.
type Info ¶
type Info struct { Title string `json:"title"` Version string `json:"version"` Description string `json:"description"` TermsOfService string `json:"termsOfService"` Contact *Contact `json:"contact"` License *License `json:"license"` Tags []*Tag `json:"tags"` ExternalDocs *ExternalDocumentation `json:"externalDocs"` }
Info is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#infoObject
func (*Info) Process ¶
func (info *Info) Process(spec Specification)
Process processes the Info to make it ready for code generation.
type JMSBinding ¶
type JMSBinding any
JMSBinding represents protocol-specific information for a JMS channel.
type KafkaBinding ¶
type KafkaBinding any
KafkaBinding represents protocol-specific information for a Kafka channel.
type License ¶
License is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#licenseObject
type MQTT5Binding ¶
type MQTT5Binding any
MQTT5Binding represents protocol-specific information for an MQTT 5 channel.
type MQTTBinding ¶
type MQTTBinding any
MQTTBinding represents protocol-specific information for an MQTT channel.
type MercureBinding ¶
type MercureBinding any
MercureBinding represents protocol-specific information for a Mercure channel.
type Message ¶
type Message struct { Headers *Schema `json:"headers"` Payload *Schema `json:"payload"` OneOf []*Message `json:"oneOf"` CorrelationID *CorrelationID `json:"correlationID"` ContentType string `json:"contentType"` Name string `json:"name"` Title string `json:"title"` Summary string `json:"summary"` Description string `json:"description"` Tags []*Tag `json:"tags"` ExternalDocs *ExternalDocumentation `json:"externalDocs"` Bindings *MessageBindings `json:"bindings"` Examples []*MessageExample `json:"examples"` Traits []*MessageTrait `json:"traits"` Reference string `json:"$ref"` ReferenceTo *Message `json:"-"` // CorrelationIDLocation will indicate where the correlation id is // According to: https://www.asyncapi.com/docs/reference/specification/v3.0.0#correlationIdObject CorrelationIDRequired bool `json:"-"` }
Message is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#messageObject
func (*Message) ApplyTrait ¶
func (msg *Message) ApplyTrait(mt *MessageTrait, spec Specification)
ApplyTrait applies a trait to the message.
func (Message) HaveCorrelationID ¶ added in v0.33.0
HaveCorrelationID check that the message have a correlation ID.
func (*Message) MergeWith ¶
func (msg *Message) MergeWith(spec Specification, msg2 Message)
MergeWith merges the Message with another one.
func (*Message) Process ¶
func (msg *Message) Process(name string, spec Specification)
Process processes the Message to make it ready for code generation.
type MessageBindings ¶
type MessageBindings struct { HTTP HTTPBinding `json:"http"` WS WsBinding `json:"ws"` Kafka KafkaBinding `json:"kafka"` AnyPointMQ AnyPointMqBinding `json:"anypointmq"` AMQP AMQPBinding `json:"amqp"` AMQP1 AMQP1Binding `json:"amqp1"` MQTT MQTTBinding `json:"mqtt"` MQTT5 MQTT5Binding `json:"mqtt5"` NATS NATSBinding `json:"nats"` JMS JMSBinding `json:"jms"` SNS SNSBinding `json:"sns"` Solace SolaceBinding `json:"solace"` SQS SQSBinding `json:"sqs"` Stomp StompBinding `json:"stomp"` Redis RedisBinding `json:"redis"` Mercure MercureBinding `json:"mercure"` IBMMQ IBMMQBinding `json:"ibmmq"` GooglePubSub GooglePubSubBinding `json:"googlepubsub"` Pulsar PulsarBinding `json:"pulsar"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *MessageBindings `json:"-"` }
MessageBindings is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#messageBindingsObject
func (*MessageBindings) Process ¶
func (mb *MessageBindings) Process(name string, spec Specification)
Process processes the MessageBindings to make it ready for code generation.
type MessageExample ¶
type MessageExample struct { Headers map[string]any `json:"headers"` Payload map[string]any `json:"payload"` Name string `json:"name"` Summary string `json:"summary"` Reference string `json:"$ref"` ReferenceTo *MessageExample `json:"-"` }
MessageExample is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#messageExampleObject
func (*MessageExample) Process ¶
func (me *MessageExample) Process(path string, spec Specification)
Process processes the MessageExample to make it ready for code generation.
type MessageField ¶
type MessageField string
MessageField is a structure that represents the type of a field.
const ( // MessageFieldIsHeader represents the message field of a header. MessageFieldIsHeader MessageField = "header" // MessageFieldIsPayload represents the message field of a payload. MessageFieldIsPayload MessageField = "payload" )
func (MessageField) String ¶
func (t MessageField) String() string
String returns the string representation of the type.
type MessageTrait ¶
type MessageTrait struct { Headers *Schema `json:"headers"` Payload *Schema `json:"payload"` CorrelationID *CorrelationID `json:"correlationID"` ContentType string `json:"contentType"` Name string `json:"name"` Title string `json:"title"` Summary string `json:"summary"` Description string `json:"description"` Tags []*Tag `json:"tags"` ExternalDocs *ExternalDocumentation `json:"externalDocs"` Bindings *MessageBindings `json:"bindings"` Examples []*MessageExample `json:"examples"` Reference string `json:"$ref"` ReferenceTo *MessageTrait `json:"-"` // CorrelationIDLocation will indicate where the correlation id is // According to: https://www.asyncapi.com/docs/reference/specification/v3.0.0#correlationIdObject CorrelationIDLocation string `json:"-"` CorrelationIDRequired bool `json:"-"` }
MessageTrait is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#messageTraitObject
func (*MessageTrait) Follow ¶
func (mt *MessageTrait) Follow() *MessageTrait
Follow returns referenced MessageTrait if specified or the actual MessageTrait.
func (*MessageTrait) Process ¶
func (mt *MessageTrait) Process(name string, spec Specification)
Process processes the MessageTrait to make it ready for code generation.
type MessageType ¶
type MessageType string
MessageType is a structure that represents the type of a field.
const ( // MessageTypeIsArray represents the type of an array. MessageTypeIsArray MessageType = "array" // MessageTypeIsHeader represents the type of a header. MessageTypeIsHeader MessageType = "header" // MessageTypeIsObject represents the type of an object. MessageTypeIsObject MessageType = "object" // MessageTypeIsString represents the type of a string. MessageTypeIsString MessageType = "string" // MessageTypeIsInteger represents the type of an integer. MessageTypeIsInteger MessageType = "integer" // MessageTypeIsPayload represents the type of a payload. MessageTypeIsPayload MessageType = "payload" )
func (MessageType) String ¶
func (t MessageType) String() string
String returns the string representation of the type.
type NATSBinding ¶
type NATSBinding any
NATSBinding represents protocol-specific information for a NATS channel.
type OAuthFlow ¶
type OAuthFlow struct { AuthorizationURL string `json:"authorizationUrl"` TokenURL string `json:"tokenUrl"` RefreshURL string `json:"refreshUrl"` AvailableScopes map[string]string `json:"availableScopes"` }
OAuthFlow is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#oauthFlowObject
type OAuthFlows ¶
type OAuthFlows struct { Implicit OAuthFlow `json:"implicit"` Password OAuthFlow `json:"password"` ClientCredentials OAuthFlow `json:"clientCredential"` AuthorizationCode OAuthFlow `json:"authorizationCode"` }
OAuthFlows is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#oauthFlowsObject
type Operation ¶
type Operation struct { Action OperationAction `json:"action"` Channel *Channel `json:"channel"` // Reference only Title string `json:"title"` Summary string `json:"summary"` Description string `json:"string"` Security []*SecurityScheme `json:"security"` Tags []*Tag `json:"tags"` ExternalDocs *ExternalDocumentation `json:"externalDocs"` Bindings *OperationBindings `json:"bindings"` Traits []*OperationTrait `json:"traits"` Messages []*Message `json:"messages"` // References only Reply *OperationReply `json:"reply"` Reference string `json:"$ref"` Name string `json:"-"` ReplyIs *Operation `json:"-"` ReplyOf *Operation `json:"-"` ReferenceTo *Operation `json:"-"` }
Operation is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#operationObject
func (*Operation) ApplyTrait ¶
func (op *Operation) ApplyTrait(ot *OperationTrait, spec Specification)
ApplyTrait applies a trait to the operation.
func (*Operation) Follow ¶
Follow returns referenced operation if specified or the actual operation.
func (Operation) GetMessage ¶
GetMessage will return the operation message.
func (*Operation) Process ¶
func (op *Operation) Process(name string, spec Specification)
Process processes the Channel to make it ready for code generation.
type OperationAction ¶
type OperationAction string
OperationAction represents an OperationAction.
const ( // OperationActionIsSend represents a send action. OperationActionIsSend OperationAction = "send" // OperationActionIsReceive represents a receive action. OperationActionIsReceive OperationAction = "receive" )
func (OperationAction) IsReceive ¶
func (oa OperationAction) IsReceive() bool
IsReceive returns true if the operation action is receive.
func (OperationAction) IsSend ¶
func (oa OperationAction) IsSend() bool
IsSend returns true if the operation action is send.
type OperationBindings ¶
type OperationBindings struct { HTTP HTTPBinding `json:"http"` WS WsBinding `json:"ws"` Kafka KafkaBinding `json:"kafka"` AnyPointMQ AnyPointMqBinding `json:"anypointmq"` AMQP AMQPBinding `json:"amqp"` AMQP1 AMQP1Binding `json:"amqp1"` MQTT MQTTBinding `json:"mqtt"` MQTT5 MQTT5Binding `json:"mqtt5"` NATS NATSBinding `json:"nats"` JMS JMSBinding `json:"jms"` SNS SNSBinding `json:"sns"` Solace SolaceBinding `json:"solace"` SQS SQSBinding `json:"sqs"` Stomp StompBinding `json:"stomp"` Redis RedisBinding `json:"redis"` Mercure MercureBinding `json:"mercure"` IBMMQ IBMMQBinding `json:"ibmmq"` GooglePubSub GooglePubSubBinding `json:"googlepubsub"` Pulsar PulsarBinding `json:"pulsar"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *OperationBindings `json:"-"` }
OperationBindings is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#operationBindingsObject
func (*OperationBindings) Process ¶
func (ob *OperationBindings) Process(name string, spec Specification)
Process processes the OperationBinding to make it ready for code generation.
type OperationReply ¶
type OperationReply struct { Address *OperationReplyAddress `json:"address"` Channel *Channel `json:"channel"` // Reference only Messages []*Message `json:"messages"` // References only Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *OperationReply `json:"-"` }
OperationReply is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#operationReplyObject
func (*OperationReply) Process ¶
func (or *OperationReply) Process(name string, op *Operation, spec Specification)
Process processes the OperationReply to make it ready for code generation.
type OperationReplyAddress ¶
type OperationReplyAddress struct { Description string `json:"description"` Location string `json:"location"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *OperationReplyAddress `json:"-"` LocationTo *Schema `json:"-"` LocationRequired bool `json:"-"` }
OperationReplyAddress is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#operationReplyAddressObject
func (*OperationReplyAddress) Process ¶
func (ora *OperationReplyAddress) Process(name string, op *Operation, spec Specification)
Process processes the OperationReplyAddress to make it ready for code generation.
type OperationTrait ¶
type OperationTrait struct { Title string `json:"title"` Summary string `json:"summary"` Description string `json:"description"` Security []*SecurityScheme `json:"security"` Tags []*Tag `json:"tags"` ExternalDocs *ExternalDocumentation `json:"externalDocs"` Bindings *OperationBindings `json:"bindings"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *OperationTrait `json:"-"` }
OperationTrait is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#msgerationTraitObject
func (*OperationTrait) Follow ¶ added in v0.33.1
func (ot *OperationTrait) Follow() *OperationTrait
Follow returns referenced MessageTrait if specified or the actual MessageTrait.
func (*OperationTrait) Process ¶
func (ot *OperationTrait) Process(name string, spec Specification)
Process processes the OperationTrait to make it ready for code generation.
type Parameter ¶
type Parameter struct { Enum []string `json:"enum"` Default string `json:"default"` Description string `json:"description"` Examples []string `json:"examples"` Location string `json:"location"` Reference string `json:"$ref"` // Non AsyncAPI fields Name string `json:"-"` ReferenceTo *Parameter `json:"-"` }
Parameter is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#parameterObject
func (*Parameter) Process ¶
func (p *Parameter) Process(name string, spec Specification)
Process processes the Parameter structure to make it ready for code generation.
type PulsarBinding ¶
type PulsarBinding any
PulsarBinding represents protocol-specific information for a Pulsar channel.
type RedisBinding ¶
type RedisBinding any
RedisBinding represents protocol-specific information for a Redis channel.
type SNSBinding ¶
type SNSBinding any
SNSBinding represents protocol-specific information for an SNS channel.
type SQSBinding ¶
type SQSBinding any
SQSBinding represents protocol-specific information for an SQS channel.
type Schema ¶
type Schema struct { Title string `json:"title"` Type string `json:"type"` Required []string `json:"required"` MultipleOf []string `json:"multipleOf"` Maximum string `json:"maximum"` ExclusiveMaximum float64 `json:"exclusiveMaximum"` Minimum string `json:"minimum"` ExclusiveMinimum float64 `json:"exclusiveMinimum"` MaxLength uint `json:"maxLength"` MinLength uint `json:"minLength"` Pattern string `json:"pattern"` MaxItems uint `json:"maxItems"` MinItems uint `json:"minItems"` UniqueItems bool `json:"uniqueItems"` MaxProperties uint `json:"maxProperties"` MinProperties uint `json:"minProperties"` Enum []any `json:"enum"` Const any `json:"const"` Examples []any `json:"examples"` ReadOnly bool `json:"readOnly"` WriteOnly bool `json:"writeOnly"` Properties map[string]*Schema `json:"properties"` PatternProperties map[string]*Schema `json:"patternProperties"` AdditionalProperties map[string]*Schema `json:"additionalProperties"` AdditionalItems []*Schema `json:"additionalItems"` Items *Schema `json:"items"` PropertyNames []string `json:"propertyNames"` Contains []*Schema `json:"contains"` AllOf []*Schema `json:"allOf"` AnyOf []*Schema `json:"anyOf"` OneOf []*Schema `json:"oneOf"` Not *Schema `json:"not"` Description string `json:"description"` Format string `json:"format"` Default any `json:"default"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *Schema `json:"-"` IsRequired bool `json:"-"` Extensions }
Schema is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#schemaObject
func NewSchema ¶
func NewSchema() Schema
NewSchema creates a new Schema structure with initialized fields.
func (Schema) IsFieldRequired ¶
IsFieldRequired checks if a field is required in the asyncapi struct.
func (*Schema) MergeWith ¶
func (s *Schema) MergeWith(spec Specification, s2 Schema)
MergeWith merges the given Schema structure with another one (basically for AllOf, AnyOf, OneOf, etc).
type SecurityScheme ¶
type SecurityScheme struct { Type string `json:"type"` Description string `json:"description"` Name string `json:"name"` In string `json:"in"` Scheme string `json:"scheme"` BearerFormat string `json:"bearerFormat"` Flows OAuthFlows `json:"flows"` OpenIDConnectURL string `json:"openIdConnectUrl"` Scopes []string `json:"scopes"` Reference string `json:"$ref"` ReferenceTo *SecurityScheme `json:"-"` }
SecurityScheme is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#securitySchemeObject
func RemoveDuplicateSecuritySchemes ¶
func RemoveDuplicateSecuritySchemes(securities []*SecurityScheme) []*SecurityScheme
RemoveDuplicateSecuritySchemes removes the security schemes that have the same name, keeping the first occurrence.
func (*SecurityScheme) Process ¶
func (s *SecurityScheme) Process(name string, spec Specification)
Process processes the SecurityScheme to make it ready for code generation.
type Server ¶
type Server struct { Host string `json:"host"` Protocol string `json:"protocol"` ProtocolVersion string `json:"protocolVersion"` PathName string `json:"pathname"` Description string `json:"description"` Title string `json:"title"` Summary string `json:"summary"` Variables map[string]*ServerVariable `json:"variables"` Security *SecurityScheme `json:"security"` Tags []*Tag `json:"tags"` ExternalDocs *ExternalDocumentation `json:"externalDocs"` Bindings *ServerBindings `json:"bindings"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *Server `json:"-"` }
Server is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#serverObject
func (*Server) Process ¶
func (srv *Server) Process(name string, spec Specification)
Process processes the Server to make it ready for code generation.
type ServerBindings ¶
type ServerBindings struct { HTTP HTTPBinding `json:"http"` WS WsBinding `json:"ws"` Kafka KafkaBinding `json:"kafka"` AnyPointMQ AnyPointMqBinding `json:"anypointmq"` AMQP AMQPBinding `json:"amqp"` AMQP1 AMQP1Binding `json:"amqp1"` MQTT MQTTBinding `json:"mqtt"` MQTT5 MQTT5Binding `json:"mqtt5"` NATS NATSBinding `json:"nats"` JMS JMSBinding `json:"jms"` SNS SNSBinding `json:"sns"` Solace SolaceBinding `json:"solace"` SQS SQSBinding `json:"sqs"` Stomp StompBinding `json:"stomp"` Redis RedisBinding `json:"redis"` Mercure MercureBinding `json:"mercure"` IBMMQ IBMMQBinding `json:"ibmmq"` GooglePubSub GooglePubSubBinding `json:"googlepubsub"` Pulsar PulsarBinding `json:"pulsar"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *ServerBindings `json:"-"` }
ServerBindings is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#serverBindingsObject
func (*ServerBindings) Process ¶
func (ob *ServerBindings) Process(name string, spec Specification)
Process processes the ServerBindings to make it ready for code generation.
type ServerVariable ¶
type ServerVariable struct { Enum []string `json:"enum"` Default string `json:"default"` Description string `json:"description"` Examples []string `json:"examples"` Reference string `json:"$ref"` Name string `json:"-"` ReferenceTo *ServerVariable `json:"-"` }
ServerVariable is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#serverVariableObject
func (*ServerVariable) Process ¶
func (sv *ServerVariable) Process(path string, spec Specification)
Process processes the ServerVariable to make it ready for code generation.
type SolaceBinding ¶
type SolaceBinding any
SolaceBinding represents protocol-specific information for a Solace channel.
type Specification ¶
type Specification struct { Version string `json:"asyncapi"` ID string `json:"id"` Info Info `json:"info"` Servers []*Server `json:"servers"` DefaultContentType string `json:"defaultContentType"` Channels map[string]*Channel `json:"channels"` Operations map[string]*Operation `json:"operations"` Components Components `json:"components"` }
Specification is the asyncapi specification struct that will be used to generate code. It should contains every information given in the asyncapi specification. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#schema
func (Specification) CustomImports ¶
func (s Specification) CustomImports() ([]string, error)
CustomImports collects all custom import paths set by x-go-type-imports in all Schema Objects in the Specification. Returns import strings like `alias "abc.xyz/repo/package"` for code generation. Returns error when import name conflicts.
func (Specification) GetOperationCountByAction ¶
func (s Specification) GetOperationCountByAction() (sendCount, receiveCount uint)
GetOperationCountByAction gets the count of 'sending' operations and the count of 'reception' operations inside the Specification.
func (Specification) MajorVersion ¶
func (s Specification) MajorVersion() int
MajorVersion returns the asyncapi major version of this document. This function is used mainly by the interface.
func (*Specification) Process ¶
func (s *Specification) Process()
Process processes the Specification to make it ready for code generation.
func (Specification) ReferenceChannel ¶
func (s Specification) ReferenceChannel(ref string) *Channel
ReferenceChannel returns the Channel struct corresponding to the given reference.
func (Specification) ReferenceChannelBindings ¶
func (s Specification) ReferenceChannelBindings(ref string) *ChannelBindings
ReferenceChannelBindings returns the ChannelBindings struct corresponding to the given reference.
func (Specification) ReferenceExternalDocumentation ¶
func (s Specification) ReferenceExternalDocumentation(ref string) *ExternalDocumentation
ReferenceExternalDocumentation returns the ExternalDocumentation struct corresponding to the given reference.
func (Specification) ReferenceMessage ¶
func (s Specification) ReferenceMessage(ref string) *Message
ReferenceMessage returns the Message struct corresponding to the given reference.
func (Specification) ReferenceMessageBindings ¶
func (s Specification) ReferenceMessageBindings(ref string) *MessageBindings
ReferenceMessageBindings returns the MessageBindings struct corresponding to the given reference.
func (Specification) ReferenceMessageExample ¶
func (s Specification) ReferenceMessageExample(ref string) *MessageExample
ReferenceMessageExample returns the MessageExample struct corresponding to the given reference.
func (Specification) ReferenceMessageTrait ¶
func (s Specification) ReferenceMessageTrait(ref string) *MessageTrait
ReferenceMessageTrait returns the MessageTrait struct corresponding to the given reference.
func (Specification) ReferenceOperation ¶
func (s Specification) ReferenceOperation(ref string) *Operation
ReferenceOperation returns the Operation struct corresponding to the given reference.
func (Specification) ReferenceOperationBindings ¶
func (s Specification) ReferenceOperationBindings(ref string) *OperationBindings
ReferenceOperationBindings returns the OperationBindings struct corresponding to the given reference.
func (Specification) ReferenceOperationReply ¶
func (s Specification) ReferenceOperationReply(ref string) *OperationReply
ReferenceOperationReply returns the OperationReply struct corresponding to the given reference.
func (Specification) ReferenceOperationReplyAddress ¶
func (s Specification) ReferenceOperationReplyAddress(ref string) *OperationReplyAddress
ReferenceOperationReplyAddress returns the OperationReplyAddress struct corresponding to the given reference.
func (Specification) ReferenceOperationTrait ¶
func (s Specification) ReferenceOperationTrait(ref string) *OperationTrait
ReferenceOperationTrait returns the OperationTrait struct corresponding to the given reference.
func (Specification) ReferenceParameter ¶
func (s Specification) ReferenceParameter(ref string) *Parameter
ReferenceParameter returns the Parameter struct corresponding to the given reference.
func (Specification) ReferenceSchema ¶
func (s Specification) ReferenceSchema(ref string) *Schema
ReferenceSchema returns the Schema struct corresponding to the given reference.
func (Specification) ReferenceSecurity ¶
func (s Specification) ReferenceSecurity(ref string) *SecurityScheme
ReferenceSecurity returns the SecurityScheme struct corresponding to the given reference.
func (Specification) ReferenceServer ¶
func (s Specification) ReferenceServer(ref string) *Server
ReferenceServer returns the Server struct corresponding to the given reference.
func (Specification) ReferenceServerBindings ¶
func (s Specification) ReferenceServerBindings(ref string) *ServerBindings
ReferenceServerBindings returns the ServerBindings struct corresponding to the given reference.
func (Specification) ReferenceServerVariable ¶
func (s Specification) ReferenceServerVariable(ref string) *ServerVariable
ReferenceServerVariable returns the ServerVariable struct corresponding to the given reference.
func (Specification) ReferenceTag ¶
func (s Specification) ReferenceTag(ref string) *Tag
ReferenceTag returns the Tag struct corresponding to the given reference.
type StompBinding ¶
type StompBinding any
StompBinding represents protocol-specific information for a STOMP channel.
type Tag ¶
type Tag struct { Name string `json:"name"` Description string `json:"description"` ExternalDocs *ExternalDocumentation `json:"externalDocs"` Reference string `json:"$ref"` ReferenceTo *Tag `json:"-"` }
Tag is a representation of the corresponding asyncapi object filled from an asyncapi specification that will be used to generate code. Source: https://www.asyncapi.com/docs/reference/specification/v3.0.0#tagsObject
func RemoveDuplicateTags ¶
RemoveDuplicateTags removes the tags that have the same name, keeping the first occurrence.
func (*Tag) Process ¶
func (t *Tag) Process(path string, spec Specification)
Process processes the Tag to make it ready for code generation.
Source Files
¶
- bindings.go
- channel.go
- channel_bindings.go
- components.go
- contact.go
- correlation_id.go
- extensions.go
- external_documentation.go
- info.go
- license.go
- message.go
- message_bindings.go
- message_example.go
- message_trait.go
- operation.go
- operation_bindings.go
- operation_reply.go
- operation_reply_address.go
- operation_trait.go
- parameter.go
- schema.go
- security_scheme.go
- server.go
- server_bindings.go
- server_variable.go
- specification.go
- tag.go
- utils.go