Documentation
¶
Index ¶
- Constants
- func IsDefaultScalar(name string) bool
- func ParseRelativeOrHttpURL(input string) (*url.URL, error)
- type APIKeyAuthConfig
- type APIKeyLocation
- type ArgumentInfo
- type ArgumentPresetConfig
- type ArgumentPresetValue
- type ArgumentPresetValueEnv
- type ArgumentPresetValueForwardHeader
- type ArgumentPresetValueInterface
- type ArgumentPresetValueLiteral
- type ArgumentPresetValueType
- type AuthSecurities
- type AuthSecurity
- type BasicAuthConfig
- type CookieAuthConfig
- type EncodingObject
- type HTTPAuthConfig
- type MutualTLSAuthConfig
- type NDCHttpSchema
- type NDCHttpSettings
- type OAuth2Config
- type OAuthFlow
- type OAuthFlowType
- type ObjectField
- type ObjectType
- type OpenIDConnectConfig
- type OperationInfo
- type ParameterEncodingStyle
- type ParameterLocation
- type Request
- type RequestBody
- type RequestParameter
- type Response
- type ResponseTransformSetting
- type RuntimeSettings
- type ScalarName
- type SchemaFileFormat
- type SchemaSpecType
- type SecurityScheme
- type SecuritySchemeType
- type SecuritySchemer
- type ServerConfig
- type TypeSchema
- type XMLSchema
Constants ¶
const ( HTTPAuthSchemeBearer = "bearer" AuthorizationHeader = "Authorization" )
const ( HTTPOptionsArgumentName string = "httpOptions" HTTPSingleOptionsObjectName string = "HttpSingleOptions" HTTPDistributedOptionsObjectName string = "HttpDistributedOptions" HTTPServerIDScalarName string = "HttpServerId" DistributedErrorObjectName string = "DistributedError" )
const ( ContentEncodingHeader = "Content-Encoding" ContentTypeHeader = "Content-Type" ContentTypeJSON = "application/json" ContentTypeNdJSON = "application/x-ndjson" ContentTypeXML = "application/xml" ContentTypeFormURLEncoded = "application/x-www-form-urlencoded" ContentTypeMultipartFormData = "multipart/form-data" ContentTypeTextPlain = "text/plain" ContentTypeTextHTML = "text/html" ContentTypeOctetStream = "application/octet-stream" )
const BodyKey = "body"
Variables ¶
This section is empty.
Functions ¶
func IsDefaultScalar ¶
IsDefaultScalar checks if the scalar name is.
Types ¶
type APIKeyAuthConfig ¶
type APIKeyAuthConfig struct {
Type SecuritySchemeType `json:"type" mapstructure:"type" yaml:"type"`
In APIKeyLocation `json:"in" mapstructure:"in" yaml:"in"`
Name string `json:"name" mapstructure:"name" yaml:"name"`
Value goenvconf.EnvString `json:"value" mapstructure:"value" yaml:"value"`
}
APIKeyAuthConfig contains configurations for apiKey authentication
func NewAPIKeyAuthConfig ¶
func NewAPIKeyAuthConfig( name string, in APIKeyLocation, value goenvconf.EnvString, ) *APIKeyAuthConfig
NewAPIKeyAuthConfig creates a new APIKeyAuthConfig instance.
func (APIKeyAuthConfig) GetType ¶
func (ss APIKeyAuthConfig) GetType() SecuritySchemeType
GetType get the type of security scheme.
func (*APIKeyAuthConfig) UnmarshalJSON ¶
func (j *APIKeyAuthConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*APIKeyAuthConfig) Validate ¶
func (ss *APIKeyAuthConfig) Validate() error
Validate if the current instance is valid.
type APIKeyLocation ¶
type APIKeyLocation string
APIKeyLocation represents the location enum for apiKey auth.
const ( APIKeyInHeader APIKeyLocation = "header" APIKeyInQuery APIKeyLocation = "query" APIKeyInCookie APIKeyLocation = "cookie" )
func ParseAPIKeyLocation ¶
func ParseAPIKeyLocation(value string) (APIKeyLocation, error)
ParseAPIKeyLocation parses APIKeyLocation from string.
func (APIKeyLocation) JSONSchema ¶
func (j APIKeyLocation) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
func (*APIKeyLocation) UnmarshalJSON ¶
func (j *APIKeyLocation) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ArgumentInfo ¶
type ArgumentInfo struct {
schema.ArgumentInfo `yaml:",inline"`
// The request parameter information of the HTTP request
HTTP *RequestParameter `json:"http,omitempty" mapstructure:"http" yaml:"http,omitempty"`
}
ArgumentInfo the information of HTTP request argument.
func (*ArgumentInfo) UnmarshalJSON ¶
func (j *ArgumentInfo) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ArgumentPresetConfig ¶
type ArgumentPresetConfig struct {
// The JSON path of the argument field.
Path string `json:"path" mapstructure:"path" yaml:"path"`
// The value to be set.
Value ArgumentPresetValue `json:"value" mapstructure:"value" yaml:"value"`
// Target operations to be applied.
Targets []string `json:"targets" mapstructure:"targets" yaml:"targets"`
}
ArgumentPresetConfig represents an argument preset configuration.
type ArgumentPresetValue ¶
type ArgumentPresetValue struct {
// contains filtered or unexported fields
}
ArgumentPresetValue represents an argument preset value information.
func (ArgumentPresetValue) Interface ¶
func (j ArgumentPresetValue) Interface() ArgumentPresetValueInterface
Interface returns the inner interface.
func (ArgumentPresetValue) JSONSchema ¶
func (j ArgumentPresetValue) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
func (ArgumentPresetValue) MarshalJSON ¶
func (j ArgumentPresetValue) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ArgumentPresetValue) UnmarshalJSON ¶
func (j *ArgumentPresetValue) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ArgumentPresetValueEnv ¶
type ArgumentPresetValueEnv struct {
Type ArgumentPresetValueType `json:"type" mapstructure:"type" yaml:"type"`
Name string `json:"name" mapstructure:"name" yaml:"name"`
}
ArgumentPresetValueEnv represents an environment argument preset value.
func (ArgumentPresetValueEnv) GetType ¶
func (j ArgumentPresetValueEnv) GetType() ArgumentPresetValueType
GetType gets the type of the current argument preset value.
func (ArgumentPresetValueEnv) JSONSchema ¶
func (j ArgumentPresetValueEnv) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
type ArgumentPresetValueForwardHeader ¶
type ArgumentPresetValueForwardHeader struct {
Type ArgumentPresetValueType `json:"type" mapstructure:"type" yaml:"type"`
Name string `json:"name" mapstructure:"name" yaml:"name"`
}
ArgumentPresetValueForwardHeader represents an argument preset value config from header forwarding.
func (ArgumentPresetValueForwardHeader) GetType ¶
func (apv ArgumentPresetValueForwardHeader) GetType() ArgumentPresetValueType
GetType gets the type of the current argument preset value.
func (ArgumentPresetValueForwardHeader) JSONSchema ¶
func (j ArgumentPresetValueForwardHeader) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
type ArgumentPresetValueInterface ¶
type ArgumentPresetValueInterface interface {
GetType() ArgumentPresetValueType
}
ArgumentPresetValueInterface abstracts an interface for ArgumentPresetValue.
type ArgumentPresetValueLiteral ¶
type ArgumentPresetValueLiteral struct {
Type ArgumentPresetValueType `json:"type" mapstructure:"type" yaml:"type"`
Value any `json:"value" mapstructure:"value" yaml:"value"`
}
ArgumentPresetValueLiteral represents an literal argument preset value.
func (ArgumentPresetValueLiteral) GetType ¶
func (apv ArgumentPresetValueLiteral) GetType() ArgumentPresetValueType
GetType gets the type of the current argument preset value.
func (ArgumentPresetValueLiteral) JSONSchema ¶
func (j ArgumentPresetValueLiteral) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
type ArgumentPresetValueType ¶
type ArgumentPresetValueType string
ArgumentPresetValueType represents an argument preset value type.
const ( ArgumentPresetValueTypeLiteral ArgumentPresetValueType = "literal" ArgumentPresetValueTypeEnv ArgumentPresetValueType = "env" ArgumentPresetValueTypeForwardHeader ArgumentPresetValueType = "forwardHeader" )
func ParseArgumentPresetValueType ¶
func ParseArgumentPresetValueType(value string) (ArgumentPresetValueType, error)
ParseArgumentPresetValueType parses ArgumentPresetValueType from string.
func (ArgumentPresetValueType) JSONSchema ¶
func (j ArgumentPresetValueType) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
func (*ArgumentPresetValueType) UnmarshalJSON ¶
func (j *ArgumentPresetValueType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type AuthSecurities ¶
type AuthSecurities []AuthSecurity
AuthSecurities wraps list of security requirements with helpers.
func (*AuthSecurities) Add ¶
func (ass *AuthSecurities) Add(item AuthSecurity)
Add adds a security with name and scope.
func (AuthSecurities) First ¶
func (ass AuthSecurities) First() AuthSecurity
First returns the first security.
func (AuthSecurities) Get ¶
func (ass AuthSecurities) Get(name string) AuthSecurity
Get gets a security by name.
func (AuthSecurities) IsEmpty ¶
func (ass AuthSecurities) IsEmpty() bool
IsEmpty checks if there is no security.
func (AuthSecurities) IsOptional ¶
func (ass AuthSecurities) IsOptional() bool
IsOptional checks if the security is optional.
type AuthSecurity ¶
AuthSecurity wraps the raw security requirement with helpers.
func NewAuthSecurity ¶
func NewAuthSecurity(name string, scopes []string) AuthSecurity
NewAuthSecurity creates an AuthSecurity instance from name and scope.
func (AuthSecurity) IsOptional ¶
func (as AuthSecurity) IsOptional() bool
IsOptional checks if the security is optional.
func (AuthSecurity) Name ¶
func (as AuthSecurity) Name() string
Name returns the name of security requirement.
func (AuthSecurity) Scopes ¶
func (as AuthSecurity) Scopes() []string
Scopes returns scopes of security requirement.
type BasicAuthConfig ¶
type BasicAuthConfig struct {
Type SecuritySchemeType `json:"type" mapstructure:"type" yaml:"type"`
Header string `json:"header" mapstructure:"header" yaml:"header"`
Username goenvconf.EnvString `json:"username" mapstructure:"username" yaml:"username"`
Password goenvconf.EnvString `json:"password" mapstructure:"password" yaml:"password"`
}
BasicAuthConfig contains configurations for the basic authentication.
func NewBasicAuthConfig ¶
func NewBasicAuthConfig(username, password goenvconf.EnvString) *BasicAuthConfig
NewBasicAuthConfig creates a new BasicAuthConfig instance.
func (BasicAuthConfig) GetType ¶
func (ss BasicAuthConfig) GetType() SecuritySchemeType
GetType get the type of security scheme.
func (*BasicAuthConfig) Validate ¶
func (ss *BasicAuthConfig) Validate() error
Validate if the current instance is valid.
type CookieAuthConfig ¶
type CookieAuthConfig struct {
Type SecuritySchemeType `json:"type" mapstructure:"type" yaml:"type"`
}
CookieAuthConfig represents a cookie authentication configuration.
func NewCookieAuthConfig ¶
func NewCookieAuthConfig() *CookieAuthConfig
NewCookieAuthConfig creates a new CookieAuthConfig instance.
func (CookieAuthConfig) GetType ¶
func (ss CookieAuthConfig) GetType() SecuritySchemeType
GetType get the type of security scheme.
func (CookieAuthConfig) Validate ¶
func (ss CookieAuthConfig) Validate() error
Validate if the current instance is valid.
type EncodingObject ¶
type EncodingObject struct {
// Describes how a specific property value will be serialized depending on its type.
// See Parameter Object for details on the style property.
// The behavior follows the same values as query parameters, including default values.
// This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded or multipart/form-data.
// If a value is explicitly defined, then the value of contentType (implicit or explicit) SHALL be ignored
Style ParameterEncodingStyle `json:"style,omitempty" mapstructure:"style" yaml:"style,omitempty"`
// When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map.
// For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
// This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded or multipart/form-data.
// If a value is explicitly defined, then the value of contentType (implicit or explicit) SHALL be ignored
Explode *bool `json:"explode,omitempty" mapstructure:"explode" yaml:"explode,omitempty"`
// By default, reserved characters :/?#[]@!$&'()*+,;= in form field values within application/x-www-form-urlencoded bodies are percent-encoded when sent.
// AllowReserved allows these characters to be sent as is:
AllowReserved bool `json:"allowReserved,omitempty" mapstructure:"allowReserved" yaml:"allowReserved,omitempty"`
// For more complex scenarios, such as nested arrays or JSON in form data, use the contentType keyword to specify the media type for encoding the value of a complex field.
ContentType []string `json:"contentType,omitempty" mapstructure:"contentType" yaml:"contentType,omitempty"`
// A map allowing additional information to be provided as headers, for example Content-Disposition.
// Content-Type is described separately and SHALL be ignored in this section.
// This property SHALL be ignored if the request body media type is not a multipart.
Headers map[string]RequestParameter `json:"headers,omitempty" mapstructure:"headers" yaml:"headers,omitempty"`
}
EncodingObject represents the Encoding Object that contains serialization strategy for application/x-www-form-urlencoded
func (EncodingObject) GetExplode ¶
func (eo EncodingObject) GetExplode(in ParameterLocation) bool
GetExplode gets the explode value. When style is "form", the default value is true. For all other styles, the default value is false.
func (*EncodingObject) GetHeader ¶
func (eo *EncodingObject) GetHeader(key string) *RequestParameter
GetHeader gets the encoding header by key.
func (EncodingObject) GetStyle ¶
func (eo EncodingObject) GetStyle(in ParameterLocation) ParameterEncodingStyle
GetStyle gets the parameter encoding style. Default values (based on value of in): - query or cookie => form. - path or header => simple.
func (*EncodingObject) SetHeader ¶
func (eo *EncodingObject) SetHeader(key string, param RequestParameter)
SetHeader sets the encoding header.
type HTTPAuthConfig ¶
type HTTPAuthConfig struct {
Type SecuritySchemeType `json:"type" mapstructure:"type" yaml:"type"`
Header string `json:"header" mapstructure:"header" yaml:"header"`
Scheme string `json:"scheme" mapstructure:"scheme" yaml:"scheme"`
Value goenvconf.EnvString `json:"value" mapstructure:"value" yaml:"value"`
}
HTTPAuthConfig contains configurations for http authentication If the scheme is bearer, the authenticator follows OpenAPI 3 specification.
func NewHTTPAuthConfig ¶
func NewHTTPAuthConfig(scheme string, header string, value goenvconf.EnvString) *HTTPAuthConfig
NewHTTPAuthConfig creates a new HTTPAuthConfig instance.
func (HTTPAuthConfig) GetType ¶
func (ss HTTPAuthConfig) GetType() SecuritySchemeType
GetType get the type of security scheme.
func (*HTTPAuthConfig) Validate ¶
func (ss *HTTPAuthConfig) Validate() error
Validate if the current instance is valid.
type MutualTLSAuthConfig ¶
type MutualTLSAuthConfig struct {
Type SecuritySchemeType `json:"type" mapstructure:"type" yaml:"type"`
}
MutualTLSAuthConfig represents a mutualTLS authentication configuration.
func NewMutualTLSAuthConfig ¶
func NewMutualTLSAuthConfig() *MutualTLSAuthConfig
NewMutualTLSAuthConfig creates a new MutualTLSAuthConfig instance.
func (MutualTLSAuthConfig) GetType ¶
func (ss MutualTLSAuthConfig) GetType() SecuritySchemeType
GetType get the type of security scheme.
func (MutualTLSAuthConfig) Validate ¶
func (ss MutualTLSAuthConfig) Validate() error
Validate if the current instance is valid.
type NDCHttpSchema ¶
type NDCHttpSchema struct {
SchemaRef string `json:"$schema,omitempty" mapstructure:"$schema" yaml:"$schema,omitempty"`
Settings *NDCHttpSettings `json:"settings" mapstructure:"settings" yaml:"settings"`
// Functions (i.e. collections which return a single column and row)
Functions map[string]OperationInfo `json:"functions" mapstructure:"functions" yaml:"functions"`
// A list of object types which can be used as the types of arguments, or return
// types of procedures. Names should not overlap with scalar type names.
ObjectTypes map[string]ObjectType `json:"object_types" mapstructure:"object_types" yaml:"object_types"`
// Procedures which are available for execution as part of mutations
Procedures map[string]OperationInfo `json:"procedures" mapstructure:"procedures" yaml:"procedures"`
// A list of scalar types which will be used as the types of collection columns
ScalarTypes schema.SchemaResponseScalarTypes `json:"scalar_types" mapstructure:"scalar_types" yaml:"scalar_types"`
}
NDCHttpSchema extends the [NDC SchemaResponse] with OpenAPI HTTP information
func NewNDCHttpSchema ¶
func NewNDCHttpSchema() *NDCHttpSchema
NewNDCHttpSchema creates a NDCHttpSchema instance.
func (*NDCHttpSchema) AddScalar ¶
func (rm *NDCHttpSchema) AddScalar(name string, scalar schema.ScalarType)
AddScalar adds a new scalar if not exist.
func (NDCHttpSchema) GetFunction ¶
func (rm NDCHttpSchema) GetFunction(name string) *OperationInfo
GetFunction gets the NDC function by name.
func (NDCHttpSchema) GetProcedure ¶
func (rm NDCHttpSchema) GetProcedure(name string) *OperationInfo
GetProcedure gets the NDC procedure by name.
func (NDCHttpSchema) ToSchemaResponse ¶
func (ndc NDCHttpSchema) ToSchemaResponse() *schema.SchemaResponse
ToSchemaResponse converts the instance to NDC schema.SchemaResponse.
type NDCHttpSettings ¶
type NDCHttpSettings struct {
Servers []ServerConfig `json:"servers" mapstructure:"servers" yaml:"servers"`
Headers map[string]goenvconf.EnvString `json:"headers,omitempty" mapstructure:"headers" yaml:"headers,omitempty"`
ArgumentPresets []ArgumentPresetConfig `json:"argumentPresets,omitempty" mapstructure:"argumentPresets" yaml:"argumentPresets,omitempty"`
SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty" mapstructure:"securitySchemes" yaml:"securitySchemes,omitempty"`
Security AuthSecurities `json:"security,omitempty" mapstructure:"security" yaml:"security,omitempty"`
Version string `json:"version,omitempty" mapstructure:"version" yaml:"version,omitempty"`
TLS *exhttp.TLSConfig `json:"tls,omitempty" mapstructure:"tls" yaml:"tls,omitempty"`
ResponseTransforms []ResponseTransformSetting `json:"responseTransforms,omitempty" mapstructure:"responseTransforms" yaml:"responseTransforms,omitempty"`
}
NDCHttpSettings represent global settings of the HTTP API, including base URL, headers, etc...
func (*NDCHttpSettings) Validate ¶
func (rs *NDCHttpSettings) Validate() error
Validate if the current instance is valid.
type OAuth2Config ¶
type OAuth2Config struct {
Type SecuritySchemeType `json:"type" mapstructure:"type" yaml:"type"`
Flows map[OAuthFlowType]OAuthFlow `json:"flows" mapstructure:"flows" yaml:"flows"`
}
OAuth2Config contains configurations for OAuth 2.0 API specification
func NewOAuth2Config ¶
func NewOAuth2Config(flows map[OAuthFlowType]OAuthFlow) *OAuth2Config
NewOAuth2Config creates a new OAuth2Config instance.
func (OAuth2Config) GetType ¶
func (ss OAuth2Config) GetType() SecuritySchemeType
GetType get the type of security scheme.
func (OAuth2Config) JSONSchema ¶
func (j OAuth2Config) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
func (OAuth2Config) Validate ¶
func (ss OAuth2Config) Validate() error
Validate if the current instance is valid.
type OAuthFlow ¶
type OAuthFlow struct {
AuthorizationURL string `json:"authorizationUrl,omitempty" mapstructure:"authorizationUrl" yaml:"authorizationUrl,omitempty"`
TokenURL *goenvconf.EnvString `json:"tokenUrl,omitempty" mapstructure:"tokenUrl" yaml:"tokenUrl,omitempty"`
RefreshURL string `json:"refreshUrl,omitempty" mapstructure:"refreshUrl" yaml:"refreshUrl,omitempty"`
Scopes map[string]string `json:"scopes,omitempty" mapstructure:"scopes" yaml:"scopes,omitempty"`
ClientID *goenvconf.EnvString `json:"clientId,omitempty" mapstructure:"clientId" yaml:"clientId,omitempty"`
ClientSecret *goenvconf.EnvString `json:"clientSecret,omitempty" mapstructure:"clientSecret" yaml:"clientSecret,omitempty"`
EndpointParams map[string]goenvconf.EnvString `json:"endpointParams,omitempty" mapstructure:"endpointParams" yaml:"endpointParams,omitempty"`
}
OAuthFlow contains flow configurations for OAuth 2.0 API specification
func (OAuthFlow) Validate ¶
func (ss OAuthFlow) Validate(flowType OAuthFlowType) error
Validate if the current instance is valid.
type OAuthFlowType ¶
type OAuthFlowType string
OAuthFlowType represents the OAuth flow type enum.
const ( AuthorizationCodeFlow OAuthFlowType = "authorizationCode" ImplicitFlow OAuthFlowType = "implicit" PasswordFlow OAuthFlowType = "password" ClientCredentialsFlow OAuthFlowType = "clientCredentials" )
func ParseOAuthFlowType ¶
func ParseOAuthFlowType(value string) (OAuthFlowType, error)
ParseOAuthFlowType parses OAuthFlowType from string.
func (*OAuthFlowType) UnmarshalJSON ¶
func (j *OAuthFlowType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ObjectField ¶
type ObjectField struct {
schema.ObjectField `yaml:",inline"`
// The field schema information of the HTTP request
HTTP *TypeSchema `json:"http,omitempty" mapstructure:"http" yaml:"http,omitempty"`
}
ObjectField defined on this object type.
func (ObjectField) Schema ¶
func (of ObjectField) Schema() schema.ObjectField
Schema returns schema the object field.
func (*ObjectField) UnmarshalJSON ¶
func (j *ObjectField) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ObjectType ¶
type ObjectType struct {
// Description of this type
Description *string `json:"description,omitempty" mapstructure:"description,omitempty" yaml:"description,omitempty"`
// Fields defined on this object type
Fields map[string]ObjectField `json:"fields" mapstructure:"fields" yaml:"fields"`
// The alias of the object. It can be the original name of OpenAPI schema.
Alias string `json:"alias,omitempty" mapstructure:"alias" yaml:"alias,omitempty"`
// XML schema
XML *XMLSchema `json:"xml,omitempty" mapstructure:"xml" yaml:"xml,omitempty"`
}
ObjectType represents the object type of http schema.
func (ObjectType) Schema ¶
func (of ObjectType) Schema() schema.ObjectType
Schema returns schema the object field.
type OpenIDConnectConfig ¶
type OpenIDConnectConfig struct {
Type SecuritySchemeType `json:"type" mapstructure:"type" yaml:"type"`
OpenIDConnectURL string `json:"openIdConnectUrl" mapstructure:"openIdConnectUrl" yaml:"openIdConnectUrl"`
}
OpenIDConnectConfig contains configurations for OpenID Connect API specification
func NewOpenIDConnectConfig ¶
func NewOpenIDConnectConfig(oidcURL string) *OpenIDConnectConfig
NewOpenIDConnectConfig creates a new OpenIDConnectConfig instance.
func (OpenIDConnectConfig) GetType ¶
func (ss OpenIDConnectConfig) GetType() SecuritySchemeType
GetType get the type of security scheme.
func (OpenIDConnectConfig) Validate ¶
func (ss OpenIDConnectConfig) Validate() error
Validate if the current instance is valid.
type OperationInfo ¶
type OperationInfo struct {
Request *Request `json:"request" mapstructure:"request" yaml:"request"`
// Any arguments that this collection requires
Arguments map[string]ArgumentInfo `json:"arguments" mapstructure:"arguments" yaml:"arguments"`
// Column description
Description *string `json:"description,omitempty" mapstructure:"description,omitempty" yaml:"description,omitempty"`
// The name of the result type
ResultType schema.Type `json:"result_type" mapstructure:"result_type" yaml:"result_type"`
// The original result type is used when header forwarding or distributed execution is enabled
OriginalResultType schema.Type `json:"original_result_type,omitempty" mapstructure:"original_result_type" yaml:"original_result_type,omitempty"`
}
OperationInfo extends connector command operation with OpenAPI HTTP information.
func (*OperationInfo) BackupResultType ¶
func (j *OperationInfo) BackupResultType()
BackupResultType sets the result type to original result type if empty.
func (OperationInfo) FunctionSchema ¶
func (j OperationInfo) FunctionSchema(name string) schema.FunctionInfo
FunctionSchema returns the connector schema of the function.
func (OperationInfo) ProcedureSchema ¶
func (j OperationInfo) ProcedureSchema(name string) schema.ProcedureInfo
ProcedureSchema returns the connector schema of the function.
func (*OperationInfo) UnmarshalJSON ¶
func (j *OperationInfo) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ParameterEncodingStyle ¶
type ParameterEncodingStyle string
ParameterEncodingStyle represents the encoding style of the parameter. style defines how multiple values are delimited. Possible styles depend on the parameter location – path, query, header or cookie.
const ( // EncodingStyleSimple (default of query) comma-separated values. Corresponds to the {param_name} URI template. EncodingStyleSimple ParameterEncodingStyle = "simple" // EncodingStyleLabel dot-prefixed values, also known as label expansion. Corresponds to the {.param_name} URI template. EncodingStyleLabel ParameterEncodingStyle = "label" // EncodingStyleMatrix semicolon-prefixed values, also known as path-style expansion. Corresponds to the {;param_name} URI template. EncodingStyleMatrix ParameterEncodingStyle = "matrix" // EncodingStyleForm ampersand-separated values, also known as form-style query expansion. Corresponds to the {?param_name} URI template. EncodingStyleForm ParameterEncodingStyle = "form" // EncodingStyleSpaceDelimited space-separated array values. Same as collectionFormat: ssv in OpenAPI 2.0. // Has effect only for non-exploded arrays (explode: false), that is, the space separates the array values if the array is a single parameter, as in arr=a b c. EncodingStyleSpaceDelimited ParameterEncodingStyle = "spaceDelimited" // EncodingStylePipeDelimited pipeline-separated array values. Same as collectionFormat: pipes in OpenAPI 2.0. // Has effect only for non-exploded arrays (explode: false), that is, the pipe separates the array values if the array is a single parameter, as in arr=a|b|c. EncodingStylePipeDelimited ParameterEncodingStyle = "pipeDelimited" // EncodingStyleDeepObject simple non-nested objects are serialized as paramName[prop1]=value1¶mName[prop2]=value2&.... // The behavior for nested objects and arrays is undefined. EncodingStyleDeepObject ParameterEncodingStyle = "deepObject" )
func ParseParameterEncodingStyle ¶
func ParseParameterEncodingStyle(input string) (ParameterEncodingStyle, error)
ParseParameterEncodingStyle parses ParameterEncodingStyle from string.
func (ParameterEncodingStyle) IsValid ¶
func (j ParameterEncodingStyle) IsValid() bool
IsValid checks if the style enum is valid.
func (ParameterEncodingStyle) JSONSchema ¶
func (j ParameterEncodingStyle) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
func (*ParameterEncodingStyle) UnmarshalJSON ¶
func (j *ParameterEncodingStyle) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ParameterLocation ¶
type ParameterLocation string
ParameterLocation is the location of the parameter. Possible values are "query", "header", "path" or "cookie".
const ( InQuery ParameterLocation = "query" InHeader ParameterLocation = "header" InPath ParameterLocation = "path" InCookie ParameterLocation = "cookie" InBody ParameterLocation = "body" InFormData ParameterLocation = "formData" )
func ParseParameterLocation ¶
func ParseParameterLocation(input string) (ParameterLocation, error)
ParseParameterLocation parses ParameterLocation from string.
func (ParameterLocation) IsValid ¶
func (j ParameterLocation) IsValid() bool
IsValid checks if the style enum is valid.
func (ParameterLocation) JSONSchema ¶
func (j ParameterLocation) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
func (*ParameterLocation) UnmarshalJSON ¶
func (j *ParameterLocation) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Request ¶
type Request struct {
*RuntimeSettings `yaml:",inline"`
URL string `json:"url,omitempty" mapstructure:"url" yaml:"url,omitempty"`
Method string `` /* 148-byte string literal not displayed */
Headers map[string]goenvconf.EnvString `json:"headers,omitempty" mapstructure:"headers" yaml:"headers,omitempty"`
Security AuthSecurities `json:"security,omitempty" mapstructure:"security" yaml:"security,omitempty"`
Servers []ServerConfig `json:"servers,omitempty" mapstructure:"servers" yaml:"servers,omitempty"`
RequestBody *RequestBody `json:"requestBody,omitempty" mapstructure:"requestBody" yaml:"requestBody,omitempty"`
Response Response `json:"response" mapstructure:"response" yaml:"response"`
}
Request represents the HTTP request information of the webhook.
type RequestBody ¶
type RequestBody struct {
ContentType string `json:"contentType,omitempty" mapstructure:"contentType" yaml:"contentType,omitempty"`
Encoding map[string]EncodingObject `json:"encoding,omitempty" mapstructure:"encoding" yaml:"encoding,omitempty"`
}
RequestBody defines flexible request body with content types.
type RequestParameter ¶
type RequestParameter struct {
EncodingObject `yaml:",inline"`
Name string `yaml:"name,omitempty" json:"name,omitempty" mapstructure:"name"`
ArgumentName string `yaml:"argumentName,omitempty" json:"argumentName,omitempty" mapstructure:"argumentName,omitempty"`
In ParameterLocation `yaml:"in,omitempty" json:"in,omitempty" mapstructure:"in"`
Schema *TypeSchema `yaml:"schema,omitempty" json:"schema,omitempty" mapstructure:"schema"`
}
RequestParameter represents an HTTP request parameter.
type Response ¶
type Response struct {
ContentType string `json:"contentType" mapstructure:"contentType" yaml:"contentType"`
}
type ResponseTransformSetting ¶
type ResponseTransformSetting struct {
// The body template.
Body any `json:"body" mapstructure:"body" yaml:"body"`
// Target operations to be applied.
Targets []string `json:"targets" mapstructure:"targets" yaml:"targets"`
}
ResponseTransformSetting represents a response transformation setting.
type RuntimeSettings ¶
type RuntimeSettings struct {
Timeout uint `json:"timeout,omitempty" mapstructure:"timeout" yaml:"timeout,omitempty"`
Retry exhttp.RetryPolicy `json:"retry,omitempty" mapstructure:"retry" yaml:"retry,omitempty"`
}
RuntimeSettings contain runtime settings for a server.
type ScalarName ¶
type ScalarName string
ScalarName defines supported scalar name enums of the OpenAPI spec.
const ( ScalarBoolean ScalarName = "Boolean" ScalarString ScalarName = "String" ScalarInt32 ScalarName = "Int32" ScalarInt64 ScalarName = "Int64" ScalarFloat32 ScalarName = "Float32" ScalarFloat64 ScalarName = "Float64" ScalarBigDecimal ScalarName = "BigDecimal" ScalarUUID ScalarName = "UUID" ScalarDate ScalarName = "Date" ScalarTimestampTZ ScalarName = "TimestampTZ" ScalarBytes ScalarName = "Bytes" ScalarBinary ScalarName = "Binary" ScalarJSON ScalarName = "JSON" ScalarUnixTime ScalarName = "UnixTime" ScalarEmail ScalarName = "EmailString" ScalarURI ScalarName = "URIString" ScalarIPV4 ScalarName = "IPv4" ScalarIPV6 ScalarName = "IPv6" )
type SchemaFileFormat ¶
type SchemaFileFormat string
SchemaFileFormat represents the file format enum for NDC HTTP schema file.
const ( SchemaFileJSON SchemaFileFormat = "json" SchemaFileYAML SchemaFileFormat = "yaml" )
func ParseSchemaFileFormat ¶
func ParseSchemaFileFormat(extension string) (SchemaFileFormat, error)
ParseSchemaFileFormat parses SchemaFileFormat from file extension.
func (SchemaFileFormat) IsValid ¶
func (j SchemaFileFormat) IsValid() bool
IsValid checks if the style enum is valid.
func (SchemaFileFormat) JSONSchema ¶
func (j SchemaFileFormat) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
func (*SchemaFileFormat) UnmarshalJSON ¶
func (j *SchemaFileFormat) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SchemaSpecType ¶
type SchemaSpecType string
SchemaSpecType represents the spec enum of schema.
const ( OpenAPIv3Spec SchemaSpecType = "openapi3" OpenAPIv2Spec SchemaSpecType = "openapi2" OAS3Spec SchemaSpecType = "oas3" OAS2Spec SchemaSpecType = "oas2" NDCSpec SchemaSpecType = "ndc" )
func ParseSchemaSpecType ¶
func ParseSchemaSpecType(value string) (SchemaSpecType, error)
ParseSchemaSpecType parses SchemaSpecType from string.
func (SchemaSpecType) JSONSchema ¶
func (j SchemaSpecType) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
func (*SchemaSpecType) UnmarshalJSON ¶
func (j *SchemaSpecType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SecurityScheme ¶
type SecurityScheme struct {
SecuritySchemer
}
SecurityScheme contains authentication configurations. The schema follows OpenAPI 3 specification
func (SecurityScheme) JSONSchema ¶
func (j SecurityScheme) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
func (SecurityScheme) MarshalJSON ¶
func (j SecurityScheme) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*SecurityScheme) UnmarshalJSON ¶
func (j *SecurityScheme) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*SecurityScheme) Validate ¶
func (ss *SecurityScheme) Validate() error
Validate if the current instance is valid.
type SecuritySchemeType ¶
type SecuritySchemeType string
SecuritySchemeType represents the authentication scheme enum.
const ( APIKeyScheme SecuritySchemeType = "apiKey" BasicAuthScheme SecuritySchemeType = "basic" CookieAuthScheme SecuritySchemeType = "cookie" HTTPAuthScheme SecuritySchemeType = "http" OAuth2Scheme SecuritySchemeType = "oauth2" OpenIDConnectScheme SecuritySchemeType = "openIdConnect" MutualTLSScheme SecuritySchemeType = "mutualTLS" )
func ParseSecuritySchemeType ¶
func ParseSecuritySchemeType(value string) (SecuritySchemeType, error)
ParseSecuritySchemeType parses SecurityScheme from string.
func (SecuritySchemeType) JSONSchema ¶
func (j SecuritySchemeType) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema.
func (*SecuritySchemeType) UnmarshalJSON ¶
func (j *SecuritySchemeType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SecuritySchemer ¶
type SecuritySchemer interface {
GetType() SecuritySchemeType
Validate() error
}
SecuritySchemer abstracts an interface of SecurityScheme.
type ServerConfig ¶
type ServerConfig struct {
URL goenvconf.EnvString `json:"url" mapstructure:"url" yaml:"url"`
ID string `json:"id,omitempty" mapstructure:"id" yaml:"id,omitempty"`
ArgumentPresets []ArgumentPresetConfig `json:"argumentPresets,omitempty" mapstructure:"argumentPresets" yaml:"argumentPresets,omitempty"`
Headers map[string]goenvconf.EnvString `json:"headers,omitempty" mapstructure:"headers" yaml:"headers,omitempty"`
SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty" mapstructure:"securitySchemes" yaml:"securitySchemes,omitempty"`
Security AuthSecurities `json:"security,omitempty" mapstructure:"security" yaml:"security,omitempty"`
TLS *exhttp.TLSConfig `json:"tls,omitempty" mapstructure:"tls" yaml:"tls,omitempty"`
}
ServerConfig contains server configurations.
func (ServerConfig) GetURL ¶
func (ss ServerConfig) GetURL() (*url.URL, error)
GetURL validates and return the URL.
func (*ServerConfig) Validate ¶
func (ss *ServerConfig) Validate() error
Validate if the current instance is valid.
type TypeSchema ¶
type TypeSchema struct {
Type []string `json:"type,omitempty" mapstructure:"type" yaml:"type,omitempty"`
Format string `json:"format,omitempty" mapstructure:"format" yaml:"format,omitempty"`
Pattern string `json:"pattern,omitempty" mapstructure:"pattern" yaml:"pattern,omitempty"`
Maximum *float64 `json:"maximum,omitempty" mapstructure:"maximum" yaml:"maximum,omitempty"`
Minimum *float64 `json:"minimum,omitempty," mapstructure:"minimum" yaml:"minimum,omitempty"`
MaxLength *int64 `json:"maxLength,omitempty" mapstructure:"maxLength" yaml:"maxLength,omitempty"`
MinLength *int64 `json:"minLength,omitempty" mapstructure:"minLength" yaml:"minLength,omitempty"`
Items *TypeSchema `json:"items,omitempty" mapstructure:"items" yaml:"items,omitempty"`
XML *XMLSchema `json:"xml,omitempty" mapstructure:"xml" yaml:"xml,omitempty"`
Description string `json:"-" yaml:"-"`
ReadOnly bool `json:"-" yaml:"-"`
WriteOnly bool `json:"-" yaml:"-"`
}
TypeSchema represents a serializable object of OpenAPI schema that is used for validation.
type XMLSchema ¶
type XMLSchema struct {
// Replaces the name of the element/attribute used for the described schema property.
// When defined within items, it will affect the name of the individual XML elements within the list.
// When defined alongside type being array (outside the items), it will affect the wrapping element and only if wrapped is true.
// If wrapped is false, it will be ignored.
Name string `json:"name,omitempty" mapstructure:"name" yaml:"name,omitempty"`
// The prefix to be used for the name.
Prefix string `json:"prefix,omitempty" mapstructure:"prefix" yaml:"prefix,omitempty"`
// The URI of the namespace definition. This MUST be in the form of an absolute URI.
Namespace string `json:"namespace,omitempty" mapstructure:"namespace" yaml:"namespace,omitempty"`
// Used only for an array definition. Signifies whether the array is wrapped (for example, <books><book/><book/></books>) or unwrapped (<book/><book/>).
Wrapped bool `json:"wrapped,omitempty" mapstructure:"wrapped" yaml:"wrapped,omitempty"`
// Declares whether the property definition translates to an attribute instead of an element.
Attribute bool `json:"attribute,omitempty" mapstructure:"attribute" yaml:"attribute,omitempty"`
// Represents a text value of the xml element.
Text bool `json:"text,omitempty" mapstructure:"text" yaml:"text,omitempty"`
}
XMLSchema represents a XML schema that adds additional metadata to describe the XML representation of this property.
func (XMLSchema) GetFullName ¶
GetFullName gets the full name with prefix.
func (XMLSchema) GetNamespaceAttribute ¶
GetNamespaceAttribute gets the namespace attribute.