openapistackql

package
v0.0.9-alpha27 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodDescription string = "description"
	MethodName        string = "MethodName"
	RequiredParams    string = "RequiredParams"
	SQLVerb           string = "SQLVerb"
)
View Source
const (
	ExtensionKeyAlwaysRequired string = "x-alwaysRequired"
	ExtensionKeyGraphQL        string = "x-stackQL-graphQL"
	ExtensionKeyProvider       string = "x-stackql-provider"
	ExtensionKeyResources      string = "x-stackQL-resources"
)
View Source
const (
	RequestBodyKeyPrefix    string = "data"
	RequestBodyKeyDelimiter string = "__"
	RequestBodyBaseKey      string = RequestBodyKeyPrefix + RequestBodyKeyDelimiter
)
View Source
const (
	ConfigFilesMode fs.FileMode = 0664
)

Variables

View Source
var (
	IgnoreEmbedded  bool
	OpenapiFileRoot string
)
View Source
var (
	AnonymousColumnName string = defaultAnonymousColumnName
)

Functions

func GetDescribeHeader

func GetDescribeHeader(extended bool) []string

func GetProviderDocBytes

func GetProviderDocBytes(prov string) ([]byte, error)

func GetResourcesHeader

func GetResourcesHeader(extended bool) []string

func GetResourcesRegisterDocBytes

func GetResourcesRegisterDocBytes(url string) ([]byte, error)

func GetServersFromHeirarchy

func GetServersFromHeirarchy(t *Service, op *OperationStore) openapi3.Servers

func GetServiceDocBytes

func GetServiceDocBytes(url string) ([]byte, error)

func GetServicesHeader

func GetServicesHeader(extended bool) []string

func InterfaceToSQLType

func InterfaceToSQLType(val interface{}) (sqltypes.Value, error)

func ObtainServerURLsFromServers

func ObtainServerURLsFromServers(svs []*openapi3.Server, vars map[string]string) ([]string, error)

func ProviderTypeConditionIsValid

func ProviderTypeConditionIsValid(providerType string, lhs string, rhs interface{}) bool

func ResourceConditionIsValid

func ResourceConditionIsValid(lhs string, rhs interface{}) bool

func ResourceKeyExists

func ResourceKeyExists(key string) bool

func ServiceConditionIsValid

func ServiceConditionIsValid(lhs string, rhs interface{}) bool

func ServiceKeyExists

func ServiceKeyExists(key string) bool

Types

type AuthMetadata

type AuthMetadata struct {
	Principal string `json:"principal"`
	Type      string `json:"type"`
	Source    string `json:"source"`
}

func (*AuthMetadata) GetHeaders

func (am *AuthMetadata) GetHeaders() []string

func (*AuthMetadata) ToMap

func (am *AuthMetadata) ToMap() map[string]interface{}

type ColumnDescriptor

type ColumnDescriptor struct {
	Alias        string
	Name         string
	Schema       *Schema
	DecoratedCol string
	Val          *sqlparser.SQLVal
}

func NewColumnDescriptor

func NewColumnDescriptor(alias string, name string, decoratedCol string, schema *Schema, val *sqlparser.SQLVal) ColumnDescriptor

func (ColumnDescriptor) GetIdentifier

func (cd ColumnDescriptor) GetIdentifier() string

type DiscoveryDoc

type DiscoveryDoc interface {
	// contains filtered or unexported methods
}

type ExpectedRequest

type ExpectedRequest struct {
	BodyMediaType string `json:"mediaType,omitempty" yaml:"mediaType,omitempty"`
	Schema        *Schema
	Required      []string `json:"required,omitempty" yaml:"required,omitempty"`
}

type ExpectedResponse

type ExpectedResponse struct {
	BodyMediaType string `json:"mediaType,omitempty" yaml:"mediaType,omitempty"`
	OpenAPIDocKey string `json:"openAPIDocKey,omitempty" yaml:"openAPIDocKey,omitempty"`
	ObjectKey     string `json:"objectKey,omitempty" yaml:"objectKey,omitempty"`
	Schema        *Schema
}

type GraphQL

type GraphQL struct {
	ID               string         `json:"id" yaml:"id"`
	Query            string         `json:"query,omitempty" yaml:"query,omitempty"` // Required
	Cursor           GraphQLElement `json:"cursor,omitempty" yaml:"cursor,omitempty"`
	ReponseSelection GraphQLElement `json:"responseSelection,omitempty" yaml:"responseSelection,omitempty"`
	URL              string         `json:"url" yaml:"url"`
	HTTPVerb         string         `json:"httpVerb" yaml:"httpVerb"`
}

func (*GraphQL) GetCursorJSONPath

func (gq *GraphQL) GetCursorJSONPath() (string, bool)

func (*GraphQL) GetResponseJSONPath

func (gq *GraphQL) GetResponseJSONPath() (string, bool)

func (GraphQL) JSONLookup

func (gq GraphQL) JSONLookup(token string) (interface{}, error)

type GraphQLElement

type GraphQLElement map[string]interface{}

type ITable

type ITable interface {
	GetName() string
	KeyExists(string) bool
	GetKey(string) (interface{}, error)
	GetKeyAsSqlVal(string) (sqltypes.Value, error)
	GetRequiredParameters() map[string]*Parameter
	FilterBy(func(interface{}) (ITable, error)) (ITable, error)
}

type Loader

type Loader struct {
	*openapi3.Loader
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader() *Loader

func (*Loader) GetDocBytes

func (loader *Loader) GetDocBytes(responses openapi3.Responses) (*Schema, bool)

func (*Loader) LoadFromBytes

func (l *Loader) LoadFromBytes(bytes []byte) (*Service, error)

func (*Loader) LoadFromBytesAndResources

func (l *Loader) LoadFromBytesAndResources(rr *ResourceRegister, resourceKey string, bytes []byte) (*Service, error)

type MetadataStore

type MetadataStore struct {
	Store map[string]*Service
}

func (*MetadataStore) GetResource

func (ms *MetadataStore) GetResource(serviceName string, resourceName string) (*Resource, error)

func (*MetadataStore) GetResources

func (ms *MetadataStore) GetResources(serviceName string) (map[string]*Resource, error)

func (*MetadataStore) GetServices

func (ms *MetadataStore) GetServices() ([]*Service, error)

type MethodSet

type MethodSet []*OperationStore

func (MethodSet) GetFirst

func (ms MethodSet) GetFirst() (*OperationStore, string, bool)

func (MethodSet) GetFirstMatch

func (ms MethodSet) GetFirstMatch(params map[string]interface{}) (*OperationStore, map[string]interface{}, bool)

type Methods

type Methods map[string]OperationStore

func (Methods) FindFromSelector

func (ms Methods) FindFromSelector(sel OperationSelector) (*OperationStore, error)

func (Methods) FindMethod

func (ms Methods) FindMethod(key string) (*OperationStore, error)

func (Methods) OrderMethods

func (ms Methods) OrderMethods() ([]OperationStore, error)

type OperationRef

type OperationRef struct {
	Ref   string `json:"$ref" yaml:"$ref"`
	Value *openapi3.Operation
}

func (OperationRef) ExtractMethodItem

func (opr OperationRef) ExtractMethodItem() string

func (OperationRef) ExtractPathItem

func (opr OperationRef) ExtractPathItem() string

func (OperationRef) ExtractServiceDocPath

func (opr OperationRef) ExtractServiceDocPath() string

func (OperationRef) JSONLookup

func (value OperationRef) JSONLookup(token string) (interface{}, error)

func (*OperationRef) MarshalJSON

func (value *OperationRef) MarshalJSON() ([]byte, error)

func (*OperationRef) UnmarshalJSON

func (value *OperationRef) UnmarshalJSON(data []byte) error

func (*OperationRef) Validate

func (value *OperationRef) Validate(ctx context.Context) error

type OperationSelector

type OperationSelector struct {
	SQLVerb string `json:"sqlVerb" yaml:"sqlVerb"` // Required
	// Optional parameters.
	Parameters map[string]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

func NewOperationSelector

func NewOperationSelector(slqVerb string, params map[string]interface{}) OperationSelector

type OperationStore

type OperationStore struct {
	MethodKey string   `json:"-" yaml:"-"`
	SQLVerb   string   `json:"-" yaml:"-"`
	GraphQL   *GraphQL `json:"-" yaml:"-"`
	// Optional parameters.
	Parameters   map[string]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	PathItem     *openapi3.PathItem     `json:"-" yaml:"-"`                 // Required
	APIMethod    string                 `json:"apiMethod" yaml:"apiMethod"` // Required
	OperationRef *OperationRef          `json:"operation" yaml:"operation"` // Required
	PathRef      *PathItemRef           `json:"path" yaml:"path"`           // Deprecated
	Request      *ExpectedRequest       `json:"request" yaml:"request"`
	Response     *ExpectedResponse      `json:"response" yaml:"response"`
	Servers      *openapi3.Servers      `json:"servers" yaml:"servers"`

	ProviderService *ProviderService `json:"-" yaml:"-"` // upwards traversal
	Provider        *Provider        `json:"-" yaml:"-"` // upwards traversal
	Service         *Service         `json:"-" yaml:"-"` // upwards traversal
	Resource        *Resource        `json:"-" yaml:"-"` // upwards traversal
	// contains filtered or unexported fields
}

func (*OperationStore) DeprecatedProcessResponse

func (op *OperationStore) DeprecatedProcessResponse(response *http.Response) (map[string]interface{}, error)

func (*OperationStore) FilterBy

func (m *OperationStore) FilterBy(predicate func(interface{}) (ITable, error)) (ITable, error)

func (*OperationStore) GetColumnOrder

func (m *OperationStore) GetColumnOrder(extended bool) []string

func (*OperationStore) GetKey

func (m *OperationStore) GetKey(lhs string) (interface{}, error)

func (*OperationStore) GetKeyAsSqlVal

func (m *OperationStore) GetKeyAsSqlVal(lhs string) (sqltypes.Value, error)

func (*OperationStore) GetName

func (m *OperationStore) GetName() string

func (*OperationStore) GetOperationParameter

func (op *OperationStore) GetOperationParameter(key string) (*Parameter, bool)

func (*OperationStore) GetOperationParameters

func (op *OperationStore) GetOperationParameters() Parameters

func (*OperationStore) GetOptimalResponseMediaType

func (op *OperationStore) GetOptimalResponseMediaType() string

func (*OperationStore) GetOptionalParameters

func (m *OperationStore) GetOptionalParameters() map[string]*Parameter

func (*OperationStore) GetParameter

func (m *OperationStore) GetParameter(paramKey string) (*Parameter, bool)

func (*OperationStore) GetParameterizedPath

func (op *OperationStore) GetParameterizedPath() string

func (*OperationStore) GetParameters

func (m *OperationStore) GetParameters() map[string]*Parameter

func (*OperationStore) GetRequestBodyRequiredProperties

func (op *OperationStore) GetRequestBodyRequiredProperties() ([]string, error)

func (*OperationStore) GetRequestBodySchema

func (op *OperationStore) GetRequestBodySchema() (*Schema, error)

func (*OperationStore) GetRequiredParameters

func (m *OperationStore) GetRequiredParameters() map[string]*Parameter

func (*OperationStore) GetResponseBodySchemaAndMediaType

func (op *OperationStore) GetResponseBodySchemaAndMediaType() (*Schema, string, error)

func (*OperationStore) GetSelectItemsKey

func (m *OperationStore) GetSelectItemsKey() string

func (*OperationStore) GetSelectSchemaAndObjectPath

func (op *OperationStore) GetSelectSchemaAndObjectPath() (*Schema, string, error)

func (*OperationStore) IsAwaitable

func (m *OperationStore) IsAwaitable() bool

func (*OperationStore) IsNullary

func (op *OperationStore) IsNullary() bool

func (*OperationStore) IsRequiredRequestBodyProperty

func (op *OperationStore) IsRequiredRequestBodyProperty(key string) bool

func (*OperationStore) KeyExists

func (m *OperationStore) KeyExists(lhs string) bool

func (*OperationStore) ParameterMatch

func (op *OperationStore) ParameterMatch(params map[string]interface{}) (map[string]interface{}, bool)

func (*OperationStore) Parameterize

func (op *OperationStore) Parameterize(prov *Provider, parentDoc *Service, inputParams map[string]interface{}, requestBody interface{}) (*openapi3filter.RequestValidationInput, error)

func (*OperationStore) ProcessResponse

func (op *OperationStore) ProcessResponse(response *http.Response) (*response.Response, error)

func (*OperationStore) ToPresentationMap

func (m *OperationStore) ToPresentationMap(extended bool) map[string]interface{}

type OperationStoreRef

type OperationStoreRef struct {
	Ref   string `json:"$ref" yaml:"$ref"`
	Value *OperationStore
}

type Parameter

type Parameter openapi3.Parameter

func (*Parameter) ConditionIsValid

func (p *Parameter) ConditionIsValid(lhs string, rhs interface{}) bool

func (*Parameter) GetType

func (p *Parameter) GetType() string

type ParameterSuffixMap

type ParameterSuffixMap struct {
	// contains filtered or unexported fields
}

func MakeSuffixMapFromParameterMap

func MakeSuffixMapFromParameterMap(m map[string]*Parameter) *ParameterSuffixMap

func NewParameterSuffixMap

func NewParameterSuffixMap() *ParameterSuffixMap

func (*ParameterSuffixMap) Delete

func (psm *ParameterSuffixMap) Delete(k string) bool

func (*ParameterSuffixMap) Get

func (psm *ParameterSuffixMap) Get(k string) (*Parameter, bool)

func (*ParameterSuffixMap) GetAll

func (psm *ParameterSuffixMap) GetAll() map[string]*Parameter

func (*ParameterSuffixMap) Put

func (psm *ParameterSuffixMap) Put(k string, v *Parameter)

func (*ParameterSuffixMap) Size

func (psm *ParameterSuffixMap) Size() int

type Parameters

type Parameters openapi3.Parameters

func (Parameters) GetParameter

func (p Parameters) GetParameter(key string) (*Parameter, bool)

type PathItemRef

type PathItemRef struct {
	Ref   string `json:"$ref" yaml:"$ref"`
	Value *openapi3.PathItem
}

type Provider

type Provider struct {
	openapi3.ExtensionProps
	ResponseKeys
	FilePath         string                      `json:"-" yaml:"-"`
	ID               string                      `json:"id" yaml:"id"`
	Name             string                      `json:"name" yaml:"name"`
	Title            string                      `json:"title" yaml:"title"`
	Version          string                      `json:"version" yaml:"version"`
	Description      string                      `json:"description,omitempty" yaml:"desription,omitempty"`
	ProviderServices map[string]*ProviderService `json:"providerServices,omitempty" yaml:"providerServices,omitempty"`
}

func LoadProviderByName

func LoadProviderByName(prov, version string) (*Provider, error)

func LoadProviderDocFromBytes

func LoadProviderDocFromBytes(bytes []byte) (*Provider, error)

func LoadProviderDocFromFile

func LoadProviderDocFromFile(fileName string) (*Provider, error)

func NewProvider

func NewProvider(id, name, title, version string) *Provider

func (*Provider) Debug

func (pr *Provider) Debug() string

func (*Provider) GetProviderService

func (pr *Provider) GetProviderService(key string) (*ProviderService, error)

func (*Provider) GetResourcesShallow

func (pr *Provider) GetResourcesShallow(serviceKey string) (*ResourceRegister, error)

func (*Provider) GetService

func (pr *Provider) GetService(key string) (*Service, error)

func (Provider) JSONLookup

func (prov Provider) JSONLookup(token string) (interface{}, error)

func (*Provider) MarshalJSON

func (pr *Provider) MarshalJSON() ([]byte, error)

func (*Provider) ToJson

func (pr *Provider) ToJson() ([]byte, error)

func (*Provider) ToYaml

func (pr *Provider) ToYaml() ([]byte, error)

func (*Provider) ToYamlFile

func (pr *Provider) ToYamlFile(filePath string) error

func (*Provider) UnmarshalJSON

func (pr *Provider) UnmarshalJSON(data []byte) error

type ProviderDescription

type ProviderDescription struct {
	Versions []string `json:"versions" yaml: "versions"`
	// contains filtered or unexported fields
}

func (ProviderDescription) GetLatestVersion

func (pd ProviderDescription) GetLatestVersion() (string, error)

type ProviderInfo

type ProviderInfo struct {
	Name    string
	Version string
}

type ProviderService

type ProviderService struct {
	openapi3.ExtensionProps
	ID           string        `json:"id" yaml:"id"`           // Required
	Name         string        `json:"name" yaml:"name"`       // Required
	Title        string        `json:"title" yaml:"title"`     // Required
	Version      string        `json:"version" yaml:"version"` // Required
	Description  string        `json:"description" yaml:"description"`
	Preferred    bool          `json:"preferred" yaml:"preferred"`
	ServiceRef   *ServiceRef   `json:"service,omitempty" yaml:"service,omitempty"`     // will be lazy evaluated
	ResourcesRef *ResourcesRef `json:"resources,omitempty" yaml:"resources,omitempty"` // will be lazy evaluated
	Provider     *Provider     `json:"-" yaml:"-"`                                     // upwards traversal
}

func (*ProviderService) ConditionIsValid

func (sv *ProviderService) ConditionIsValid(lhs string, rhs interface{}) bool

func (*ProviderService) FilterBy

func (ps *ProviderService) FilterBy(predicate func(interface{}) (ITable, error)) (ITable, error)

func (*ProviderService) GetKey

func (ps *ProviderService) GetKey(lhs string) (interface{}, error)

func (*ProviderService) GetKeyAsSqlVal

func (ps *ProviderService) GetKeyAsSqlVal(lhs string) (sqltypes.Value, error)

func (*ProviderService) GetName

func (ps *ProviderService) GetName() string

func (*ProviderService) GetRequiredParameters

func (ps *ProviderService) GetRequiredParameters() map[string]*Parameter

func (*ProviderService) GetResourcesShallow

func (ps *ProviderService) GetResourcesShallow() (*ResourceRegister, error)

func (*ProviderService) GetService

func (ps *ProviderService) GetService() (*Service, error)

func (*ProviderService) GetServiceFragment

func (ps *ProviderService) GetServiceFragment(resourceKey string) (*Service, error)

func (*ProviderService) KeyExists

func (ps *ProviderService) KeyExists(lhs string) bool

func (*ProviderService) MarshalJSON

func (pr *ProviderService) MarshalJSON() ([]byte, error)

func (*ProviderService) PeekServiceFragment

func (ps *ProviderService) PeekServiceFragment(resourceKey string) (*Service, bool)

func (*ProviderService) ToMap

func (ps *ProviderService) ToMap() map[string]interface{}

func (*ProviderService) UnmarshalJSON

func (pr *ProviderService) UnmarshalJSON(data []byte) error

type ProvidersList

type ProvidersList struct {
	Providers map[string]ProviderDescription `json:"providers" yaml: "providers"`
	// contains filtered or unexported fields
}

func NewProvidersList

func NewProvidersList() ProvidersList

func (ProvidersList) GetLatestList

func (pl ProvidersList) GetLatestList() (ProvidersList, error)

func (ProvidersList) GetSingleProviderList

func (pl ProvidersList) GetSingleProviderList(prov string) ProvidersList

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func (*Registry) GetDocBytes

func (r *Registry) GetDocBytes(docPath string) ([]byte, error)

func (*Registry) GetLatestAvailableVersion

func (r *Registry) GetLatestAvailableVersion(providerName string) (string, error)

func (*Registry) GetResourcesRegisterDocBytes

func (r *Registry) GetResourcesRegisterDocBytes(url string) ([]byte, error)

func (*Registry) GetResourcesShallowFromProvider

func (r *Registry) GetResourcesShallowFromProvider(pr *Provider, serviceKey string) (*ResourceRegister, error)

func (*Registry) GetResourcesShallowFromProviderService

func (r *Registry) GetResourcesShallowFromProviderService(pr *ProviderService) (*ResourceRegister, error)

func (*Registry) GetResourcesShallowFromURL

func (r *Registry) GetResourcesShallowFromURL(ps *ProviderService) (*ResourceRegister, error)

func (*Registry) GetService

func (r *Registry) GetService(ps *ProviderService) (*Service, error)

func (*Registry) GetServiceDocBytes

func (r *Registry) GetServiceDocBytes(url string) ([]byte, error)

func (*Registry) GetServiceFragment

func (r *Registry) GetServiceFragment(ps *ProviderService, resourceKey string) (*Service, error)

func (*Registry) GetServiceFromProviderService

func (r *Registry) GetServiceFromProviderService(ps *ProviderService) (*Service, error)

func (*Registry) ListAllAvailableProviders

func (r *Registry) ListAllAvailableProviders() (map[string]ProviderDescription, error)

func (*Registry) ListAllProviderVersions

func (r *Registry) ListAllProviderVersions(prov string) (map[string]ProviderDescription, error)

func (*Registry) ListLocallyAvailableProviders

func (r *Registry) ListLocallyAvailableProviders() map[string]ProviderDescription

func (*Registry) LoadProviderByName

func (r *Registry) LoadProviderByName(prov string, version string) (*Provider, error)

func (*Registry) PullAndPersistProviderArchive

func (r *Registry) PullAndPersistProviderArchive(prov string, version string) error

func (*Registry) PullProviderArchive

func (r *Registry) PullProviderArchive(prov string, version string) (io.ReadCloser, error)

type RegistryAPI

type RegistryAPI interface {
	PullAndPersistProviderArchive(string, string) error
	PullProviderArchive(string, string) (io.ReadCloser, error)
	ListAllAvailableProviders() (map[string]ProviderDescription, error)
	ListAllProviderVersions(string) (map[string]ProviderDescription, error)
	ListLocallyAvailableProviders() map[string]ProviderDescription
	GetDocBytes(string) ([]byte, error)
	GetLatestAvailableVersion(string) (string, error)
	GetResourcesShallowFromProvider(*Provider, string) (*ResourceRegister, error)
	GetResourcesShallowFromProviderService(*ProviderService) (*ResourceRegister, error)
	GetResourcesShallowFromURL(ps *ProviderService) (*ResourceRegister, error)
	GetService(ps *ProviderService) (*Service, error)
	GetServiceFragment(*ProviderService, string) (*Service, error)
	GetServiceFromProviderService(*ProviderService) (*Service, error)
	GetServiceDocBytes(string) ([]byte, error)
	GetResourcesRegisterDocBytes(string) ([]byte, error)
	LoadProviderByName(string, string) (*Provider, error)
}

func GetMockLocalRegistry

func GetMockLocalRegistry(vc RegistryConfig) (RegistryAPI, error)

func GetMockRegistry

func GetMockRegistry(vc RegistryConfig) (RegistryAPI, error)

func NewRegistry

func NewRegistry(registryCfg RegistryConfig, transport http.RoundTripper) (RegistryAPI, error)

type RegistryConfig

type RegistryConfig struct {
	RegistryURL      string                   `json:"url" yaml:"url"`
	SrcPrefix        *string                  `json:"srcPrefix" yaml:"srcPrefix"`
	DistPrefix       *string                  `json:"distPrefix" yaml:"distPrefix"`
	AllowSrcDownload bool                     `json:"allowSrcDownload" yaml:"allowSrcDownload"`
	LocalDocRoot     string                   `json:"localDocRoot" yaml:"localDocRoot"`
	VerfifyConfig    *edcrypto.VerifierConfig `json:"verifyConfig" yaml:"verifyConfig"`
}

type Resource

type Resource struct {
	ID                string                         `json:"id" yaml:"id"`       // Required
	Name              string                         `json:"name" yaml:"name"`   // Required
	Title             string                         `json:"title" yaml:"title"` // Required
	Description       string                         `json:"description,omitempty" yaml:"desription,omitempty"`
	SelectorAlgorithm string                         `json:"selectorAlgorithm,omitempty" yaml:"selectorAlgorithm,omitempty"`
	Methods           Methods                        `json:"methods" yaml:"methods"`
	ServiceDocPath    *ServiceRef                    `json:"serviceDoc,omitempty" yaml:"serviceDoc,omitempty"`
	SQLVerbs          map[string][]OperationStoreRef `json:"sqlVerbs" yaml:"sqlVerbs"`
	BaseUrl           string                         `json:"baseUrl,omitempty" yaml:"baseUrl,omitempty"` // hack
	ProviderService   *ProviderService               `json:"-" yaml:"-"`                                 // upwards traversal
	Provider          *Provider                      `json:"-" yaml:"-"`                                 // upwards traversal
}

func (*Resource) ConditionIsValid

func (r *Resource) ConditionIsValid(lhs string, rhs interface{}) bool

func (*Resource) FilterBy

func (r *Resource) FilterBy(predicate func(interface{}) (ITable, error)) (ITable, error)

func (*Resource) FindMethod

func (r *Resource) FindMethod(key string) (*OperationStore, error)

func (*Resource) FindOperationStore

func (rs *Resource) FindOperationStore(sel OperationSelector) (*OperationStore, error)

func (*Resource) GetDefaultMethodKeysForSQLVerb

func (rs *Resource) GetDefaultMethodKeysForSQLVerb(sqlVerb string) []string

func (*Resource) GetFirstMethodFromSQLVerb

func (rs *Resource) GetFirstMethodFromSQLVerb(sqlVerb string) (*OperationStore, string, bool)

func (*Resource) GetFirstMethodMatchFromSQLVerb

func (rs *Resource) GetFirstMethodMatchFromSQLVerb(sqlVerb string, parameters map[string]interface{}) (*OperationStore, map[string]interface{}, bool)

func (*Resource) GetKey

func (rs *Resource) GetKey(lhs string) (interface{}, error)

func (*Resource) GetKeyAsSqlVal

func (rs *Resource) GetKeyAsSqlVal(lhs string) (sqltypes.Value, error)

func (*Resource) GetMethodsMatched

func (rs *Resource) GetMethodsMatched() Methods

func (*Resource) GetName

func (rs *Resource) GetName() string

func (*Resource) GetRequiredParameters

func (rs *Resource) GetRequiredParameters() map[string]*Parameter

func (*Resource) GetSelectableObject

func (rs *Resource) GetSelectableObject() string

func (Resource) JSONLookup

func (rsc Resource) JSONLookup(token string) (interface{}, error)

func (*Resource) KeyExists

func (rs *Resource) KeyExists(lhs string) bool

func (*Resource) ToMap

func (rs *Resource) ToMap(extended bool) map[string]interface{}

type ResourceRegister

type ResourceRegister struct {
	ServiceDocPath  *ServiceRef          `json:"serviceDoc,omitempty" yaml:"serviceDoc,omitempty"`
	Resources       map[string]*Resource `json:"resources,omitempty" yaml:"resources,omitempty"`
	ProviderService *ProviderService     `json:"-" yaml:"-"` // upwards traversal
	Provider        *Provider            `json:"-" yaml:"-"` // upwards traversal
}

func LoadResourcesShallow

func LoadResourcesShallow(ps *ProviderService, bt []byte) (*ResourceRegister, error)

func NewResourceRegister

func NewResourceRegister() *ResourceRegister

func (*ResourceRegister) ObtainServiceDocUrl

func (rr *ResourceRegister) ObtainServiceDocUrl(resourceKey string) string

type ResourcesRef

type ResourcesRef struct {
	Ref   string `json:"$ref" yaml:"$ref"`
	Value *ResourceRegister
}

type ResponseKeys

type ResponseKeys struct {
	SelectItemsKey string `json:"selectItemsKey,omitempty" yaml:"selectItemsKey,omitempty"`
	DeleteItemsKey string `json:"deleteItemsKey,omitempty" yaml:"deleteItemsKey,omitempty"`
}

type Schema

type Schema struct {
	*openapi3.Schema
	// contains filtered or unexported fields
}

func NewSchema

func NewSchema(sc *openapi3.Schema, key string) *Schema

func (*Schema) ConditionIsValid

func (s *Schema) ConditionIsValid(lhs string, rhs interface{}) bool

func (*Schema) DeprecatedProcessHttpResponse

func (s *Schema) DeprecatedProcessHttpResponse(response *http.Response, path string) (map[string]interface{}, error)

func (*Schema) FindByPath

func (s *Schema) FindByPath(path string, visited map[string]bool) *Schema

func (*Schema) GetAllColumns

func (s *Schema) GetAllColumns() []string

func (*Schema) GetItems

func (s *Schema) GetItems() (*Schema, error)

func (*Schema) GetItemsSchema

func (sc *Schema) GetItemsSchema() (*Schema, error)

func (*Schema) GetName

func (s *Schema) GetName() string

func (*Schema) GetProperties

func (s *Schema) GetProperties() (Schemas, error)

func (*Schema) GetProperty

func (s *Schema) GetProperty(propertyKey string) (*Schema, error)

func (*Schema) GetPropertySchema

func (sc *Schema) GetPropertySchema(key string) (*Schema, error)

func (*Schema) GetSelectListItems

func (schema *Schema) GetSelectListItems(key string) (*Schema, string)

func (*Schema) GetSelectSchema

func (schema *Schema) GetSelectSchema(itemsKey, mediaType string) (*Schema, string, error)

func (*Schema) IsArrayRef

func (s *Schema) IsArrayRef() bool

func (*Schema) IsBoolean

func (s *Schema) IsBoolean() bool

func (*Schema) IsFloat

func (s *Schema) IsFloat() bool

func (*Schema) IsIntegral

func (s *Schema) IsIntegral() bool

func (*Schema) IsRequired

func (s *Schema) IsRequired(key string) bool

func (*Schema) ProcessHttpResponse

func (s *Schema) ProcessHttpResponse(r *http.Response, path string) (*response.Response, error)

func (*Schema) Tabulate

func (s *Schema) Tabulate(omitColumns bool) *Tabulation

func (*Schema) ToDescriptionMap

func (s *Schema) ToDescriptionMap(extended bool) map[string]interface{}

type Schemas

type Schemas map[string]*Schema

type Service

type Service struct {
	*openapi3.T

	ProviderService *ProviderService `json:"-" yaml:"-"` // upwards traversal
	Provider        *Provider        `json:"-" yaml:"-"` // upwards traversal
	// contains filtered or unexported fields
}

func LoadServiceDocFromBytes

func LoadServiceDocFromBytes(ps *ProviderService, bytes []byte) (*Service, error)

func LoadServiceDocFromFile

func LoadServiceDocFromFile(ps *ProviderService, fileName string) (*Service, error)

func LoadServiceSubsetDocFromBytes

func LoadServiceSubsetDocFromBytes(rr *ResourceRegister, resourceKey string, bytes []byte) (*Service, error)

func NewService

func NewService(t *openapi3.T) *Service

func (*Service) AsSourceString

func (svc *Service) AsSourceString() string

func (*Service) ConditionIsValid

func (sv *Service) ConditionIsValid(lhs string, rhs interface{}) bool

func (*Service) FilterBy

func (sv *Service) FilterBy(predicate func(interface{}) (ITable, error)) (ITable, error)

func (*Service) GetKey

func (sv *Service) GetKey(lhs string) (interface{}, error)

func (*Service) GetKeyAsSqlVal

func (sv *Service) GetKeyAsSqlVal(lhs string) (sqltypes.Value, error)

func (*Service) GetName

func (svc *Service) GetName() string

func (*Service) GetRequiredParameters

func (rs *Service) GetRequiredParameters() map[string]*Parameter

func (*Service) GetResource

func (svc *Service) GetResource(resourceName string) (*Resource, error)

func (*Service) GetResources

func (svc *Service) GetResources() (map[string]*Resource, error)

func (*Service) GetSchema

func (svc *Service) GetSchema(key string) (*Schema, error)

func (*Service) GetSchemas

func (svc *Service) GetSchemas() (map[string]*Schema, error)

func (*Service) GetT

func (sv *Service) GetT() *openapi3.T

func (*Service) IsPreferred

func (svc *Service) IsPreferred() bool

func (*Service) KeyExists

func (sv *Service) KeyExists(lhs string) bool

func (*Service) ToJson

func (svc *Service) ToJson() ([]byte, error)

func (*Service) ToMap

func (svc *Service) ToMap() map[string]interface{}

func (*Service) ToSourceFile

func (svc *Service) ToSourceFile(outFile string) error

func (*Service) ToYaml

func (svc *Service) ToYaml() ([]byte, error)

func (*Service) ToYamlFile

func (svc *Service) ToYamlFile(filePath string) error

type ServiceRef

type ServiceRef struct {
	Ref   string `json:"$ref" yaml:"$ref"`
	Value *Service
}

type SimpleMockRegistryRoundTripper

type SimpleMockRegistryRoundTripper struct {
	// contains filtered or unexported fields
}

func NewSimpleMockRegistryRoundTripper

func NewSimpleMockRegistryRoundTripper(fileRoot string, registryRoot *url.URL) *SimpleMockRegistryRoundTripper

func (*SimpleMockRegistryRoundTripper) RoundTrip

type Tabulation

type Tabulation struct {
	// contains filtered or unexported fields
}

func GetTabulation

func GetTabulation(name, arrayType string) Tabulation

func (*Tabulation) GetColumns

func (t *Tabulation) GetColumns() []ColumnDescriptor

func (*Tabulation) GetName

func (t *Tabulation) GetName() string

func (*Tabulation) PushBackColumn

func (t *Tabulation) PushBackColumn(col ColumnDescriptor)

func (*Tabulation) RenameColumnsToXml

func (t *Tabulation) RenameColumnsToXml() *Tabulation

Jump to

Keyboard shortcuts

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