Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultVarDumpFileName = "required_openapi_params.yaml" ErrNoVarsDumpFile = errors.New("no required params file found") )
Functions ¶
func WriteOpenAPIVarDumpFile ¶
func WriteOpenAPIVarDumpFile(vars *OpenAPIParamsCfgFile) error
WriteOpenAPIVarDumpFile writes the required vars dump file
Types ¶
type Format ¶
type Format interface {
// Name returns the name of the format
Name() string
// Parse parses the input and calls the provided callback
// function for each RawRequest it discovers.
Parse(input io.Reader, resultsCb ParseReqRespCallback, filePath string) error
// SetOptions sets the options for the input format
SetOptions(options InputFormatOptions)
}
Format is an interface implemented by all input formats
type InputFormatOptions ¶
type InputFormatOptions struct {
// Variables is list of variables that can be used
// while generating requests in given format
Variables map[string]interface{}
// SkipFormatValidation is used to skip format validation
// while debugging or testing if format is invalid then
// requests are skipped instead of creating invalid requests
SkipFormatValidation bool
// RequiredOnly only uses required fields when generating requests
// instead of all fields
RequiredOnly bool
// VarsTextTemplating uses Variables and inject it into the input
// this is used for text templating of variables based on carvel ytt
// Only available for Yaml formats
VarsTextTemplating bool
// VarsFilePaths is the path to the file containing variables
VarsFilePaths []string
}
InputFormatOptions contains options for the input this can be variables that can be passed or overrides or some other options
type OpenAPIParamsCfgFile ¶
type OpenAPIParamsCfgFile struct {
Var []string `yaml:"var"`
OptionalVars []string `yaml:"-"` // this will be written to the file as comments
}
OpenAPIParamsCfgFile is the structure of the required vars dump file
func ReadOpenAPIVarDumpFile ¶
func ReadOpenAPIVarDumpFile() (*OpenAPIParamsCfgFile, error)
ReadOpenAPIVarDumpFile reads the required vars dump file
type ParseReqRespCallback ¶
type ParseReqRespCallback func(rr *types.RequestResponse) bool
ParseReqRespCallback is a callback function for discovered raw requests
type SpecDownloader ¶ added in v3.6.0
type SpecDownloader interface {
// Download downloads the spec from the given URL and saves it to tmpDir
// Returns the path to the downloaded file
// httpClient is a retryablehttp.Client instance (can be nil for fallback)
Download(url, tmpDir string, httpClient *retryablehttp.Client) (string, error)
// SupportedExtensions returns the list of supported file extensions
SupportedExtensions() []string
}
SpecDownloader is an interface for downloading API specifications from URLs
Click to show internal directories.
Click to hide internal directories.