schema

package
v0.0.4-alpha Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 13 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllLocalSchemas

func GetAllLocalSchemas() (map[string]string, error)

GetAllLocalSchemas returns all locally cached schemas to be added to a CachingLoader

func IsAnyValidAgainstJSONSchema

func IsAnyValidAgainstJSONSchema(data any, schema string) error

IsAnyValidAgainstJSONSchema validates a piece of JSON against a schema, returning an error if it is not valid

func IsValidAgainstJSONSchema

func IsValidAgainstJSONSchema(data, schema string) error

IsValidAgainstJSONSchema validates a piece of JSON against a schema, returning an error if it is not valid

func IsValidJSON

func IsValidJSON(maybeJSON string) bool

IsValidJSON checks if a string is valid json https://stackoverflow.com/a/36922225

func IsValidJSONSchema

func IsValidJSONSchema(maybeSchema string) error

IsValidJSONSchema returns an error if the schema is not a valid JSON Schema, nil otherwise

func LoadSchema

func LoadSchema(schemaFile File) (string, error)

LoadSchema loads a schema from the embedded filesystem and returns its contents as a json string

Types

type CachingLoader

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

CachingLoader is a struct that holds local schemas

func NewCachingLoader

func NewCachingLoader(schemas map[string]string) (*CachingLoader, error)

NewCachingLoader returns a new CachingLoader that enables the ability to cache http and https schemas

func (*CachingLoader) EnableHTTPCache

func (cl *CachingLoader) EnableHTTPCache()

EnableHTTPCache enables caching of http and https schemas

func (*CachingLoader) GetCachedSchemas

func (cl *CachingLoader) GetCachedSchemas() ([]string, error)

GetCachedSchemas returns an array of cached schema URIs

type File

type File string
const (
	PresentationDefinitionSchema              File = "pe-presentation-definition.json"
	PresentationDefinitionEnvelopeSchema      File = "pe-presentation-definition-envelope.json"
	PresentationSubmissionSchema              File = "pe-presentation-submission.json"
	PresentationClaimFormatDesignationsSchema File = "pe-definition-claim-format-designations.json"
	SubmissionClaimFormatDesignationsSchema   File = "pe-submission-claim-format-designations.json"
	SubmissionRequirementSchema               File = "pe-submission-requirement.json"
	SubmissionRequirementsSchema              File = "pe-submission-requirements.json"

	CredentialManifestSchema    File = "cm-credential-manifest.json"
	CredentialApplicationSchema File = "cm-credential-application.json"
	CredentialResponseSchema    File = "cm-credential-response.json"
	OutputDescriptorsSchema     File = "cm-output-descriptors.json"

	DisplayMappingObjectSchema        File = "wr-display-mapping-object.json"
	EntityStylesSchema                File = "wr-entity-styles.json"
	LabeledDisplayMappingObjectSchema File = "wr-labeled-display-mapping-object.json"

	VerifiableCredentialJSONSchemaSchema File = "vc-json-schema.json"
)

func (File) String

func (s File) String() string

Jump to

Keyboard shortcuts

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