Documentation ¶
Index ¶
- Constants
- func IsDefaultScalar(name string) bool
- func ReplaceEnvTemplates(input string, envTemplates []EnvTemplate) string
- type APIKeyAuthConfig
- type APIKeyLocation
- type AuthSecurities
- type AuthSecurity
- type EncodingObject
- type EnvInt
- func (j EnvInt) JSONSchema() *jsonschema.Schema
- func (j EnvInt) MarshalJSON() ([]byte, error)
- func (j EnvInt) MarshalYAML() (any, error)
- func (et EnvInt) String() string
- func (j *EnvInt) UnmarshalJSON(b []byte) error
- func (j *EnvInt) UnmarshalYAML(node *yaml.Node) error
- func (et *EnvInt) Value() (*int64, error)
- func (j EnvInt) WithValue(value int64) *EnvInt
- type EnvInts
- func (j EnvInts) JSONSchema() *jsonschema.Schema
- func (j EnvInts) MarshalJSON() ([]byte, error)
- func (j EnvInts) MarshalYAML() (any, error)
- func (et EnvInts) String() string
- func (j *EnvInts) UnmarshalJSON(b []byte) error
- func (j *EnvInts) UnmarshalYAML(node *yaml.Node) error
- func (et *EnvInts) Value() ([]int64, error)
- func (j EnvInts) WithValue(value []int64) *EnvInts
- type EnvString
- func (j EnvString) JSONSchema() *jsonschema.Schema
- func (j EnvString) MarshalJSON() ([]byte, error)
- func (j EnvString) MarshalYAML() (any, error)
- func (et EnvString) String() string
- func (j *EnvString) UnmarshalJSON(b []byte) error
- func (j *EnvString) UnmarshalYAML(node *yaml.Node) error
- func (et *EnvString) Value() *string
- func (j EnvString) WithValue(value string) *EnvString
- type EnvTemplate
- func (et EnvTemplate) IsEmpty() bool
- func (j EnvTemplate) MarshalJSON() ([]byte, error)
- func (j EnvTemplate) MarshalYAML() (any, error)
- func (et EnvTemplate) String() string
- func (j *EnvTemplate) UnmarshalJSON(b []byte) error
- func (j *EnvTemplate) UnmarshalYAML(node *yaml.Node) error
- func (et EnvTemplate) Value() (string, bool)
- type HTTPAuthConfig
- type NDCRestSchema
- type NDCRestSettings
- type OAuth2Config
- type OAuthFlow
- type OAuthFlowType
- type OpenIDConfig
- type ParameterEncodingStyle
- type ParameterLocation
- type RESTFunctionInfo
- type RESTProcedureInfo
- type Request
- type RequestBody
- type RequestParameter
- type RequestType
- type Response
- type RetryPolicy
- type RetryPolicySetting
- type ScalarName
- type SchemaFileFormat
- type SchemaSpecType
- type SecurityScheme
- type SecuritySchemeType
- type ServerConfig
- type TypeSchema
Constants ¶
const ( 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" )
Variables ¶
This section is empty.
Functions ¶
func IsDefaultScalar ¶ added in v0.2.0
IsDefaultScalar checks if the scalar name is
func ReplaceEnvTemplates ¶
func ReplaceEnvTemplates(input string, envTemplates []EnvTemplate) string
ReplaceEnvTemplates replaces env templates in the input string with values
Types ¶
type APIKeyAuthConfig ¶
type APIKeyAuthConfig struct { In APIKeyLocation `json:"in" yaml:"in" mapstructure:"in"` Name string `json:"name" yaml:"name" mapstructure:"name"` }
APIKeyAuthConfig contains configurations for apiKey authentication
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 ¶ added in v0.2.4
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 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 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" yaml:"style,omitempty" mapstructure:"style"` // 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" yaml:"explode,omitempty" mapstructure:"explode"` // 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" yaml:"allowReserved,omitempty" mapstructure:"allowReserved"` // 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" yaml:"contentType,omitempty" mapstructure:"contentType"` // 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" yaml:"headers,omitempty" mapstructure:"headers"` }
EncodingObject represents the Encoding Object that contains serialization strategy for application/x-www-form-urlencoded
type EnvInt ¶ added in v0.1.1
type EnvInt struct { EnvTemplate // contains filtered or unexported fields }
EnvInts implements the integer environment encoder and decoder
func NewEnvIntTemplate ¶ added in v0.1.1
func NewEnvIntTemplate(template EnvTemplate) *EnvInt
NewEnvIntTemplate creates an EnvInt from template
func NewEnvIntValue ¶ added in v0.1.1
NewEnvIntValue creates an EnvInt from value
func (EnvInt) JSONSchema ¶ added in v0.2.4
func (j EnvInt) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema
func (EnvInt) MarshalJSON ¶ added in v0.1.1
MarshalJSON implements json.Marshaler.
func (EnvInt) MarshalYAML ¶ added in v0.1.1
MarshalYAML implements yaml.Marshaler interface
func (*EnvInt) UnmarshalJSON ¶ added in v0.1.1
UnmarshalJSON implements json.Unmarshaler.
func (*EnvInt) UnmarshalYAML ¶ added in v0.1.1
UnmarshalYAML implements yaml.Unmarshaler.
type EnvInts ¶ added in v0.1.1
type EnvInts struct { EnvTemplate // contains filtered or unexported fields }
EnvInts implements the integer environment encoder and decoder
func NewEnvIntsTemplate ¶ added in v0.1.1
func NewEnvIntsTemplate(template EnvTemplate) *EnvInts
NewEnvIntsTemplate creates EnvInts from template
func NewEnvIntsValue ¶ added in v0.1.1
NewEnvIntsValue creates EnvInts from value
func (EnvInts) JSONSchema ¶ added in v0.2.4
func (j EnvInts) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema
func (EnvInts) MarshalJSON ¶ added in v0.1.1
MarshalJSON implements json.Marshaler.
func (EnvInts) MarshalYAML ¶ added in v0.1.1
MarshalYAML implements yaml.Marshaler.
func (*EnvInts) UnmarshalJSON ¶ added in v0.1.1
UnmarshalJSON implements json.Unmarshaler.
func (*EnvInts) UnmarshalYAML ¶ added in v0.1.1
UnmarshalYAML implements yaml.Unmarshaler.
type EnvString ¶ added in v0.1.1
type EnvString struct { EnvTemplate // contains filtered or unexported fields }
EnvString implements the environment encoding and decoding value
func NewEnvStringTemplate ¶ added in v0.1.1
func NewEnvStringTemplate(template EnvTemplate) *EnvString
NewEnvStringTemplate creates an EnvString from template
func NewEnvStringValue ¶ added in v0.1.1
NewEnvStringValue creates an EnvString from value
func (EnvString) JSONSchema ¶ added in v0.2.4
func (j EnvString) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema
func (EnvString) MarshalJSON ¶ added in v0.1.1
MarshalJSON implements json.Marshaler.
func (EnvString) MarshalYAML ¶ added in v0.1.1
MarshalYAML implements yaml.Marshaler interface
func (*EnvString) UnmarshalJSON ¶ added in v0.1.1
UnmarshalJSON implements json.Unmarshaler.
func (*EnvString) UnmarshalYAML ¶ added in v0.1.1
UnmarshalYAML implements yaml.Unmarshaler.
type EnvTemplate ¶
EnvTemplate represents an environment variable template
func FindAllEnvTemplates ¶
func FindAllEnvTemplates(input string) []EnvTemplate
FindAllEnvTemplates finds all unique environment templates from string
func FindEnvTemplate ¶
func FindEnvTemplate(input string) *EnvTemplate
FindEnvTemplate finds one environment template from string
func NewEnvTemplate ¶
func NewEnvTemplate(name string) EnvTemplate
NewEnvTemplate creates an EnvTemplate without default value
func NewEnvTemplateWithDefault ¶
func NewEnvTemplateWithDefault(name string, defaultValue string) EnvTemplate
NewEnvTemplateWithDefault creates an EnvTemplate with a default value
func (EnvTemplate) IsEmpty ¶ added in v0.1.1
func (et EnvTemplate) IsEmpty() bool
IsEmpty checks if env template is empty
func (EnvTemplate) MarshalJSON ¶ added in v0.1.1
func (j EnvTemplate) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (EnvTemplate) MarshalYAML ¶ added in v0.1.1
func (j EnvTemplate) MarshalYAML() (any, error)
MarshalYAML implements yaml.Marshaler interface
func (EnvTemplate) String ¶
func (et EnvTemplate) String() string
String implements the Stringer interface
func (*EnvTemplate) UnmarshalJSON ¶ added in v0.1.1
func (j *EnvTemplate) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*EnvTemplate) UnmarshalYAML ¶ added in v0.1.1
func (j *EnvTemplate) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler interface
func (EnvTemplate) Value ¶
func (et EnvTemplate) Value() (string, bool)
Value returns the value which is retrieved from system or the default value if exist
type HTTPAuthConfig ¶
type HTTPAuthConfig struct { Header string `json:"header" yaml:"header" mapstructure:"header"` Scheme string `json:"scheme" yaml:"scheme" mapstructure:"scheme"` }
HTTPAuthConfig contains configurations for http authentication If the scheme is basic or bearer, the authenticator follows OpenAPI 3 specification.
func (HTTPAuthConfig) Validate ¶
func (ss HTTPAuthConfig) Validate() error
Validate if the current instance is valid
type NDCRestSchema ¶
type NDCRestSchema struct { SchemaRef string `json:"$schema,omitempty" yaml:"$schema,omitempty" mapstructure:"$schema"` Settings *NDCRestSettings `json:"settings,omitempty" yaml:"settings,omitempty" mapstructure:"settings"` // Collections which are available for queries Collections []schema.CollectionInfo `json:"collections" yaml:"collections" mapstructure:"collections"` // Functions (i.e. collections which return a single column and row) Functions []*RESTFunctionInfo `json:"functions" yaml:"functions" mapstructure:"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 schema.SchemaResponseObjectTypes `json:"object_types" yaml:"object_types" mapstructure:"object_types"` // Procedures which are available for execution as part of mutations Procedures []*RESTProcedureInfo `json:"procedures" yaml:"procedures" mapstructure:"procedures"` // A list of scalar types which will be used as the types of collection columns ScalarTypes schema.SchemaResponseScalarTypes `json:"scalar_types" yaml:"scalar_types" mapstructure:"scalar_types"` }
NDCRestSchema extends the [NDC SchemaResponse] with OpenAPI REST information
func NewNDCRestSchema ¶
func NewNDCRestSchema() *NDCRestSchema
NewNDCRestSchema creates a NDCRestSchema instance
func (NDCRestSchema) ToSchemaResponse ¶
func (ndc NDCRestSchema) ToSchemaResponse() *schema.SchemaResponse
ToSchemaResponse converts the instance to NDC schema.SchemaResponse
type NDCRestSettings ¶
type NDCRestSettings struct { Servers []ServerConfig `json:"servers" yaml:"servers" mapstructure:"servers"` Headers map[string]EnvString `json:"headers,omitempty" yaml:"headers,omitempty" mapstructure:"headers"` // configure the request timeout in seconds, default 30s Timeout *EnvInt `json:"timeout,omitempty" yaml:"timeout,omitempty" mapstructure:"timeout"` Retry *RetryPolicySetting `json:"retry,omitempty" yaml:"retry,omitempty" mapstructure:"retry"` SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty" mapstructure:"securitySchemes"` Security AuthSecurities `json:"security,omitempty" yaml:"security,omitempty" mapstructure:"security"` Version string `json:"version,omitempty" yaml:"version,omitempty" mapstructure:"version"` }
NDCRestSettings represent global settings of the REST API, including base URL, headers, etc...
func (*NDCRestSettings) UnmarshalJSON ¶
func (j *NDCRestSettings) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (NDCRestSettings) Validate ¶
func (rs NDCRestSettings) Validate() error
Validate if the current instance is valid
type OAuth2Config ¶
type OAuth2Config struct {
Flows map[OAuthFlowType]OAuthFlow `json:"flows" yaml:"flows" mapstructure:"flows"`
}
OAuth2Config contains configurations for OAuth 2.0 API specification
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" yaml:"authorizationUrl,omitempty" mapstructure:"authorizationUrl"` TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty" mapstructure:"tokenUrl"` RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty" mapstructure:"refreshUrl"` Scopes map[string]string `json:"scopes,omitempty" yaml:"scopes,omitempty" mapstructure:"scopes"` }
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 OpenIDConfig ¶
type OpenIDConfig struct {
OpenIDConnectURL string `json:"openIdConnectUrl" yaml:"openIdConnectUrl" mapstructure:"openIdConnectUrl"`
}
OpenIDConfig contains configurations for OpenID Connect API specification
func (OpenIDConfig) Validate ¶
func (ss OpenIDConfig) Validate() error
Validate if the current instance is valid
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
IsEmpty checks if the style enum is valid
func (ParameterEncodingStyle) JSONSchema ¶ added in v0.2.4
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 ¶ added in v0.2.0
func (j ParameterLocation) IsValid() bool
IsEmpty checks if the style enum is valid
func (ParameterLocation) JSONSchema ¶ added in v0.2.4
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 RESTFunctionInfo ¶
type RESTFunctionInfo struct { Request *Request `json:"request" yaml:"request" mapstructure:"request"` schema.FunctionInfo `yaml:",inline"` }
RESTFunctionInfo extends NDC query function with OpenAPI REST information
func (*RESTFunctionInfo) UnmarshalJSON ¶
func (j *RESTFunctionInfo) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type RESTProcedureInfo ¶
type RESTProcedureInfo struct { Request *Request `json:"request" yaml:"request" mapstructure:"request"` schema.ProcedureInfo `yaml:",inline"` }
RESTProcedureInfo extends NDC mutation procedure with OpenAPI REST information
func (*RESTProcedureInfo) UnmarshalJSON ¶
func (j *RESTProcedureInfo) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Request ¶
type Request struct { URL string `json:"url,omitempty" yaml:"url,omitempty" mapstructure:"url"` Method string `` /* 133-byte string literal not displayed */ Type RequestType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type"` Headers map[string]EnvString `json:"headers,omitempty" yaml:"headers,omitempty" mapstructure:"headers"` Parameters []RequestParameter `json:"parameters,omitempty" yaml:"parameters,omitempty" mapstructure:"parameters"` Security AuthSecurities `json:"security,omitempty" yaml:"security,omitempty" mapstructure:"security"` // configure the request timeout in seconds, default 30s Timeout uint `json:"timeout,omitempty" yaml:"timeout,omitempty" mapstructure:"timeout"` Servers []ServerConfig `json:"servers,omitempty" yaml:"servers,omitempty" mapstructure:"servers"` RequestBody *RequestBody `json:"requestBody,omitempty" yaml:"requestBody,omitempty" mapstructure:"requestBody"` Response Response `json:"response" yaml:"response" mapstructure:"response"` Retry *RetryPolicy `json:"retry,omitempty" yaml:"retry,omitempty" mapstructure:"retry"` }
Request represents the HTTP request information of the webhook
type RequestBody ¶
type RequestBody struct { ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty" mapstructure:"contentType"` Schema *TypeSchema `json:"schema,omitempty" yaml:"schema,omitempty" mapstructure:"schema"` Encoding map[string]EncodingObject `json:"encoding,omitempty" yaml:"encoding,omitempty" mapstructure:"encoding"` }
RequestBody defines flexible request body with content types
type RequestParameter ¶
type RequestParameter struct { EncodingObject `yaml:",inline"` Name string `json:"name,omitempty" yaml:"name,omitempty" mapstructure:"name"` ArgumentName string `json:"argumentName,omitempty" yaml:"argumentName,omitempty" mapstructure:"argumentName,omitempty"` In ParameterLocation `json:"in,omitempty" yaml:"in,omitempty" mapstructure:"in"` Schema *TypeSchema `json:"schema,omitempty" yaml:"schema,omitempty" mapstructure:"schema"` }
RequestParameter represents an HTTP request parameter
type RequestType ¶
type RequestType string
RequestType represents the request type enum
const (
RequestTypeREST RequestType = "rest"
)
func ParseRequestType ¶
func ParseRequestType(value string) (RequestType, error)
ParseRequestType parses RequestType from string
func (*RequestType) UnmarshalJSON ¶
func (j *RequestType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Response ¶ added in v0.2.3
type Response struct {
ContentType string `json:"contentType" yaml:"contentType" mapstructure:"contentType"`
}
type RetryPolicy ¶ added in v0.1.1
type RetryPolicy struct { // Number of retry times Times uint `json:"times,omitempty" yaml:"times,omitempty" mapstructure:"times"` // Delay retry delay in milliseconds Delay uint `json:"delay,omitempty" yaml:"delay,omitempty" mapstructure:"delay"` // HTTPStatus retries if the remote service returns one of these http status HTTPStatus []int `json:"httpStatus,omitempty" yaml:"httpStatus,omitempty" mapstructure:"httpStatus"` }
RetryPolicy represents the retry policy of request
type RetryPolicySetting ¶ added in v0.1.1
type RetryPolicySetting struct { // Number of retry times Times EnvInt `json:"times,omitempty" yaml:"times,omitempty" mapstructure:"times"` // Delay retry delay in milliseconds Delay EnvInt `json:"delay,omitempty" yaml:"delay,omitempty" mapstructure:"delay"` // HTTPStatus retries if the remote service returns one of these http status HTTPStatus EnvInts `json:"httpStatus,omitempty" yaml:"httpStatus,omitempty" mapstructure:"httpStatus"` }
RetryPolicySetting represents retry policy settings
func (RetryPolicySetting) Validate ¶ added in v0.1.1
func (rs RetryPolicySetting) Validate() error
Validate if the current instance is valid
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 = "Email" ScalarURI ScalarName = "URI" ScalarIPV4 ScalarName = "IPv4" ScalarIPV6 ScalarName = "IPv6" )
type SchemaFileFormat ¶
type SchemaFileFormat string
SchemaFileFormat represents the file format enum for NDC REST 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 ¶ added in v0.2.0
func (j SchemaFileFormat) IsValid() bool
IsEmpty checks if the style enum is valid
func (SchemaFileFormat) JSONSchema ¶ added in v0.2.4
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 ¶ added in v0.2.4
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 { Type SecuritySchemeType `json:"type" yaml:"type" mapstructure:"type"` Value *EnvString `json:"value,omitempty" yaml:"value,omitempty" mapstructure:"value"` *APIKeyAuthConfig `yaml:",inline"` *HTTPAuthConfig `yaml:",inline"` *OAuth2Config `yaml:",inline"` *OpenIDConfig `yaml:",inline"` }
SecurityScheme contains authentication configurations. The schema follows OpenAPI 3 specification
func (SecurityScheme) JSONSchema ¶ added in v0.2.4
func (j SecurityScheme) JSONSchema() *jsonschema.Schema
JSONSchema is used to generate a custom jsonschema
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" HTTPAuthScheme SecuritySchemeType = "http" OAuth2Scheme SecuritySchemeType = "oauth2" OpenIDConnectScheme SecuritySchemeType = "openIdConnect" )
func ParseSecuritySchemeType ¶
func ParseSecuritySchemeType(value string) (SecuritySchemeType, error)
ParseSecuritySchemeType parses SecurityScheme from string
func (SecuritySchemeType) JSONSchema ¶ added in v0.2.4
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 ServerConfig ¶
type ServerConfig struct { URL EnvString `json:"url" yaml:"url" mapstructure:"url"` ID string `json:"id,omitempty" yaml:"id,omitempty" mapstructure:"group"` Headers map[string]EnvString `json:"headers,omitempty" yaml:"headers,omitempty" mapstructure:"headers"` // configure the request timeout in seconds, default 30s Timeout *EnvInt `json:"timeout,omitempty" yaml:"timeout,omitempty" mapstructure:"timeout"` Retry *RetryPolicySetting `json:"retry,omitempty" yaml:"retry,omitempty" mapstructure:"retry"` SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty" mapstructure:"securitySchemes"` Security AuthSecurities `json:"security,omitempty" yaml:"security,omitempty" mapstructure:"security"` }
ServerConfig contains server configurations
func (ServerConfig) Validate ¶
func (ss ServerConfig) Validate() error
Validate if the current instance is valid
type TypeSchema ¶
type TypeSchema struct { Type string `json:"type" yaml:"type" mapstructure:"type"` Format string `json:"format,omitempty" yaml:"format,omitempty" mapstructure:"format"` Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty" mapstructure:"pattern"` Nullable bool `json:"nullable,omitempty" yaml:"nullable,omitempty" mapstructure:"nullable"` Maximum *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty" mapstructure:"maximum"` Minimum *float64 `json:"minimum,omitempty," yaml:"minimum,omitempty" mapstructure:"minimum"` MaxLength *int64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty" mapstructure:"maxLength"` MinLength *int64 `json:"minLength,omitempty" yaml:"minLength,omitempty" mapstructure:"minLength"` Enum []string `json:"enum,omitempty" yaml:"enum,omitempty" mapstructure:"enum"` Items *TypeSchema `json:"items,omitempty" yaml:"items,omitempty" mapstructure:"items"` Properties map[string]TypeSchema `json:"properties,omitempty" yaml:"properties,omitempty" mapstructure:"properties"` 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