Documentation
¶
Overview ¶
Package config loads and validates biscuit.yaml, the canonical override surface. The config drives codegen, so a malformed file fails loudly — unknown keys are rejected with the decoder's line-precise errors, and a version key exists for forward migration. The same per-operation overrides can ride in-spec as x-biscuit-* extensions; the sidecar wins on conflict (merging happens in the mapping layer).
Index ¶
Constants ¶
const FileName = "biscuit.yaml"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Version int `yaml:"version,omitempty"`
Spec Spec `yaml:"spec,omitempty"`
Output Output `yaml:"output,omitempty"`
Lint Lint `yaml:"lint,omitempty"`
Distribution Distribution `yaml:"distribution,omitempty"`
Pagination []PaginationScheme `yaml:"pagination,omitempty"`
Operations map[string]Operation `yaml:"operations,omitempty"`
}
type Distribution ¶
type Distribution struct {
Homebrew bool `yaml:"homebrew,omitempty"`
InstallScript bool `yaml:"install_script,omitempty"`
NPM NPM `yaml:"npm,omitempty"`
}
Distribution controls which release channels the generated repo ships with. Only Homebrew gates template output today; NPM and InstallScript are read by later stories (npm publishing, install.sh templating).
type Operation ¶
type Operation struct {
Name string `yaml:"name,omitempty"` // verb name
Group string `yaml:"group,omitempty"` // whitespace-separated resource chain
Ignore bool `yaml:"ignore,omitempty"` // drop the operation from the CLI
Aliases []string `yaml:"aliases,omitempty"` // extra verb names
Pagination string `yaml:"pagination,omitempty"` // pagination scheme name to force, or "off"
}
Operation overrides how one operation maps into the command tree, keyed by operationId — or "METHOD /path" when the spec has none.
type Output ¶
type Output struct {
Binary string `yaml:"binary,omitempty"` // command name; default derived from info.title
Module string `yaml:"module,omitempty"` // Go module path; default example.com/{binary}-cli
Dir string `yaml:"dir,omitempty"` // output directory; default ./{binary}-cli
Description string `yaml:"description,omitempty"` // overrides info.description in the generated README/Makefile/root.Long
}
Output shapes the emitted repository. Every field has a spec-derived default; the config only pins what the derivation gets wrong.
type PaginationRequest ¶
type PaginationRequest struct {
CursorParam string `yaml:"cursor_param,omitempty"`
OffsetParam string `yaml:"offset_param,omitempty"`
PageParam string `yaml:"page_param,omitempty"`
LimitParam string `yaml:"limit_param,omitempty"`
}
PaginationRequest names the query params the scheme sends. Exactly one of the three page params is set, matching the scheme's type.
type PaginationResponse ¶
type PaginationResponse struct {
ItemsField string `yaml:"items_field,omitempty"`
NextField string `yaml:"next_field,omitempty"`
NextKind string `yaml:"next_kind,omitempty"` // has_more | cursor | url | link_header
}
PaginationResponse names the response fields the scheme reads. Paths are dot-separated for nesting (Slack's response_metadata.next_cursor).
type PaginationScheme ¶
type PaginationScheme struct {
Name string `yaml:"name,omitempty"`
Type string `yaml:"type,omitempty"` // cursor | offset | page
Request PaginationRequest `yaml:"request,omitempty"`
Response PaginationResponse `yaml:"response,omitempty"`
}
PaginationScheme is one named pagination convention. A declared scheme shadows the built-in of the same name and is matched against operation shapes the same way — declaring one is how an API whose convention biscuit doesn't already know gets transparent page walking.