v1.6.11 Latest Latest

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 11 Imported by: 0




This section is empty.


This section is empty.


func MinVersion added in v1.2.0

func MinVersion() string

func SupportedTokenAcquisitions

func SupportedTokenAcquisitions() []string

SupportedTokenAcquisitions returns a collection of supported token acquisition methods

func SupportedVersions

func SupportedVersions() map[string]bool

SupportedVersions - returns map of supported versions

func Version

func Version() string

Version returns the current version of the Discovery Model parser


type CBPIIDebtorAccount added in v1.2.0

type CBPIIDebtorAccount struct {
	Identification string `json:"identification"`
	SchemeName     string `json:"scheme_name"`
	Name           string `json:"name,omitempty"`

func (CBPIIDebtorAccount) Validate added in v1.2.0

func (c CBPIIDebtorAccount) Validate() error

type ConditionalAPIProperties added in v1.2.0

type ConditionalAPIProperties struct {
	Name      string          `json:"name,omitempty"`
	Endpoints []ModelEndpoint `json:"endpoints,omitempty"`

func GetConditionalProperties added in v1.2.0

func GetConditionalProperties(disco *Model) ([]ConditionalAPIProperties, bool, error)

validator, err := schema.NewSwaggerOBSpecValidator(item.APISpecification.Name, item.APISpecification.Version)

type ConditionalProperty added in v1.2.0

type ConditionalProperty struct {
	Schema             string `json:"schema,omitempty" validate:"required"`
	Name               string `json:"name,omitempty" validate:"-"`     // transitional - will be required in a future version
	PropertyDeprecated string `json:"property,omitempty" validate:"-"` // property to be deprecated in favour of 'name'
	Path               string `json:"path,omitempty" validate:"required"`
	Required           bool   `json:"required,omitempty" validate:"-"`
	Request            bool   `json:"request,omitempty" validate:"-"` // indicates a request property that can be entered by the use
	Value              string `json:"value,omitempty" validate:"-"`

ConditionalProperty - Conditional schema property that has been implemented

type CustomTest

type CustomTest struct {
	ID           string            `json:"@id,omitempty"`                   // JSONLD ID Reference
	Name         string            `json:"name,omitempty"`                  // Name
	Description  string            `json:"description,omitempty"`           // Purpose of the testcase in simple words
	Replacements map[string]string `json:"replacementParameters,omitempty"` // replacement parameters
	Sequence     []model.TestCase  `json:"testSequence,omitempty"`          // TestCase to be run as part of this custom test

CustomTest used to read and make sense of the custom test json

type Model

type Model struct {
	DiscoveryModel ModelDiscovery `json:"discoveryModel" validate:"required,dive"`

Model - Top level struct holding discovery model.

func UnmarshalDiscoveryJSON

func UnmarshalDiscoveryJSON(discoveryJSON string) (*Model, error)

UnmarshalDiscoveryJSON - Used for testing in multiple packages to get discovery model from JSON. We tried moving this function to a _test file, but we get `go vet` error as it is used from multiple packages. In production, we use echo.Context Bind to load configuration from JSON in HTTP POST.

type ModelAPISpecification

type ModelAPISpecification struct {
	Name          string `json:"name" validate:"required"`
	URL           string `json:"url" validate:"required,url"`
	Version       string `json:"version" validate:"required"`
	SchemaVersion string `json:"schemaVersion" validate:"required,url"`
	Manifest      string `json:"manifest" validate:"required,fileorhttps"`
	SpecType      string `json:"-"`

ModelAPISpecification ... TODO: Document.

type ModelDiscovery

type ModelDiscovery struct {
	Name             string               `json:"name" validate:"required"`
	Description      string               `json:"description" validate:"required"`
	DiscoveryVersion string               `json:"discoveryVersion" validate:"required"`
	TokenAcquisition string               `json:"tokenAcquisition" validate:"required"`
	DiscoveryItems   []ModelDiscoveryItem `json:"discoveryItems" validate:"required,dive"`
	CustomTests      []CustomTest         `json:"customTests" validate:"-"`

ModelDiscovery - Holds fields describing model, and array of discovery items. For detailed documentation see ./doc/ file.

type ModelDiscoveryItem

type ModelDiscoveryItem struct {
	APISpecification       ModelAPISpecification `json:"apiSpecification,omitempty" validate:"required"`
	OpenidConfigurationURI string                `json:"openidConfigurationUri,omitempty" validate:"required,url"`
	ResourceBaseURI        string                `json:"resourceBaseUri,omitempty" validate:"required,url"`
	ResourceIds            ResourceIds           `json:"resourceIds,omitempty" validate:"-"`
	Endpoints              []ModelEndpoint       `json:"endpoints,omitempty" validate:"required,gt=0,dive"`

ModelDiscoveryItem - Each discovery item contains information related to a particular specification version.

type ModelEndpoint

type ModelEndpoint struct {
	Method                string                `json:"method" validate:"required"`
	Path                  string                `json:"path" validate:"required,uri"`
	ConditionalProperties []ConditionalProperty `json:"conditionalProperties,omitempty" validate:"dive"`

ModelEndpoint - Endpoint and methods that have been implemented by implementer.

func GetDiscoveryItemConditionalProperties added in v1.2.0

func GetDiscoveryItemConditionalProperties(item ModelDiscoveryItem) []ModelEndpoint

type NullTLSValidator added in v1.1.17

type NullTLSValidator struct{}

func NewNullTLSValidator added in v1.1.17

func NewNullTLSValidator() NullTLSValidator

func (NullTLSValidator) ValidateTLSVersion added in v1.1.17

func (v NullTLSValidator) ValidateTLSVersion(uri string) (TLSValidationResult, error)

type ResourceIds

type ResourceIds map[string]string

ResourceIds section allows the replacement of endpoint resourceid values with real data parameters like accountid

type SpecificationTestCases

type SpecificationTestCases struct {
	Specification ModelAPISpecification `json:"apiSpecification"`
	TestCases     []model.TestCase      `json:"testCases"`

SpecificationTestCases - test cases generated for a specification

type StdTLSValidator added in v1.1.17

type StdTLSValidator struct {
	// contains filtered or unexported fields

func NewStdTLSValidator added in v1.1.17

func NewStdTLSValidator(minSupportedTLSVersion uint16) StdTLSValidator

func (StdTLSValidator) ValidateTLSVersion added in v1.1.17

func (v StdTLSValidator) ValidateTLSVersion(uri string) (TLSValidationResult, error)

type TLSValidationResult added in v1.1.17

type TLSValidationResult struct {
	Valid      bool
	TLSVersion string

type TLSValidator added in v1.1.17

type TLSValidator interface {
	ValidateTLSVersion(uri string) (TLSValidationResult, error)

type ValidationFailure

type ValidationFailure struct {
	Key   string `json:"key"`
	Error string `json:"error"`

ValidationFailure - Records validation failure key and error.

e.g. ValidationFailure{
       Key:   "DiscoveryModel.Name",
       Error: "Field 'Name' is required",

func HasMandatoryEndpoints

func HasMandatoryEndpoints(checker model.ConditionalityChecker, discoveryConfig *Model) (bool, []ValidationFailure)

HasMandatoryEndpoints - checks that all the mandatory endpoints have been defined in each discovery model, otherwise it returns ValidationFailure structs for each missing mandatory endpoint.

func HasValidEndpoints

func HasValidEndpoints(checker model.ConditionalityChecker, discoveryConfig *Model) (bool, []ValidationFailure)

HasValidEndpoints - checks that all the endpoints defined in the discovery model are either mandatory, conditional or optional. Return false and ValidationFailure structs indicating which endpoints are not valid.

func Validate

func Validate(checker model.ConditionalityChecker, discovery *Model) (bool, []ValidationFailure, error)

Validate - validates a discovery model, returns true when valid, returns false and array of ValidationFailure structs when not valid.

type ValidationFailures

type ValidationFailures []ValidationFailure

ValidationFailures represents a list of failures from a Validator engine

func NoValidationFailures

func NoValidationFailures() ValidationFailures

NoValidationFailures represents a return of no validation errors found

func (ValidationFailures) Empty

func (v ValidationFailures) Empty() bool

Empty returns if there are validation failures present

type Validator

type Validator interface {
	Validate(*Model) (ValidationFailures, error)

Validator defines a generic validation engine

func NewFuncValidator

func NewFuncValidator(checker model.ConditionalityChecker) Validator

NewFuncValidator creates a Validator engine using functional implementation


Path Synopsis

Jump to

Keyboard shortcuts

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