Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Add JSON Schema validations #61

Merged
merged 2 commits into from
Jun 25, 2024
Merged

Conversation

KendallWeihe
Copy link
Contributor

Leverage Rust build script to automatically generate the JSON Schemas at https://github.com/TBD54566975/tbdex/blob/main/hosted/json-schemas into source code. This way it's all included in the single binary.

A few places with // 🚧 TODO commenting out until did:dht support

@nitro-neal
Copy link
Contributor

so this is pretty cool.

I guess an alternative would be just to copy paste the schemas in a folder, and then have a static function lazy load them programmatically ?

@KendallWeihe
Copy link
Contributor Author

so this is pretty cool.

I guess an alternative would be just to copy paste the schemas in a folder, and then have a static function lazy load them programmatically ?

I think we have room for improvement, but a killer feature here is embedded this into the binary itself. Improves portability and resiliency across environments.

@KendallWeihe KendallWeihe merged commit 90f446e into main Jun 25, 2024
6 checks passed
@KendallWeihe KendallWeihe deleted the kendall/json-schema-validations branch June 25, 2024 20:58
Copy link
Contributor

@decentralgabe decentralgabe left a comment

Choose a reason for hiding this comment

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

which version(s) of JSON Schema does this work with?

@KendallWeihe
Copy link
Contributor Author

which version(s) of JSON Schema does this work with?

We're using the jsonschema crate.

From the jsonschema crates.io page:

Supported drafts:

- Draft 7 (except optional idn-hostname.json test case)
- Draft 6
- Draft 4 (except optional bignum.json test case)

Partially supported drafts (some keywords are not implemented):

- Draft 2019-09 (requires the draft201909 feature enabled)
- Draft 2020-12 (requires the draft202012 feature enabled)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants