Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update vc json schema #266

Merged
merged 3 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions schema/jsonschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ package schema

import (
"embed"
"net/http"
"time"

"github.com/TBD54566975/ssi-sdk/util"
"github.com/goccy/go-json"
"github.com/pkg/errors"
"github.com/santhosh-tekuri/jsonschema/v5"

// imported for http loaders https://github.com/santhosh-tekuri/jsonschema/issues/92#issuecomment-1309794888
"github.com/santhosh-tekuri/jsonschema/v5/httploader"
)

Expand All @@ -20,8 +24,9 @@ var (
)

func init() {
jsonschema.Loaders["http"] = httploader.Load
jsonschema.Loaders["https"] = httploader.Load
httploader.Client = &http.Client{
Timeout: time.Second * 10,
}
Comment on lines +27 to +29
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow why this changes? Mind elaborating?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default client does not have a timeout configured santhosh-tekuri/jsonschema#92 (comment)

}

// IsValidJSONSchema returns an error if the schema is not a valid JSON Schema, nil otherwise
Expand Down
46 changes: 3 additions & 43 deletions schema/known_schemas/vc-json-schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$id": "credential-schema-2.0",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "JSON Schema for W3C Verifiable Credential JSON Schema",
"type": "object",
"properties": {
Expand All @@ -24,47 +24,7 @@
"type": "string"
},
"schema": {
"type": "object",
"properties": {
"$id": {
"type": "string"
},
"$schema": {
"type": "string"
},
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"properties": {
"type": "object"
},
"required": {
"type": "array",
"items": [
{
"type": "string"
}
]
},
"additionalProperties": {
"type": "boolean"
}
},
"required": [
"$id",
"$schema",
"description",
"type",
"properties",
"required",
"additionalProperties"
]
"$ref": "https://json-schema.org/draft/2020-12/schema"
},
"proof": {
"type": "object"
Expand All @@ -79,4 +39,4 @@
"authored",
"schema"
]
}
}