schema

package
v0.8.3-alpha.1.pre.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const SchemasPath string = "schemas"

Variables

This section is empty.

Functions

func ContextSetRoot

func ContextSetRoot(err *jsonschema.ValidationError, head string) *jsonschema.ValidationError

func GetKeysInOrder

func GetKeysInOrder(schemaRef string) ([]string, error)

func NewAddressNotVerifiedError

func NewAddressNotVerifiedError() error

func NewDuplicateCredentialsError

func NewDuplicateCredentialsError() error

func NewErrorValidationLookupInvalid

func NewErrorValidationLookupInvalid() error

func NewInvalidCredentialsError

func NewInvalidCredentialsError() error

func NewInvalidFormatError

func NewInvalidFormatError(instancePtr, format, value string) error

func NewLookupAlreadyUsed

func NewLookupAlreadyUsed() error

func NewMinLengthError

func NewMinLengthError(instancePtr string, expected, actual int) error

func NewMissingIdentifierError

func NewMissingIdentifierError() error

func NewNoLoginStrategyResponsible

func NewNoLoginStrategyResponsible() error

func NewNoLookupDefined

func NewNoLookupDefined() error

func NewNoRecoveryStrategyResponsible

func NewNoRecoveryStrategyResponsible() error

func NewNoRegistrationStrategyResponsible

func NewNoRegistrationStrategyResponsible() error

func NewNoSettingsStrategyResponsible

func NewNoSettingsStrategyResponsible() error

func NewNoTOTPDeviceRegistered

func NewNoTOTPDeviceRegistered() error

func NewNoVerificationStrategyResponsible

func NewNoVerificationStrategyResponsible() error

func NewNoWebAuthnRegistered

func NewNoWebAuthnRegistered() error

func NewPasswordPolicyViolationError

func NewPasswordPolicyViolationError(instancePtr string, reason string) error

func NewRequiredError

func NewRequiredError(missingPtr, missingFieldName string) error

func NewTOTPVerifierWrongError

func NewTOTPVerifierWrongError(instancePtr string) error

func NewWebAuthnVerifierWrongError

func NewWebAuthnVerifierWrongError(instancePtr string) error

func ReadSchema

func ReadSchema(schema *Schema) (src io.ReadCloser, err error)

func WithExtensionRunner

func WithExtensionRunner(e *ExtensionRunner) func(*validatorOptions)

Types

type Extension

type Extension interface {
	Run(ctx jsonschema.ValidationContext, config ExtensionConfig, value interface{}) error
	Finish() error
}

type ExtensionConfig

type ExtensionConfig struct {
	Credentials struct {
		Password struct {
			Identifier bool `json:"identifier"`
		} `json:"password"`
		TOTP struct {
			AccountName bool `json:"account_name"`
		} `json:"totp"`
	} `json:"credentials"`
	Verification struct {
		Via string `json:"via"`
	} `json:"verification"`
	Recovery struct {
		Via string `json:"via"`
	} `json:"recovery"`
	Mappings struct {
		Identity struct {
			Traits []struct {
				Path string `json:"path"`
			} `json:"traits"`
		} `json:"identity"`
	} `json:"mappings"`
}

type ExtensionRunner

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

func NewExtensionRunner

func NewExtensionRunner(runners ...Extension) (*ExtensionRunner, error)

func (*ExtensionRunner) AddRunner

func (r *ExtensionRunner) AddRunner(run Extension) *ExtensionRunner

func (*ExtensionRunner) Extension

func (r *ExtensionRunner) Extension() jsonschema.Extension

func (*ExtensionRunner) Finish

func (r *ExtensionRunner) Finish() error

func (*ExtensionRunner) Register

func (r *ExtensionRunner) Register(compiler *jsonschema.Compiler) *ExtensionRunner

type Handler

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

func NewHandler

func NewHandler(r handlerDependencies) *Handler

func (*Handler) RegisterAdminRoutes

func (h *Handler) RegisterAdminRoutes(admin *x.RouterAdmin)

func (*Handler) RegisterPublicRoutes

func (h *Handler) RegisterPublicRoutes(public *x.RouterPublic)

type HandlerProvider

type HandlerProvider interface {
	SchemaHandler() *Handler
}

type IdentitySchemas

type IdentitySchemas []identitySchema

Raw identity Schema list

swagger:model identitySchemas

type IdentityTraitsProvider

type IdentityTraitsProvider interface {
	IdentityTraitsSchemas(ctx context.Context) Schemas
}

type Schema

type Schema struct {
	ID     string   `json:"id"`
	URL    *url.URL `json:"-"`
	RawURL string   `json:"url"`
}

func (*Schema) SchemaURL

func (s *Schema) SchemaURL(host *url.URL) *url.URL

type Schemas

type Schemas []Schema

func (Schemas) GetByID

func (s Schemas) GetByID(id string) (*Schema, error)

func (Schemas) List

func (s Schemas) List(page, perPage int) Schemas

func (Schemas) Total

func (s Schemas) Total() int

type ValidationError

type ValidationError struct {
	*jsonschema.ValidationError
	Messages text.Messages
}

type ValidationErrorContextDuplicateCredentialsError

type ValidationErrorContextDuplicateCredentialsError struct{}

func (*ValidationErrorContextDuplicateCredentialsError) AddContext

func (*ValidationErrorContextDuplicateCredentialsError) FinishInstanceContext

func (r *ValidationErrorContextDuplicateCredentialsError) FinishInstanceContext()

type ValidationErrorContextInvalidCredentialsError

type ValidationErrorContextInvalidCredentialsError struct{}

func (*ValidationErrorContextInvalidCredentialsError) AddContext

func (*ValidationErrorContextInvalidCredentialsError) FinishInstanceContext

func (r *ValidationErrorContextInvalidCredentialsError) FinishInstanceContext()

type ValidationErrorContextPasswordPolicyViolation

type ValidationErrorContextPasswordPolicyViolation struct {
	Reason string
}

func (*ValidationErrorContextPasswordPolicyViolation) AddContext

func (*ValidationErrorContextPasswordPolicyViolation) FinishInstanceContext

func (r *ValidationErrorContextPasswordPolicyViolation) FinishInstanceContext()

type ValidationProvider

type ValidationProvider interface {
	SchemaValidator() *Validator
}

type Validator

type Validator struct {
	sync.RWMutex
}

func NewValidator

func NewValidator() *Validator

func (*Validator) Validate

func (v *Validator) Validate(
	href string,
	document json.RawMessage,
	opts ...func(*validatorOptions),
) error

Jump to

Keyboard shortcuts

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