Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultImportOptions ¶ added in v0.2.0
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 ¶
Load reads the YAML config file at path and applies environment variable overrides for secrets.
func (*Config) ValidateExport ¶ added in v0.1.0
ValidateExport checks the export section for the export command.
func (*Config) ValidateGlobal ¶ added in v0.1.0
ValidateGlobal checks that the required global fields are present.
func (*Config) ValidateImport ¶ added in v0.1.0
ValidateImport checks the import section for the import command.
func (*Config) ValidateOpenAPISync ¶ added in v0.1.0
ValidateOpenAPISync checks the openapi section for the openapi-sync command.
type DocLinks ¶
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 ¶
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.