Documentation
¶
Overview ¶
Package asyncapi contains vacuum's AsyncAPI execution context and document detection helpers. It intentionally keeps the parsing contract small: command code can cheaply detect AsyncAPI, while motor and rule functions receive the full libasyncapi document graph when linting AsyncAPI 3.x documents.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSpecInfo ¶
BuildSpecInfo creates libopenapi-compatible metadata for AsyncAPI documents. The metadata is intentionally limited to parser-neutral fields used by vacuum: raw bytes, root node, document type, version and format.
func DetectFormat ¶
DetectFormat returns vacuum's AsyncAPI format for spec bytes. It only recognizes AsyncAPI 3.x and returns an error for AsyncAPI 2.x or invalid AsyncAPI version strings. Non-AsyncAPI documents return an empty format.
func FormatForVersion ¶
FormatForVersion maps an AsyncAPI version string onto vacuum's format constants. AsyncAPI 2.x is intentionally unsupported.
func HasMarker ¶
HasMarker reports whether the raw bytes contain an AsyncAPI root marker. It is intentionally cheap and parse-independent so malformed AsyncAPI documents can still be routed away from OpenAPI-only processing.
func IsDocument ¶
IsDocument reports whether spec bytes have an AsyncAPI root marker. It does not require the version to be supported, making it suitable for command surfaces that simply need to reject AsyncAPI input.
Types ¶
type Context ¶
type Context struct {
Spec []byte
SpecFileName string
SpecInfo *datamodel.SpecInfo
Document libasyncapi.Document
RootNode *yaml.Node
Version string
Format string
Index *index.SpecIndex
Rolodex *index.Rolodex
// contains filtered or unexported fields
}
Context is the AsyncAPI equivalent of vacuum's OpenAPI document context. It carries the raw YAML tree, parsed document and index metadata used by AsyncAPI rules.
func NewContext ¶
func NewContext(spec []byte, specFileName string, config *libasyncapi.DocumentConfiguration) (*Context, error)
NewContext parses spec bytes into a libasyncapi document and builds the metadata vacuum needs for format filtering, locations and reports.
func (*Context) DocumentErrors ¶
DocumentErrors returns libasyncapi document validation errors.