config

package
v0.1.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: GPL-2.0 Imports: 9 Imported by: 0 modules, 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 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

View Source
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"`
}

func Load

func Load(dir string) (*Config, error)

Load reads dir/biscuit.yaml. A missing file is not an error: it returns an empty config, the state before discovery or init has written anything.

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 Lint

type Lint struct {
	MinGrade int `yaml:"min_grade,omitempty"`
}

type NPM

type NPM struct {
	Package string `yaml:"package,omitempty"`
}

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.

type Spec

type Spec struct {
	Path string `yaml:"path,omitempty"`
}

Jump to

Keyboard shortcuts

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