Documentation ¶
Index ¶
- func GetAllLocalSchemas() (map[string]string, error)
- func IsAnyValidAgainstJSONSchema(data any, schema string) error
- func IsValidAgainstJSONSchema(data, schema string) error
- func IsValidJSON(maybeJSON string) bool
- func IsValidJSONSchema(maybeSchema string) error
- func LoadSchema(schemaFile File) (string, error)
- type CachingLoader
- type File
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 IsAnyValidAgainstJSONSchema ¶
IsAnyValidAgainstJSONSchema validates a piece of JSON against a schema, returning an error if it is not valid
func IsValidAgainstJSONSchema ¶
IsValidAgainstJSONSchema validates a piece of JSON 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 ¶
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" )