JSONSchema Support

Allow the specification of a JSONSchema document (either inline, via file, or via url) that will govern the shape of the data in a table.

This should be a separate operation from create table. It can be applied to empty tables or tables with data already in them.

Add an “enforce” flag to specify whether HarperDB should “reject” or “clean” non-conforming data when applying the schema, inserting, or updating.

“Reject” will fail a transaction if the schema doesn’t fit the existing data, or if insert or update data doesn’t fit the schema.

“Clean” will strip attributes that are not present.

operation: “apply_jsonschema”,
schema: “dev”,
table: “dog”,
inline: { … },
file: [filepath],
url: [url]
enforce: [“reject” || “clean”]

For developers who use jsonschema to define client-side models and forms, applying the exact same document to the database feels like an easy way to ensure

Under consideration Suggested by: Jaxon Upvoted: 12 Jul, '21 Comments: 0

Add a comment

0 / 1,000

* Your name will be publicly visible

* Your email will be visible only to moderators