Documentation ¶
Index ¶
- Constants
- func ImportAsyncAPIDocumentByte(input []byte) (*ast.Document, operationreport.Report)
- func ImportAsyncAPIDocumentString(input string) (*ast.Document, operationreport.Report)
- func ImportParsedAsyncAPIDocument(parsed *AsyncAPI, report *operationreport.Report) *ast.Document
- type AsyncAPI
- type Binding
- type ChannelItem
- type ChannelItemKind
- type Enum
- type Info
- type Message
- type OperationTrait
- type Payload
- type Property
- type SecurityRequirement
- type Server
Constants ¶
const ( ChannelsKey = "channels" SubscribeKey = "subscribe" MessageKey = "message" PayloadKey = "payload" PropertiesKey = "properties" EnumKey = "enum" ServersKey = "servers" URLKey = "url" ProtocolKey = "protocol" ProtocolVersionKey = "protocolVersion" DescriptionKey = "description" NameKey = "name" TitleKey = "title" SummaryKey = "summary" TypeKey = "type" FormatKey = "format" MinimumKey = "minimum" MaximumKey = "maximum" OperationIDKey = "operationId" SecurityKey = "security" BindingsKey = "bindings" KafkaKey = "kafka" TraitsKey = "traits" ParametersKey = "parameters" SchemaKey = "schema" InfoKey = "info" VersionKey = "version" )
Variables ¶
This section is empty.
Functions ¶
func ImportAsyncAPIDocumentByte ¶
func ImportAsyncAPIDocumentByte(input []byte) (*ast.Document, operationreport.Report)
ImportAsyncAPIDocumentByte reads a byte array containing an AsyncAPI document and returns the parsed document as an ast.Document and an operationreport.Report. It first calls ParseAsyncAPIDocument to parse the input byte array into an AsyncAPI struct. If parsing fails, an internal error is added to the report and nil values are returned. Otherwise, it calls ImportParsedAsyncAPIDocument to convert the parsed AsyncAPI struct into an ast.Document using a converter. The resulting ast.Document and the report are returned.
func ImportAsyncAPIDocumentString ¶
func ImportAsyncAPIDocumentString(input string) (*ast.Document, operationreport.Report)
ImportAsyncAPIDocumentString imports an AsyncAPI document from a string input. It internally calls ImportAsyncAPIDocumentByte to parse and import the document. The input is expected to be a valid AsyncAPI document in string format. It returns the imported document as *ast.Document and an operationreport.Report. If there are any parsing or importing errors, the report will contain the error details.
func ImportParsedAsyncAPIDocument ¶
func ImportParsedAsyncAPIDocument(parsed *AsyncAPI, report *operationreport.Report) *ast.Document
ImportParsedAsyncAPIDocument imports a parsed AsyncAPI document and returns a GraphQL Document. The function creates a converter instance and initializes the data structure for introspection.
Types ¶
type AsyncAPI ¶
type AsyncAPI struct { Info *Info Channels map[string]*ChannelItem Servers map[string]*Server }
func ParseAsyncAPIDocument ¶
ParseAsyncAPIDocument parses the input byte slice as an AsyncAPI document and returns an AsyncAPI object and an error. The input byte slice should contain the AsyncAPI document in JSON/YAML format.
type Binding ¶
type Binding struct { Value []byte ValueType jsonparser.ValueType }
type ChannelItem ¶
type ChannelItem struct { Kind ChannelItemKind Message *Message Parameters map[string]string OperationID string Traits []*OperationTrait Servers []string }
ChannelItem object is defined here: https://www.asyncapi.com/docs/reference/specification/v2.4.0#channelItemObject
type ChannelItemKind ¶
type ChannelItemKind string
const (
ChannelItemKindSubscription ChannelItemKind = "subscription"
)
type Enum ¶
type Enum struct { Value []byte ValueType jsonparser.ValueType }
type Message ¶
Message object is defined here: https://www.asyncapi.com/docs/reference/specification/v2.4.0#messageObject
type OperationTrait ¶
OperationTrait object is defined here: https://www.asyncapi.com/docs/reference/specification/v2.4.0#operationTraitObject
type Payload ¶
Payload is definition of the message payload. It can be of any type but defaults to Schema object. It must match the schema format, including encoding type - e.g Avro should be inlined as either a YAML or JSON object NOT a string to be parsed as YAML or JSON.
type Property ¶
type Property struct { Description string Minimum int Maximum int Type string Format string Enum []*Enum }
Property object is derived from Schema object. https://www.asyncapi.com/docs/reference/specification/v2.4.0#schemaObject