config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultImportOptions added in v0.2.0

func DefaultImportOptions() map[string]any

DefaultImportOptions are the Postman OpenAPI importer options used unless overridden in openapi.import_options. Disabling optional parameters makes the generated requests reflect which parameters the spec marks as required.

Types

type Auth

type Auth struct {
	Type       string          `yaml:"type"`
	Attributes []AuthAttribute `yaml:"attributes,omitempty"`
	// Propagation controls how auth is applied to child folders and requests.
	// When set to "inherit", all folders and requests (except those with an
	// explicit folder_override) will have their auth cleared so they inherit
	// from the collection-level auth. Items with type "noauth" are left
	// untouched. Omit this field (or leave empty) to preserve the current
	// behaviour where each item keeps whatever auth was set previously.
	Propagation string `yaml:"propagation,omitempty"`
}

Auth holds the authentication configuration for a collection or folder.

type AuthAttribute

type AuthAttribute struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
	Type  string `yaml:"type,omitempty"`
}

AuthAttribute is a key/value pair for a Postman auth method.

type Backup added in v0.2.0

type Backup struct {
	Enabled bool `yaml:"enabled"`
	// Keep is how many backups to retain per collection; 0 keeps all.
	Keep int `yaml:"keep"`
}

Backup configures the automatic backup taken before a collection is updated.

type Config

type Config struct {
	PostmanAPIKey string `yaml:"postman_api_key"`
	WorkspaceID   string `yaml:"workspace_id"`

	OpenAPI *OpenAPIConfig `yaml:"openapi,omitempty"`
	Export  *ExportConfig  `yaml:"export,omitempty"`
	Import  *ImportConfig  `yaml:"import,omitempty"`
}

Config is the top-level configuration structure.

func Load

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

Load reads the YAML config file at path and applies environment variable overrides for secrets.

func (*Config) ValidateExport added in v0.1.0

func (c *Config) ValidateExport() error

ValidateExport checks the export section for the export command.

func (*Config) ValidateGlobal added in v0.1.0

func (c *Config) ValidateGlobal() error

ValidateGlobal checks that the required global fields are present.

func (*Config) ValidateImport added in v0.1.0

func (c *Config) ValidateImport() error

ValidateImport checks the import section for the import command.

func (*Config) ValidateOpenAPISync added in v0.1.0

func (c *Config) ValidateOpenAPISync() error

ValidateOpenAPISync checks the openapi section for the openapi-sync command.

type DocLinks struct {
	BaseURL string `yaml:"base_url"`
}

DocLinks configures automatic documentation link injection.

type ExportConfig added in v0.1.0

type ExportConfig struct {
	OutputDir    string   `yaml:"output_dir"`
	Collections  []string `yaml:"collections,omitempty"`
	Environments []string `yaml:"environments,omitempty"`
	Pretty       bool     `yaml:"pretty"`
}

ExportConfig holds configuration for the export command.

type FolderOverride

type FolderOverride struct {
	Auth    *Auth    `yaml:"auth,omitempty"`
	Scripts *Scripts `yaml:"scripts,omitempty"`
}

FolderOverride lets you customise auth and scripts for a specific folder (tag).

type Header struct {
	Key      string `yaml:"key"`
	Value    string `yaml:"value"`
	Disabled bool   `yaml:"disabled"`
}

Header represents a single HTTP header to inject into requests.

type ImportConfig added in v0.1.0

type ImportConfig struct {
	InputDir     string              `yaml:"input_dir"`
	Collections  *ImportEntityConfig `yaml:"collections,omitempty"`
	Environments *ImportEntityConfig `yaml:"environments,omitempty"`
}

ImportConfig holds configuration for the import command.

type ImportEntityConfig added in v0.1.0

type ImportEntityConfig struct {
	Names    []string `yaml:"names,omitempty"`
	Strategy string   `yaml:"strategy,omitempty"`
}

ImportEntityConfig holds per-entity-type import configuration.

type OpenAPIConfig added in v0.1.0

type OpenAPIConfig struct {
	Path              string                    `yaml:"path"`
	RootFile          string                    `yaml:"root_file,omitempty"`
	BaseURL           string                    `yaml:"base_url"`
	SanitizeEnums     bool                      `yaml:"sanitize_enums"`
	DocLinks          *DocLinks                 `yaml:"doc_links,omitempty"`
	CommonHeaders     []Header                  `yaml:"common_headers,omitempty"`
	CommonQueryParams []QueryParam              `yaml:"common_query_params,omitempty"`
	Auth              *Auth                     `yaml:"auth,omitempty"`
	Scripts           *Scripts                  `yaml:"scripts,omitempty"`
	FolderOverrides   map[string]FolderOverride `yaml:"folder_overrides,omitempty"`

	// ImportOptions are passed to Postman's OpenAPI importer and overlay
	// DefaultImportOptions.
	ImportOptions map[string]any `yaml:"import_options,omitempty"`

	// PreserveRequestData keeps header, parameter and body edits made in
	// Postman when an existing request is updated from the spec.
	PreserveRequestData bool `yaml:"preserve_request_data"`

	// StateDir stores local sync state: the baseline of each collection (the
	// collection generated by the last sync, used for three-way merges).
	StateDir string `yaml:"state_dir"`

	// Backup saves the current collection under <state_dir>/backups/ before
	// it is updated.
	Backup Backup `yaml:"backup"`
}

OpenAPIConfig holds all configuration for the openapi-sync command.

func (*OpenAPIConfig) EffectiveImportOptions added in v0.2.0

func (o *OpenAPIConfig) EffectiveImportOptions() map[string]any

EffectiveImportOptions returns DefaultImportOptions overlaid with the user-configured ImportOptions.

type QueryParam added in v0.2.0

type QueryParam struct {
	Key      string `yaml:"key"`
	Value    string `yaml:"value"`
	Disabled bool   `yaml:"disabled"`
}

QueryParam represents a single query parameter to inject into requests.

type Scripts

type Scripts struct {
	PreRequest string `yaml:"prerequest,omitempty"`
	Test       string `yaml:"test,omitempty"`
}

Scripts holds pre-request and test scripts.

Jump to

Keyboard shortcuts

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