discovery

package
v0.1.0-pre-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasMandatoryEndpoints

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

HasMandatoryEndpoints - checks that all the mandatory endpoints have been defined in each discovery model, otherwise it returns a error with all the missing mandatory endpoints separated by a newline.

func HasValidEndpoints

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

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

func SupportedVersions

func SupportedVersions() map[string]bool

SupportedVersions - returns map of supported versions

func Validate

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

Validate - validates a discovery model, returns true when valid, returns false and validation failure messages when not valid.

func Version

func Version() string

Version returns the current version of the Discovery Model parser

Types

type Model

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

Model ... TODO: Document.

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"`
}

ModelAPISpecification ... TODO: Document.

type ModelConditionalProperties

type ModelConditionalProperties struct {
	Schema   string `json:"schema" validate:"required"`
	Property string `json:"property" validate:"required"`
	Path     string `json:"path" validate:"required"`
}

ModelConditionalProperties ... TODO: Document.

type ModelDiscovery

type ModelDiscovery struct {
	Version        string               `json:"version" validate:"required"`
	DiscoveryItems []ModelDiscoveryItem `json:"discoveryItems" validate:"required,gt=0,dive"`
}

ModelDiscovery ... TODO: Document.

type ModelDiscoveryItem

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

ModelDiscoveryItem ... TODO: Document.

type ModelEndpoint

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

ModelEndpoint ... TODO: Document.

Jump to

Keyboard shortcuts

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