Documentation
¶
Index ¶
- func GetAllLocalSchemas() (map[string]string, error)
- func IsJSONValidAgainstSchema(json, schema string) error
- func IsJSONValidAgainstSchemaGeneric(json interface{}, schema string) error
- func IsValidJSON(maybeJSON string) bool
- func IsValidJSONSchema(maybeSchema string) error
- func LoadSchema(schemaFile SchemaFile) (string, error)
- type CachingLoader
- type SchemaFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllLocalSchemas ¶
GetAllLocalSchemas returns all locally cached schemas to be added to a CachingLoader
func IsJSONValidAgainstSchema ¶
IsJSONValidAgainstSchema validates a piece of JSON against a schema, returning an error if it is not valid
func IsJSONValidAgainstSchemaGeneric ¶
IsJSONValidAgainstSchemaGeneric validates a piece of JSON as an interface{} against a schema, returning an error if it is not valid
func IsValidJSON ¶
IsValidJSON checks if a string is valid json https://stackoverflow.com/a/36922225
func IsValidJSONSchema ¶
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