core

package
v1.28.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package core contains the backing models for AsyncAPI documents, retaining the YAML/JSON nodes they were parsed from.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncAPI

type AsyncAPI struct {
	marshaller.CoreModel `model:"asyncapi"`

	AsyncAPI           marshaller.Node[string]                                            `key:"asyncapi"`
	ID                 marshaller.Node[*string]                                           `key:"id"`
	Info               marshaller.Node[Info]                                              `key:"info"`
	Servers            marshaller.Node[*sequencedmap.Map[string, *Reference[*Server]]]    `key:"servers"`
	DefaultContentType marshaller.Node[*string]                                           `key:"defaultContentType"`
	Channels           marshaller.Node[*sequencedmap.Map[string, *Reference[*Channel]]]   `key:"channels"`
	Operations         marshaller.Node[*sequencedmap.Map[string, *Reference[*Operation]]] `key:"operations"`
	Components         marshaller.Node[*Components]                                       `key:"components"`

	Extensions core.Extensions `key:"extensions"`
}

AsyncAPI is the backing model for the root AsyncAPI Object.

type Bindings

type Bindings struct {
	marshaller.CoreModel `model:"bindings"`
	*sequencedmap.Map[string, marshaller.Node[values.Value]]

	Extensions core.Extensions `key:"extensions"`
}

Bindings is the backing model for the Server, Channel, Operation and Message Bindings Objects. Each protocol binding is kept as a raw value so unknown protocols and fields survive unchanged.

func NewBindings

func NewBindings() *Bindings

NewBindings creates a new Bindings object with the embedded map initialized.

func (*Bindings) GetMapKeyNodeOrRoot

func (b *Bindings) GetMapKeyNodeOrRoot(key string, rootNode *yaml.Node) *yaml.Node

GetMapKeyNodeOrRoot returns the key node for the provided protocol, or the provided root node if not found.

type Channel

type Channel struct {
	marshaller.CoreModel `model:"channel"`

	Address      marshaller.Node[*string]                                           `key:"address"`
	Messages     marshaller.Node[*sequencedmap.Map[string, *Reference[*Message]]]   `key:"messages"`
	Title        marshaller.Node[*string]                                           `key:"title"`
	Summary      marshaller.Node[*string]                                           `key:"summary"`
	Description  marshaller.Node[*string]                                           `key:"description"`
	Servers      marshaller.Node[[]*ReferenceObject]                                `key:"servers"`
	Parameters   marshaller.Node[*sequencedmap.Map[string, *Reference[*Parameter]]] `key:"parameters"`
	Tags         marshaller.Node[[]*Tag]                                            `key:"tags"`
	ExternalDocs marshaller.Node[*schemacore.ExternalDocumentation]                 `key:"externalDocs"`
	Bindings     marshaller.Node[*Reference[*Bindings]]                             `key:"bindings"`

	Extensions core.Extensions `key:"extensions"`
}

Channel is the backing model for the Channel Object.

A null address and an omitted address both mean the address is unknown. An authored `address: null` is kept when syncing while the public address is still unknown, as with any explicit null.

type Components

type Components struct {
	marshaller.CoreModel `model:"components"`

	Schemas           marshaller.Node[*sequencedmap.Map[string, *schemacore.SchemaUnion]]            `key:"schemas"`
	Servers           marshaller.Node[*sequencedmap.Map[string, *Reference[*Server]]]                `key:"servers"`
	Channels          marshaller.Node[*sequencedmap.Map[string, *Reference[*Channel]]]               `key:"channels"`
	Operations        marshaller.Node[*sequencedmap.Map[string, *Reference[*Operation]]]             `key:"operations"`
	Messages          marshaller.Node[*sequencedmap.Map[string, *Reference[*Message]]]               `key:"messages"`
	SecuritySchemes   marshaller.Node[*sequencedmap.Map[string, *Reference[*SecurityScheme]]]        `key:"securitySchemes"`
	ServerVariables   marshaller.Node[*sequencedmap.Map[string, *Reference[*ServerVariable]]]        `key:"serverVariables"`
	Parameters        marshaller.Node[*sequencedmap.Map[string, *Reference[*Parameter]]]             `key:"parameters"`
	CorrelationIDs    marshaller.Node[*sequencedmap.Map[string, *Reference[*CorrelationID]]]         `key:"correlationIds"`
	Replies           marshaller.Node[*sequencedmap.Map[string, *Reference[*OperationReply]]]        `key:"replies"`
	ReplyAddresses    marshaller.Node[*sequencedmap.Map[string, *Reference[*OperationReplyAddress]]] `key:"replyAddresses"`
	ExternalDocs      marshaller.Node[*sequencedmap.Map[string, *schemacore.ExternalDocumentation]]  `key:"externalDocs"`
	Tags              marshaller.Node[*sequencedmap.Map[string, *Tag]]                               `key:"tags"`
	OperationTraits   marshaller.Node[*sequencedmap.Map[string, *Reference[*OperationTrait]]]        `key:"operationTraits"`
	MessageTraits     marshaller.Node[*sequencedmap.Map[string, *Reference[*MessageTrait]]]          `key:"messageTraits"`
	ServerBindings    marshaller.Node[*sequencedmap.Map[string, *Reference[*Bindings]]]              `key:"serverBindings"`
	ChannelBindings   marshaller.Node[*sequencedmap.Map[string, *Reference[*Bindings]]]              `key:"channelBindings"`
	OperationBindings marshaller.Node[*sequencedmap.Map[string, *Reference[*Bindings]]]              `key:"operationBindings"`
	MessageBindings   marshaller.Node[*sequencedmap.Map[string, *Reference[*Bindings]]]              `key:"messageBindings"`

	Extensions core.Extensions `key:"extensions"`
}

Components is the backing model for the Components Object.

type Contact

type Contact struct {
	marshaller.CoreModel `model:"contact"`

	Name  marshaller.Node[*string] `key:"name"`
	URL   marshaller.Node[*string] `key:"url"`
	Email marshaller.Node[*string] `key:"email"`

	Extensions core.Extensions `key:"extensions"`
}

Contact is the backing model for the Contact Object.

type CorrelationID

type CorrelationID struct {
	marshaller.CoreModel `model:"correlationId"`

	Description marshaller.Node[*string] `key:"description"`
	Location    marshaller.Node[string]  `key:"location"`

	Extensions core.Extensions `key:"extensions"`
}

CorrelationID is the backing model for the Correlation ID Object.

type Info

type Info struct {
	marshaller.CoreModel `model:"info"`

	Title          marshaller.Node[string]                            `key:"title"`
	Version        marshaller.Node[string]                            `key:"version"`
	Description    marshaller.Node[*string]                           `key:"description"`
	TermsOfService marshaller.Node[*string]                           `key:"termsOfService"`
	Contact        marshaller.Node[*Contact]                          `key:"contact"`
	License        marshaller.Node[*License]                          `key:"license"`
	Tags           marshaller.Node[[]*Tag]                            `key:"tags"`
	ExternalDocs   marshaller.Node[*schemacore.ExternalDocumentation] `key:"externalDocs"`

	Extensions core.Extensions `key:"extensions"`
}

Info is the backing model for the Info Object.

type License

type License struct {
	marshaller.CoreModel `model:"license"`

	Name marshaller.Node[string]  `key:"name"`
	URL  marshaller.Node[*string] `key:"url"`

	Extensions core.Extensions `key:"extensions"`
}

License is the backing model for the License Object.

type Message

type Message struct {
	marshaller.CoreModel `model:"message"`

	Headers       marshaller.Node[*schemacore.SchemaUnion]           `key:"headers"`
	Payload       marshaller.Node[*schemacore.SchemaUnion]           `key:"payload"`
	CorrelationID marshaller.Node[*Reference[*CorrelationID]]        `key:"correlationId"`
	ContentType   marshaller.Node[*string]                           `key:"contentType"`
	Name          marshaller.Node[*string]                           `key:"name"`
	Title         marshaller.Node[*string]                           `key:"title"`
	Summary       marshaller.Node[*string]                           `key:"summary"`
	Description   marshaller.Node[*string]                           `key:"description"`
	Tags          marshaller.Node[[]*Tag]                            `key:"tags"`
	ExternalDocs  marshaller.Node[*schemacore.ExternalDocumentation] `key:"externalDocs"`
	Bindings      marshaller.Node[*Reference[*Bindings]]             `key:"bindings"`
	Examples      marshaller.Node[[]*MessageExample]                 `key:"examples"`
	Traits        marshaller.Node[[]*Reference[*MessageTrait]]       `key:"traits"`

	Extensions core.Extensions `key:"extensions"`
}

Message is the backing model for the Message Object.

type MessageExample

type MessageExample struct {
	marshaller.CoreModel `model:"messageExample"`

	Headers marshaller.Node[values.Value] `key:"headers"`
	Payload marshaller.Node[values.Value] `key:"payload"`
	Name    marshaller.Node[*string]      `key:"name"`
	Summary marshaller.Node[*string]      `key:"summary"`

	Extensions core.Extensions `key:"extensions"`
}

MessageExample is the backing model for the Message Example Object.

type MessageTrait

type MessageTrait struct {
	marshaller.CoreModel `model:"messageTrait"`

	Headers       marshaller.Node[*schemacore.SchemaUnion]           `key:"headers"`
	CorrelationID marshaller.Node[*Reference[*CorrelationID]]        `key:"correlationId"`
	ContentType   marshaller.Node[*string]                           `key:"contentType"`
	Name          marshaller.Node[*string]                           `key:"name"`
	Title         marshaller.Node[*string]                           `key:"title"`
	Summary       marshaller.Node[*string]                           `key:"summary"`
	Description   marshaller.Node[*string]                           `key:"description"`
	Tags          marshaller.Node[[]*Tag]                            `key:"tags"`
	ExternalDocs  marshaller.Node[*schemacore.ExternalDocumentation] `key:"externalDocs"`
	Bindings      marshaller.Node[*Reference[*Bindings]]             `key:"bindings"`
	Examples      marshaller.Node[[]*MessageExample]                 `key:"examples"`

	Extensions core.Extensions `key:"extensions"`
}

MessageTrait is the backing model for the Message Trait Object.

type OAuthFlow

type OAuthFlow struct {
	marshaller.CoreModel `model:"oAuthFlow"`

	AuthorizationURL marshaller.Node[*string]                                            `key:"authorizationUrl"`
	TokenURL         marshaller.Node[*string]                                            `key:"tokenUrl"`
	RefreshURL       marshaller.Node[*string]                                            `key:"refreshUrl"`
	AvailableScopes  marshaller.Node[*sequencedmap.Map[string, marshaller.Node[string]]] `key:"availableScopes" required:"true"`

	Extensions core.Extensions `key:"extensions"`
}

OAuthFlow is the backing model for the OAuth Flow Object.

type OAuthFlows

type OAuthFlows struct {
	marshaller.CoreModel `model:"oAuthFlows"`

	Implicit          marshaller.Node[*OAuthFlow] `key:"implicit"`
	Password          marshaller.Node[*OAuthFlow] `key:"password"`
	ClientCredentials marshaller.Node[*OAuthFlow] `key:"clientCredentials"`
	AuthorizationCode marshaller.Node[*OAuthFlow] `key:"authorizationCode"`

	Extensions core.Extensions `key:"extensions"`
}

OAuthFlows is the backing model for the OAuth Flows Object.

type Operation

type Operation struct {
	marshaller.CoreModel `model:"operation"`

	Action       marshaller.Node[string]                            `key:"action"`
	Channel      marshaller.Node[ReferenceObject]                   `key:"channel"`
	Title        marshaller.Node[*string]                           `key:"title"`
	Summary      marshaller.Node[*string]                           `key:"summary"`
	Description  marshaller.Node[*string]                           `key:"description"`
	Security     marshaller.Node[[]*Reference[*SecurityScheme]]     `key:"security"`
	Tags         marshaller.Node[[]*Tag]                            `key:"tags"`
	ExternalDocs marshaller.Node[*schemacore.ExternalDocumentation] `key:"externalDocs"`
	Bindings     marshaller.Node[*Reference[*Bindings]]             `key:"bindings"`
	Traits       marshaller.Node[[]*Reference[*OperationTrait]]     `key:"traits"`
	Messages     marshaller.Node[[]*ReferenceObject]                `key:"messages"`
	Reply        marshaller.Node[*Reference[*OperationReply]]       `key:"reply"`

	Extensions core.Extensions `key:"extensions"`
}

Operation is the backing model for the Operation Object.

type OperationReply

type OperationReply struct {
	marshaller.CoreModel `model:"operationReply"`

	Address  marshaller.Node[*Reference[*OperationReplyAddress]] `key:"address"`
	Channel  marshaller.Node[*ReferenceObject]                   `key:"channel"`
	Messages marshaller.Node[[]*ReferenceObject]                 `key:"messages"`

	Extensions core.Extensions `key:"extensions"`
}

OperationReply is the backing model for the Operation Reply Object.

type OperationReplyAddress

type OperationReplyAddress struct {
	marshaller.CoreModel `model:"operationReplyAddress"`

	Description marshaller.Node[*string] `key:"description"`
	Location    marshaller.Node[string]  `key:"location"`

	Extensions core.Extensions `key:"extensions"`
}

OperationReplyAddress is the backing model for the Operation Reply Address Object.

type OperationTrait

type OperationTrait struct {
	marshaller.CoreModel `model:"operationTrait"`

	Title        marshaller.Node[*string]                           `key:"title"`
	Summary      marshaller.Node[*string]                           `key:"summary"`
	Description  marshaller.Node[*string]                           `key:"description"`
	Security     marshaller.Node[[]*Reference[*SecurityScheme]]     `key:"security"`
	Tags         marshaller.Node[[]*Tag]                            `key:"tags"`
	ExternalDocs marshaller.Node[*schemacore.ExternalDocumentation] `key:"externalDocs"`
	Bindings     marshaller.Node[*Reference[*Bindings]]             `key:"bindings"`
	Reply        marshaller.Node[*Reference[*OperationReply]]       `key:"reply"`

	Extensions core.Extensions `key:"extensions"`
}

OperationTrait is the backing model for the Operation Trait Object.

Reply is modelled because the specification's prose allows a trait to hold any Operation Object property other than action, channel, messages and traits, even though its fixed field table omits reply.

type Parameter

type Parameter struct {
	marshaller.CoreModel `model:"parameter"`

	Enum        marshaller.Node[[]marshaller.Node[string]] `key:"enum"`
	Default     marshaller.Node[*string]                   `key:"default"`
	Description marshaller.Node[*string]                   `key:"description"`
	Examples    marshaller.Node[[]marshaller.Node[string]] `key:"examples"`
	Location    marshaller.Node[*string]                   `key:"location"`

	Extensions core.Extensions `key:"extensions"`
}

Parameter is the backing model for the Parameter Object.

type Reference

type Reference[T marshaller.CoreModeler] struct {
	marshaller.CoreModel `model:"reference"`

	Reference marshaller.Node[*string] `key:"$ref"`

	Object T `populatorValue:"true"`
}

Reference is the backing model for a value that is either an inline object or an AsyncAPI Reference Object. AsyncAPI Reference Objects only contain `$ref`; any sibling properties are ignored.

func (*Reference[T]) SyncChanges

func (r *Reference[T]) SyncChanges(ctx context.Context, model any, valueNode *yaml.Node) (*yaml.Node, error)

func (*Reference[T]) Unmarshal

func (r *Reference[T]) Unmarshal(ctx context.Context, parentName string, node *yaml.Node) ([]error, error)

type ReferenceObject

type ReferenceObject struct {
	marshaller.CoreModel `model:"referenceObject"`

	Reference marshaller.Node[string] `key:"$ref"`
}

ReferenceObject is the backing model for a field that must be an AsyncAPI Reference Object.

type SecurityScheme

type SecurityScheme struct {
	marshaller.CoreModel `model:"securityScheme"`

	Type             marshaller.Node[string]                    `key:"type"`
	Description      marshaller.Node[*string]                   `key:"description"`
	Name             marshaller.Node[*string]                   `key:"name"`
	In               marshaller.Node[*string]                   `key:"in"`
	Scheme           marshaller.Node[*string]                   `key:"scheme"`
	BearerFormat     marshaller.Node[*string]                   `key:"bearerFormat"`
	Flows            marshaller.Node[*OAuthFlows]               `key:"flows"`
	OpenIDConnectURL marshaller.Node[*string]                   `key:"openIdConnectUrl"`
	Scopes           marshaller.Node[[]marshaller.Node[string]] `key:"scopes"`

	Extensions core.Extensions `key:"extensions"`
}

SecurityScheme is the backing model for the Security Scheme Object.

type Server

type Server struct {
	marshaller.CoreModel `model:"server"`

	Host            marshaller.Node[string]                                                 `key:"host"`
	Protocol        marshaller.Node[string]                                                 `key:"protocol"`
	ProtocolVersion marshaller.Node[*string]                                                `key:"protocolVersion"`
	Pathname        marshaller.Node[*string]                                                `key:"pathname"`
	Description     marshaller.Node[*string]                                                `key:"description"`
	Title           marshaller.Node[*string]                                                `key:"title"`
	Summary         marshaller.Node[*string]                                                `key:"summary"`
	Variables       marshaller.Node[*sequencedmap.Map[string, *Reference[*ServerVariable]]] `key:"variables"`
	Security        marshaller.Node[[]*Reference[*SecurityScheme]]                          `key:"security"`
	Tags            marshaller.Node[[]*Tag]                                                 `key:"tags"`
	ExternalDocs    marshaller.Node[*schemacore.ExternalDocumentation]                      `key:"externalDocs"`
	Bindings        marshaller.Node[*Reference[*Bindings]]                                  `key:"bindings"`

	Extensions core.Extensions `key:"extensions"`
}

Server is the backing model for the Server Object.

type ServerVariable

type ServerVariable struct {
	marshaller.CoreModel `model:"serverVariable"`

	Enum        marshaller.Node[[]marshaller.Node[string]] `key:"enum"`
	Default     marshaller.Node[*string]                   `key:"default"`
	Description marshaller.Node[*string]                   `key:"description"`
	Examples    marshaller.Node[[]marshaller.Node[string]] `key:"examples"`

	Extensions core.Extensions `key:"extensions"`
}

ServerVariable is the backing model for the Server Variable Object.

type Tag

type Tag struct {
	marshaller.CoreModel `model:"tag"`

	Ref          marshaller.Node[*string]                           `key:"$ref"`
	Name         marshaller.Node[*string]                           `key:"name"`
	Description  marshaller.Node[*string]                           `key:"description"`
	ExternalDocs marshaller.Node[*schemacore.ExternalDocumentation] `key:"externalDocs"`

	Extensions core.Extensions `key:"extensions"`
}

Tag is the backing model for the Tag Object, or a Reference Object to one.

Jump to

Keyboard shortcuts

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