compilers

package
v0.0.0-...-38da05c Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package compilers defines the contract between spec compilers and the engine: a Compiler lowers source documents of its formats into an ir.Document plus diagnostics, purely and reentrantly.

Index

Constants

This section is empty.

Variables

View Source
var ErrAddressSpace = errors.New("at an address more private than the read may reach")

ErrAddressSpace reports a read that would dial an address more private than its request's Reach.

View Source
var ErrContract = errors.New("compiler broke its contract")

ErrContract reports a compiler that broke its contract: a duty Compiler's doc comments state, which the registry or a Detection checked and found unmet. It names a bug in the compiler, never in the source, so it is a Go error rather than a diagnostic, and it is raised before the outcome reaches anyone who would act on it.

View Source
var ErrDocumentTooLarge = errors.New("larger than the read allows")

ErrDocumentTooLarge reports a document larger than a request allows.

View Source
var ErrOutsideWithin = errors.New("outside the directory the read is confined to")

ErrOutsideWithin reports a document a request confined to a directory that lies outside it.

View Source
var ErrUnboundedRead = errors.New("the reader cannot bound the addresses this read dials")

ErrUnboundedRead reports a request stating a Reach to a reader that cannot judge the addresses the read would dial.

Functions

func FilePath

func FilePath(u *url.URL, windows bool) (string, error)

FilePath returns the path of the local file the file URI u names (RFC 8089), as readers and compiles read it: percent-decoded, a drive letter's leading slash removed where windows says paths are read as Windows reads them. It refuses a URI naming a user, a file on another host, no absolute path or a query, a path opening with two slashes, which Windows reads as another host's share, a drive no slash follows, which Windows reads against that drive's working directory, and a separator that would decode into another segmentation: an escaped slash, or on Windows a backslash.

Types

type AddressSpace

type AddressSpace uint8

AddressSpace ranks how private a network address is, least private first, as Private Network Access ranks them: a reference in a document read from one space may dial that space and any below it (docs/compilers/openapi.md#references).

const (
	// SpaceUnstated is no space: a read that dialled no address, as a file's,
	// or one whose reader did not say. As a request's Reach it bounds nothing.
	SpaceUnstated AddressSpace = iota
	// SpacePublic is an address on the public internet.
	SpacePublic
	// SpacePrivate is a private, link-local, shared, reserved or multicast
	// address.
	SpacePrivate
	// SpaceLocal is a loopback or unspecified address.
	SpaceLocal
)

type AddressSpaceError

type AddressSpaceError struct {
	// Address is the address the read would have dialled.
	Address string
	// Space is where Address lies.
	Space AddressSpace
}

AddressSpaceError is ErrAddressSpace naming the address refused and the space it lies in.

func (*AddressSpaceError) Error

func (e *AddressSpaceError) Error() string

Error implements error.

func (*AddressSpaceError) Unwrap

func (e *AddressSpaceError) Unwrap() error

Unwrap returns ErrAddressSpace.

type Compiled

type Compiled struct {
	// Document is the lowered document, or nil when the compiler refused the
	// source.
	Document *ir.Document
	// Diagnostics is every finding the compile reported: the Document's own,
	// then each one Compile returned that the Document does not hold. A
	// compiler may fill either channel (see Compiler), so reading one alone
	// would lose what only the other holds.
	Diagnostics []ir.Diagnostic
	// Sources is the table every Provenance.Source in both lists indexes: the
	// Document's, or the compiler's SourceTable for a refusal.
	Sources []ir.SourceInfo
}

Compiled is what compiling one detected source produced, held to the compiler's contract.

type Compiler

type Compiler interface {
	// Formats reports the dialects this compiler serves, at least one, each
	// naming a name and a version, the name free of the '@' String writes.
	Formats() []SourceFormat
	// Detect reports the format src declares and whether this compiler
	// recognizes it, which is not support: it may name a format it does not
	// serve. An ok answer names a format as Formats does: the one Compile reads.
	//
	// Detection honors the bounds opts sets for reading src. FormatOptions of
	// another compiler's type mean this one's defaults; only Compile rejects
	// them.
	//
	// diags is read only when ok is false. Declining another format's bytes
	// within SourceLimit is silent; for this compiler's own source, unreadable
	// or one opts forbid reading, diags holds an error saying why, naming src as
	// Source 0, or no source.
	Detect(ctx context.Context, src Source, opts Options) (rec Recognition, diags []ir.Diagnostic, ok bool)
	// DecodeOptions turns textual settings into the value this compiler expects
	// in Options.FormatOptions. An empty set yields defaults. An unknown key or
	// an unusable value is an error — a setting that is silently ignored leaves
	// the caller believing they configured something. It reads nothing: a file a
	// setting names is Compile's to read, through Options.Reader.
	DecodeOptions(set OptionSet) (any, error)
	// SourceLimit is the most bytes a source may hold for this compiler to read
	// it under opts, zero or less for any size. Detect declines a source past it
	// unread, with an error saying why, and Compile refuses one. So a caller
	// reading a source before detection need read no further than one byte past
	// the largest limit among the compilers it asks: each declines what is past
	// its own. It reads no input and fails on none.
	SourceLimit(opts Options) int
	// Compile lowers sources into a Document, or refuses them with a nil one, no
	// error and at least one error diagnostic saying why. The Document is the
	// caller's alone, stamped ir.IRVersion, and its Sources begin with the table
	// SourceTable gives for the same arguments, each entry filled in with the
	// format Detect recognized and the SHA-256 of Data. Entries past it, if any,
	// name each further document the compile read. Every Provenance.Source it
	// reports other than ir.NoSource indexes them; a refusal's diagnostics index
	// SourceTable's table. The Document holds what irverify checks. Compile
	// stops when ctx is done.
	Compile(ctx context.Context, sources []Source, opts Options) (*ir.Document, []ir.Diagnostic, error)
	// SourceTable names the inputs its arguments name, in the order a compile's
	// provenance indexes them: the sources, then any input the options supply,
	// such as an overlay.
	//
	// It is the table a refusal's diagnostics index, and a returned Document's
	// Sources begins with it. It reads no input and fails on none, so an entry
	// holds only the Path it was given. For options a compile would reject, it
	// names the sources alone. It is required: a caller left to guess the
	// table can name only the sources, and would print an overlay's findings
	// without their file.
	SourceTable(sources []Source, opts Options) []ir.SourceInfo
}

Compiler lowers source documents into the IR. Implementations must be pure: no package-level mutable state, no writes to stderr. Spec problems are ir.Diagnostic values; errors are for I/O and programmer faults, and no method panics.

One value must accept overlapping Compile calls, except over one Source carrying a Parsed. Every method is required. Compile may also store its findings on the Document; a caller unions the two lists.

The duties below are checked where a caller can: by Registry.Register and Registry.Detect, by Detection.Compile against a compile's inputs, and by irverify on the Document. A panic is a breach too.

type Configuration

type Configuration struct {
	// FormatOptions is what each compiler is handed when Settings holds none.
	FormatOptions any
	// Settings, when it holds any, is decoded by each compiler asked
	// (Compiler.DecodeOptions).
	Settings OptionSet
	// Reader reads, for every compiler alike, each document a compile reads
	// beyond its sources (Options.Reader).
	Reader DocumentReader
}

Configuration is what a registry resolves each compiler's options from, compiler by compiler: textual settings are one compiler's vocabulary, which only it can decode, and which compiler a source belongs to is what detection is still finding out. It sets FormatOptions or Settings, not both, and Detect and SourceLimit refuse one setting both. The zero Configuration gives every compiler its defaults.

type Detection

type Detection struct {
	// Source is the source detection was handed, and the one Compile compiles,
	// so what was recognized and what is compiled cannot be two inputs.
	Source Source
	// Compiler is the compiler registered for the format the source was
	// recognized as, or nil when none is.
	Compiler Compiler
	// Recognition is what recognizing the source found. Its Format is the zero
	// format when nothing recognized it; see Registry.Detect.
	Recognition Recognition
	// Options is what Compiler compiles the source with, resolved from the
	// Configuration Detect was handed, which the caller hands on rather than
	// resolving again.
	Options Options
	// Declined collects what the compilers that declined the source had to say,
	// in the order they were asked, and is meaningful only when none took it.
	Declined []ir.Diagnostic
}

Detection is what Registry.Detect found for one source.

func (Detection) Compile

func (d Detection) Compile(ctx context.Context) (Compiled, error)

Compile compiles d.Source with the compiler d names, under d's options, handing it what recognizing the source parsed, and holds the outcome to the duties Compiler's Compile and SourceTable state that the inputs let a caller check. A breach, a panic in either method among them, is an error wrapping ErrContract; an error the compiler returned is passed on as it is. One returning once ctx is done fails with ctx's error, unjudged, as it may have stopped short.

A Detection compiles once: the parse it hands over is live, and a compile may write through it (Source.Parsed).

type DirectoryLocator

type DirectoryLocator interface {
	// LocateDirectory returns the absolute directory dir with its symbolic
	// links resolved, or dir itself where they do not resolve.
	LocateDirectory(dir string) string
}

DirectoryLocator is what a DocumentReader that reads files may also offer: where a directory lies, so a compile names a file reached through two spellings of its directory, such as a symbolic link and its target, as one document. A reader without it leaves every path as spelled.

type DocumentRead

type DocumentRead struct {
	// Data is the document's bytes.
	Data []byte
	// Space is where the address that answered lies, where the reader dialled
	// it itself or a proxy dialled a URL whose host is an address, which the
	// proxy dials as written, or SpaceUnstated: a file, a proxied read of a
	// name, a read a hop of which a proxy dialled unjudged, a reader that
	// cannot say. It ranks the document as a referrer, bounding what its own
	// references may dial, so it is never more private than that address.
	Space AddressSpace
	// Bound is the most private space the read can have dialled, by the
	// reader's own judgement, over every hop of a redirect: the most private
	// address it dialled or proxied host it judged, else SpaceUnstated. It
	// ranks the document as a target, so it is never less private than an
	// address the read dialled.
	Bound AddressSpace
}

DocumentRead is one document as a reader read it.

func (DocumentRead) MostPrivate

func (r DocumentRead) MostPrivate() AddressSpace

MostPrivate is the most private space r can have dialled, which ranks it as a target: Bound, or Space where a reader states that more private, since the address that answered bounds the read however its reader states the bound.

type DocumentReader

type DocumentReader interface {
	// ReadDocument returns the document req names and where it was read from.
	// A document outside req.Within fails with ErrOutsideWithin, one larger
	// than req.Limit with ErrDocumentTooLarge, one whose read would dial an
	// address more private than req.Reach with ErrAddressSpace, and a bounded
	// read the reader cannot judge with ErrUnboundedRead; any other failure is
	// the reader's to describe. ctx bounds the read.
	ReadDocument(ctx context.Context, req DocumentRequest) (DocumentRead, error)
}

DocumentReader reads a document a compile reaches beyond the sources it was handed: a file or URL one of their references names.

A compiler does no I/O of its own, so the caller supplies the reader and every read is the caller's. Which document a reference names, and whether the compile may leave the source's directory to read it, are the compiler's to decide; the reader enforces the confinement a request asks for, the size it allows and the addresses it may dial. One reader may serve overlapping reads.

type DocumentRequest

type DocumentRequest struct {
	// Location names the document as the compiler resolved it from a
	// reference: a file path, or an absolute URL.
	Location string
	// Within is the directory the document must lie inside, its symbolic links
	// followed, or "" to confine the read nowhere. A URL lies inside no
	// directory, so a request with Within set never reaches the network.
	Within string
	// Limit is the most bytes the document may hold. Zero or less allows any
	// size.
	Limit int
	// Reach is the most private address the read may dial, each redirect's
	// included. SpaceUnstated bounds none.
	Reach AddressSpace
}

DocumentRequest names one document to read and the bounds the read is held to.

type OptionSet

type OptionSet struct {
	// Settings maps an option name to its textual value. A nil or empty map asks
	// for defaults.
	Settings map[string]string
}

OptionSet is one compile's configuration as text: settings named in the compiler's own option vocabulary, which DecodeOptions turns into that compiler's FormatOptions value.

It exists so a caller can configure a compiler it does not import. The CLI collects key=value pairs without knowing which compiler will read them, and the compiler names and validates every key, so no layer above holds a list of another format's options.

type Options

type Options struct {
	FormatOptions any
	Reader        DocumentReader
}

Options carries per-compile configuration. FormatOptions is the compiler-specific options value; each compiler documents the concrete type it accepts and treats nil as defaults.

Reader reads every document a compile reads beyond its sources: one a source's references name, or one its options name, such as an overlay. Nil reads none, so a reference leaving the sources is a spec problem the compiler reports, never a read it makes itself.

type Recognition

type Recognition struct {
	// Format is the dialect the source declares. An ok recognition names one.
	Format SourceFormat
	// Parsed is the value to put in Source.Parsed before compiling this source,
	// or nil when the compiler parsed nothing worth keeping — it read the bytes
	// some other way, or it declined.
	Parsed any
}

Recognition is what one compiler made of a source it recognized: the format it names, and whatever it parsed while deciding. The parse is carried so it can be handed to the same compiler's Compile rather than repeated there; see Source.Parsed for what a consumer may assume about it.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry maps source formats to compilers. It is a plain instance — there is no package-level default and no init()-time self-registration; the engine composes its registry explicitly. The zero value is a usable empty registry.

Concurrent Detect and Formats are safe once registration is complete. Register is not: it writes an unsynchronized map, so every Register must happen before the first concurrent read. Compose a Registry fully before publishing it, the way engine.New registers into a fresh one and only then wraps it.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty registry.

func (*Registry) Detect

func (r *Registry) Detect(ctx context.Context, src Source, cfg Configuration) (Detection, bool, error)

Detect asks each registered compiler, in registration order, to recognize src under its own options from cfg. The first format named decides: its owner is Detection.Compiler, configured for itself, and a recognizer not owning it loses its parse.

The bool reports whether a compiler takes src. Unrecognized src, empty Data included, has the zero format, unlike src recognized but unsupported.

It fails on a cfg setting FormatOptions and Settings, a canceled ctx, or undecodable options for the compiler taking src; and, wrapping ErrContract, on a claim or decline Compiler.Detect does not admit and a Detect, DecodeOptions or SourceLimit that panics.

func (*Registry) Formats

func (r *Registry) Formats() []SourceFormat

Formats returns every format some registered compiler serves, sorted by name and then by version as a string, so the set reads the same from run to run. An empty registry answers an empty list, never nil, so a caller that encodes the result writes [] rather than null.

String order matches numeric order only while minor versions stay single-digit: 3.10 sorts ahead of 3.2. That is left unfixed because the order is read, never compared against, and a version comparator guessing at every format's scheme is a larger thing to get wrong.

func (*Registry) Register

func (r *Registry) Register(c Compiler) error

Register adds c under every format it reports. It rejects a nil compiler, and a compiler reporting no formats, naming no dialect (an empty name or version, or a name holding '@') or panicking in Formats, the last three with an error wrapping ErrContract, and it fails if any format is already claimed. On failure nothing is registered.

Rejecting nil keeps a caller's mistake a Go error rather than a segmentation fault in this package, so the check comes before any call on c.

func (*Registry) SourceLimit

func (r *Registry) SourceLimit(cfg Configuration) (int, error)

SourceLimit is the most bytes of a source any registered compiler reads, each under the options resolved for it from cfg (Compiler.SourceLimit), and zero when one reads any size or none is registered: how far a caller need read a source it hands to Detect. A compiler whose options fail to decode is asked under its defaults, as Detect asks it. It fails on a cfg setting FormatOptions and Settings, and, wrapping ErrContract, on a DecodeOptions or SourceLimit that panics.

type Source

type Source struct {
	// Path names the source as the caller handed it, which Document.Sources
	// records.
	Path string
	// Location is the absolute path of the file Data was read from, or the
	// absolute http(s) URL it was fetched from, which the references in it are
	// read against, or "" to read them against Path. A caller reading a file
	// sets it, so that what a reference names depends on no working directory
	// and on no spelling of Path. A source at a URL is read as any document
	// fetched from the network is: its references dial public addresses alone.
	Location string
	Data     []byte
	// Parsed is what the compiler's own Detect already made of Data, so Compile
	// need not parse it again. It is never required: nil, or a value of a type
	// the compiler does not recognize, means Compile parses Data itself, so a
	// compiler must type-assert it with comma-ok.
	//
	// A Parsed belongs to one Compile. It is live state the compiler writes
	// through, so a Source carrying one may not be compiled twice or shared
	// between concurrent Compile calls. If Data changes under it, the compiler
	// must read the bytes afresh. Registry.Detect drops a Parsed whose producer
	// will not consume it.
	Parsed any
}

Source is one pre-read input document. Compilers perform no file I/O; the caller loads bytes so compilation stays pure and reentrant, and a document a reference names reaches the compiler through Options.Reader.

type SourceFormat

type SourceFormat struct {
	Name    string // "openapi", "swagger", "typespec", "smithy", ...
	Version string // "3.0", "3.1", "2.0", ...
}

SourceFormat identifies one spec dialect a compiler accepts.

func (SourceFormat) String

func (f SourceFormat) String() string

String renders the canonical "name@version" form used in diagnostics and registry errors.

Directories

Path Synopsis
Package compile holds what every spec compiler shares: the type registry and its source-coordinate map (invariant 3), diagnostic accumulation, naming on ir's canonical grammar (invariant 4) with the name minted for an unnamed entity, and the ID grammar and namespace declaration.
Package compile holds what every spec compiler shares: the type registry and its source-coordinate map (invariant 3), diagnostic accumulation, naming on ir's canonical grammar (invariant 4) with the name minted for an unnamed entity, and the ID grammar and namespace declaration.
Package openapi lowers OpenAPI 3.0/3.1/3.2 documents into the Morphic IR.
Package openapi lowers OpenAPI 3.0/3.1/3.2 documents into the Morphic IR.
internal/annotation
Package annotation reads the documentation-adjacent facts a schema or a carrier declares — descriptions, deprecation, redaction, visibility, XML hints, extensions — and the validation-only JSON Schema keywords the IR keeps verbatim rather than models.
Package annotation reads the documentation-adjacent facts a schema or a carrier declares — descriptions, deprecation, redaction, visibility, XML hints, extensions — and the validation-only JSON Schema keywords the IR keeps verbatim rather than models.
internal/auth
Package auth lowers what a document says about authentication: the security schemes it declares, and the requirements that name them.
Package auth lowers what a document says about authentication: the security schemes it declares, and the requirements that name them.
internal/bind
Package bind resolves every $ref of an OpenAPI source, a schema's and a Reference Object's, into an immutable table, over the decoded YAML trees and never through the parser's resolver: for each reference, where its own $ref lands and where its chain ends, or why it does not.
Package bind resolves every $ref of an OpenAPI source, a schema's and a Reference Object's, into an immutable table, over the decoded YAML trees and never through the parser's resolver: for each reference, where its own $ref lands and where its chain ends, or why it does not.
internal/bind/typed
Package typed answers what the lowering asks of a bind table about the typed schemas it holds: where a schema's $ref lands, the schema written there and the one its chain ends on.
Package typed answers what the lowering asks of a bind table about the typed schemas it holds: where a schema's $ref lands, the schema written there and the one its chain ends on.
internal/budget
Package budget counts the work and the size of a compile against their limits.
Package budget counts the work and the size of a compile against their limits.
internal/canary
Package canary pins the parser library behaviours docs/parser-library.md records, one test for each entry.
Package canary pins the parser library behaviours docs/parser-library.md records, one test for each entry.
internal/convention
Package convention fills the facts an OpenAPI document implies by the names it gives its fields rather than declares: an operation's idempotency token, by the header the key travels in; a credential's redaction, by what it is called; and a response header's HTTP-date text, by the field it is.
Package convention fills the facts an OpenAPI document implies by the names it gives its fields rather than declares: an operation's idempotency token, by the header the key travels in; a credential's redaction, by what it is called; and a response header's HTTP-date text, by the field it is.
internal/detect
Package detect recognizes an OpenAPI or Swagger document from its bytes: the discriminating key it writes and the version beside it, read off the parse the compile goes on to lower.
Package detect recognizes an OpenAPI or Swagger document from its bytes: the discriminating key it writes and the version beside it, read off the parse the compile goes on to lower.
internal/diag
Package diag holds the OpenAPI compiler's diagnostic vocabulary: the stable codes it reports under, the single constructor that builds a diagnostic from them, and how one quotes a dependency's error or panic.
Package diag holds the OpenAPI compiler's diagnostic vocabulary: the stable codes it reports under, the single constructor that builds a diagnostic from them, and how one quotes a dependency's error or panic.
internal/doctree
Package doctree reads an input's bytes, the source's, an overlay's or a document a reference names, into the YAML parser's tree of its first document that holds content, held to the node budget as it is read.
Package doctree reads an input's bytes, the source's, an overlay's or a document a reference names, into the YAML parser's tree of its first document that holds content, held to the node budget as it is read.
internal/document
Package document lowers what a document says about itself rather than its types or operations: its info and root externalDocs, and, kept verbatim, what the objects around them write that lowers to no node (docs/compilers/openapi.md#document-metadata, docs/compilers/openapi.md#unreferenced-components).
Package document lowers what a document says about itself rather than its types or operations: its info and root externalDocs, and, kept verbatim, what the objects around them write that lowers to no node (docs/compilers/openapi.md#document-metadata, docs/compilers/openapi.md#unreferenced-components).
internal/fragment
Package fragment is the one place the compiler reads a $ref fragment as a JSON pointer (GitHub #911), and tells an absolute reference, which no base moves, from a relative one.
Package fragment is the one place the compiler reads a $ref fragment as a JSON pointer (GitHub #911), and tells an absolute reference, which no base moves, from a relative one.
internal/ids
Package ids builds the RFC 6901 pointer that names a position — a jsontext.Pointer from construction on, read back through its methods, never split on '/' — and derives IR identifiers and namespaces from it.
Package ids builds the RFC 6901 pointer that names a position — a jsontext.Pointer from construction on, read back through its methods, never split on '/' — and derives IR identifiers and namespaces from it.
internal/jsonpath
Package jsonpath evaluates RFC 9535 queries over the JSON value a YAML tree stands for: an alias reads as the node it names, a `<<` merge key's members as members of the mapping merging them, and a scalar as the compiler reads it.
Package jsonpath evaluates RFC 9535 queries over the JSON value a YAML tree stands for: an alias reads as the node it names, a `<<` merge key's members as members of the mapping merging them, and a scalar as the compiler reads it.
internal/load
Package load turns one source document into a parsed, reference-resolved OpenAPI document plus the identity metadata the rest of the compiler stamps into the IR.
Package load turns one source document into a parsed, reference-resolved OpenAPI document plus the identity metadata the rest of the compiler stamps into the IR.
internal/lowering
Package lowering holds the context every OpenAPI lowering reads.
Package lowering holds the context every OpenAPI lowering reads.
internal/lowering/loweringtest
Package loweringtest builds the lowering context the compiler's tests lower under, over a document the load phase read, as the compiler builds its own.
Package loweringtest builds the lowering context the compiler's tests lower under, over a document the load phase read, as the compiler builds its own.
internal/merge
Package merge reconciles the properties more than one allOf branch declares: folding the declarations into one, composing the models they name, or reporting that they disagree.
Package merge reconciles the properties more than one allOf branch declares: folding the declarations into one, composing the models they name, or reporting that they disagree.
internal/naming
Package naming names every node the OpenAPI compiler builds as a function of the documents and the node's coordinate (GitHub #981), so which lowering reaches a coordinate first cannot change what it is called.
Package naming names every node the OpenAPI compiler builds as a function of the documents and the node's coordinate (GitHub #981), so which lowering reaches a coordinate first cannot change what it is called.
internal/nodeview
Package nodeview is the compiler's one reading of a raw YAML tree: a mapping read the way the parser reads it, through aliases and `<<` merge keys, each key and each key written twice settled as the parser's model settles them (docs/parser-library.md#merge-keys, #duplicate-key, #non-scalar-key), and one bounded, iterative walk of a tree as written (Walk).
Package nodeview is the compiler's one reading of a raw YAML tree: a mapping read the way the parser reads it, through aliases and `<<` merge keys, each key and each key written twice settled as the parser's model settles them (docs/parser-library.md#merge-keys, #duplicate-key, #non-scalar-key), and one bounded, iterative walk of a tree as written (Walk).
internal/oas
Package oas holds the OpenAPI Specification's rules as data, and the engine that checks a source tree against them at the minor it declares.
Package oas holds the OpenAPI Specification's rules as data, and the engine that checks a source tree against them at the minor it declares.
internal/openapitest
Package openapitest holds the test scaffolding every test package under compilers/openapi would otherwise copy, since test files cannot share unexported helpers.
Package openapitest holds the test scaffolding every test package under compilers/openapi would otherwise copy, since test files cannot share unexported helpers.
internal/operation
Package operation lowers what a document says an API does: its path items, webhooks and callbacks, the parameters merged onto each operation, and the content of every request body, response and header.
Package operation lowers what a document says an API does: its path items, webhooks and callbacks, the parameters merged onto each operation, and the content of every request body, response and header.
internal/overlay
Package overlay applies an OpenAPI Overlay document to the parsed node tree, and records which positions in the result the overlay is answerable for.
Package overlay applies an OpenAPI Overlay document to the parsed node tree, and records which positions in the result the overlay is answerable for.
internal/pagination
Package pagination fills an operation's ir.Pagination: Promote from the extensions a policy maps to the pagination targets (docs/compilers/openapi.md#extension-pagination), and InferWalks, under the pagination-inference policy, from the names its query parameters and its success responses' members give (docs/compilers/openapi.md#pagination-policy).
Package pagination fills an operation's ir.Pagination: Promote from the extensions a policy maps to the pagination targets (docs/compilers/openapi.md#extension-pagination), and InferWalks, under the pagination-inference policy, from the names its query parameters and its success responses' members give (docs/compilers/openapi.md#pagination-policy).
internal/paramchoice
Package paramchoice reads what the promotion policy maps an operation's key to, the choices among its parameters, once the document is whole (docs/compilers/openapi.md#mutually-exclusive-parameters): each names alternative sets of the operation's parameters by name, resolved as a link's parameters key is.
Package paramchoice reads what the promotion policy maps an operation's key to, the choices among its parameters, once the document is whole (docs/compilers/openapi.md#mutually-exclusive-parameters): each names alternative sets of the operation's parameters by name, resolved as a link's parameters key is.
internal/provenance
Package provenance places a finding or a lowered position in the input document that supplied it: a pointer through Doc, and a node of a decoded tree through Tree, each a value the package placing asks of directly.
Package provenance places a finding or a lowered position in the input document that supplied it: a pointer through Doc, and a node of a decoded tree through Tree, each a value the package placing asks of directly.
internal/replacement
Package replacement fills what a deprecation names as its replacement (ir.Deprecation.ReplacedBy): Resolve from the vendor extensions a policy maps to lowering.TargetDeprecationReplacedBy, as every promotion reads the extensions the nodes keep, and Infer, under the replacement policy, from what the deprecation's message names where no such extension is written.
Package replacement fills what a deprecation names as its replacement (ir.Deprecation.ReplacedBy): Resolve from the vendor extensions a policy maps to lowering.TargetDeprecationReplacedBy, as every promotion reads the extensions the nodes keep, and Infer, under the replacement policy, from what the deprecation's message names where no such extension is written.
internal/resolve
Package resolve answers what a $ref names: the same-document pointer it addresses, the schema declared there and the type interned there, and, for components that are not schemas, the concrete value and declaration site a reference-or-inline entry stands for.
Package resolve answers what a $ref names: the same-document pointer it addresses, the schema declared there and the type interned there, and, for components that are not schemas, the concrete value and declaration site a reference-or-inline entry stands for.
internal/runtimeexpr
Package runtimeexpr reads the runtime expressions an OpenAPI document writes, as the values of a link and the page walk of an extension do, and finds the members of a body one names, through the reading of the compiled document those steps share (whole.Document).
Package runtimeexpr reads the runtime expressions an OpenAPI document writes, as the values of a link and the page walk of an extension do, and finds the members of a body one names, through the reading of the compiled document those steps share (whole.Document).
internal/scan
Package scan refuses a source document before any of it is lowered, for shapes the parser library cannot decode: a YAML alias cycle or fan-out, which overflows its stack or exhausts memory (docs/parser-library.md#alias-cycle, docs/parser-library.md#alias-expansion), and nesting so deep that its cost per node, growing with depth, adds up past use (docs/parser-library.md#nesting-cost).
Package scan refuses a source document before any of it is lowered, for shapes the parser library cannot decode: a YAML alias cycle or fan-out, which overflows its stack or exhausts memory (docs/parser-library.md#alias-cycle, docs/parser-library.md#alias-expansion), and nesting so deep that its cost per node, growing with depth, adds up past use (docs/parser-library.md#nesting-cost).
internal/schema
Package schema lowers OpenAPI schemas into IR types: the shape walk, its compositions, the references between schemas, and the preservation of what the IR has no field for.
Package schema lowers OpenAPI schemas into IR types: the shape walk, its compositions, the references between schemas, and the preservation of what the IR has no field for.
internal/servers
Package servers lowers the servers a document declares, whichever object declares them, into one registry keyed by ID, and names the ones a scope uses (docs/compilers/openapi.md#servers, docs/compilers/openapi.md#path-item-servers).
Package servers lowers the servers a document declares, whichever object declares them, into one registry keyed by ID, and names the ones a scope uses (docs/compilers/openapi.md#servers, docs/compilers/openapi.md#path-item-servers).
internal/sourceindex
Package sourceindex answers, in one walk, the questions asked of a decoded source tree before any of it is lowered: how many nodes it declares, how deeply it nests, which aliases name an ancestor, and which mappings carry a tag the parser faults on, as a value the caller carries rather than a walk it repeats.
Package sourceindex answers, in one walk, the questions asked of a decoded source tree before any of it is lowered: how many nodes it declares, how deeply it nests, which aliases name an ancestor, and which mappings carry a tag the parser faults on, as a value the caller carries rather than a walk it repeats.
internal/spelling
Package spelling relates the primitive kinds OpenAPI spells.
Package spelling relates the primitive kinds OpenAPI spells.
internal/stream
Package stream reads what the promotion policy maps an operation's or a streaming content's keys to, of the stream an operation's success responses carry, once the document is whole: the frame data that ends it and the request input that asks for it (docs/compilers/openapi.md#streaming-media).
Package stream reads what the promotion policy maps an operation's or a streaming content's keys to, of the stream an operation's success responses carry, once the document is whole: the frame data that ends it and the request input that asks for it (docs/compilers/openapi.md#streaming-media).
internal/value
Package value classifies YAML scalars and lowers source values into ir.Value, keeping numeric literals as their exact source text so nothing rounds through float64.
Package value classifies YAML scalars and lowers source values into ir.Value, keeping numeric literals as their exact source text so nothing rounds through float64.
internal/whole
Package whole reads a compiled document once it is whole, for the steps that run after the lowerings: it lists the operations and indexes the members, parameters and headers those steps name (Document).
Package whole reads a compiled document once it is whole, for the steps that run after the lowerings: it lists the operations and indexes the members, parameters and headers those steps name (Document).
internal/ynode
Package ynode spells yaml.v3 nodes for tests: the constructors for the node kinds a parse produces, the `<<` merge key among them, and the merge chain the compiler's depth bounds are measured against.
Package ynode spells yaml.v3 nodes for tests: the constructors for the node kinds a parse produces, the `<<` merge key among them, and the merge chain the compiler's depth bounds are measured against.

Jump to

Keyboard shortcuts

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