config

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Info is the information about the API.
	Info *openapi3.Info `yaml:"info"`
	// SecuritySchemes is a map of security schemes.
	SecuritySchemes map[string]any `yaml:"securitySchemes"`
	// RouterDefinitions is a list of router definitions.
	RouterDefinitions []RouterDefinition `yaml:"routerDefinitions"`
	// HandlerPatterns is the handler patterns configuration.
	HandlerPatterns *HandlerPatternsConfig `yaml:"handlerPatterns"`
	// SecurityPatterns is a list of security patterns.
	SecurityPatterns []SecurityPattern `yaml:"securityPatterns"`
	// Servers is a list of server URLs.
	Servers []ServerUrl `yaml:"servers,omitempty"`
}

Config represents a configuration.

func Load

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

Load loads a configuration from a file.

func (*Config) GetSecuritySchemes added in v0.2.8

func (c *Config) GetSecuritySchemes() openapi3.SecuritySchemes

GetSecuritySchemes is a helper to get sanitized security schemes.

type HandlerPatternsConfig added in v0.1.7

type HandlerPatternsConfig struct {
	// RequestBody is a list of request body patterns.
	RequestBody []RequestBodyPattern `yaml:"requestBody"`
	// ResponseBody is a list of response body patterns.
	ResponseBody []ResponseBodyPattern `yaml:"responseBody"`
	// QueryParameter is a list of query parameter patterns.
	QueryParameter []ParameterPattern `yaml:"queryParameter"`
	// HeaderParameter is a list of header parameter patterns.
	HeaderParameter []ParameterPattern `yaml:"headerParameter"`
}

HandlerPatternsConfig represents a handler patterns configuration.

type ParameterPattern added in v0.1.7

type ParameterPattern struct {
	// FunctionPath is the path to the function.
	FunctionPath string `yaml:"functionPath"`
	// NameIndex is the index of the name.
	NameIndex int `yaml:"nameIndex"`
}

ParameterPattern represents a parameter pattern.

type RequestBodyPattern added in v0.1.7

type RequestBodyPattern struct {
	// FunctionPath is the path to the function.
	FunctionPath string `yaml:"functionPath"`
	// ArgIndex is the index of the argument.
	ArgIndex int `yaml:"argIndex"`
}

RequestBodyPattern represents a request body pattern.

type ResponseBodyPattern added in v0.1.7

type ResponseBodyPattern struct {
	// FunctionPath is the path to the function.
	FunctionPath string `yaml:"functionPath"`
	// DataIndex is the index of the data.
	DataIndex int `yaml:"dataIndex"`
	// StatusCodeIndex is the index of the status code.
	StatusCodeIndex *int `yaml:"statusCodeIndex,omitempty"`
	// DescriptionIndex is the index of the description.
	DescriptionIndex *int `yaml:"descriptionIndex,omitempty"`
}

ResponseBodyPattern represents a response body pattern.

type RouterDefinition

type RouterDefinition struct {
	// Type is the type of the router.
	Type string `yaml:"type"`
	// EndpointMethods is a list of endpoint methods.
	EndpointMethods []string `yaml:"endpointMethods"`
	// GroupMethods is a list of group methods.
	GroupMethods []string `yaml:"groupMethods"`
	// MiddlewareWrapperMethods is a list of middleware wrapper methods.
	MiddlewareWrapperMethods []string `yaml:"middlewareWrapperMethods"`
}

RouterDefinition represents a router definition.

type SecurityPattern added in v0.1.7

type SecurityPattern struct {
	// FunctionPath is the path to the function.
	FunctionPath string `yaml:"functionPath"`
	// SchemeName is the name of the scheme.
	SchemeName string `yaml:"schemeName"`
}

SecurityPattern represents a security pattern.

type ServerUrl added in v0.3.4

type ServerUrl struct {
	// URL is the server URL.
	URL string `yaml:"url"`
	// Description is the server description.
	Description string `yaml:"description,omitempty"`
}

Jump to

Keyboard shortcuts

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