schema

package
v0.0.0-...-920a7e7 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

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 IsJSONValidAgainstSchema

func IsJSONValidAgainstSchema(json, schema string) error

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

func IsJSONValidAgainstSchemaGeneric

func IsJSONValidAgainstSchemaGeneric(json interface{}, schema string) error

IsJSONValidAgainstSchemaGeneric validates a piece of JSON as an interface{} 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 SchemaFile) (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 SchemaFile

type SchemaFile string
const (

	// Presentation Exchange Schemas
	PresentationDefinitionSchema              SchemaFile = "pe-presentation-definition.json"
	PresentationDefinitionEnvelopeSchema      SchemaFile = "pe-presentation-definition-envelope.json"
	PresentationSubmissionSchema              SchemaFile = "pe-presentation-submission.json"
	PresentationClaimFormatDesignationsSchema SchemaFile = "pe-definition-claim-format-designations.json"
	SubmissionClaimFormatDesignationsSchema   SchemaFile = "pe-submission-claim-format-designations.json"
	SubmissionRequirementSchema               SchemaFile = "pe-submission-requirement.json"
	SubmissionRequirementsSchema              SchemaFile = "pe-submission-requirements.json"

	PresentationClaimFormatDesignationFormatDefinition SchemaFile = "pe-submission-claim-format-designations.json"

	// Credential Manifest Schemas
	CredentialManifestSchema    SchemaFile = "cm-credential-manifest.json"
	CredentialApplicationSchema SchemaFile = "cm-credential-application.json"
	CredentialResponseSchema    SchemaFile = "cm-credential-response.json"
	OutputDescriptorsSchema     SchemaFile = "cm-output-descriptors.json"

	// Wallet Rendering Schemas
	DisplayMappingObjectSchema        SchemaFile = "wr-display-mapping-object.json"
	EntityStylesSchema                SchemaFile = "wr-entity-styles.json"
	LabeledDisplayMappingObjectSchema SchemaFile = "wr-labeled-display-mapping-object.json"

	// VC JSON Schema Schemas
	VerifiableCredentialJSONSchemaSchema SchemaFile = "vc-json-schema.json"
)

func (SchemaFile) String

func (s SchemaFile) String() string

Jump to

Keyboard shortcuts

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