Expand description
Checking one JSON value against one Schema.
The walk is ordinary; the parts worth reading are the three places where
the specification says to be permissive and it would be easy to be
strict instead. An object property no schema declares is kept. A $type
outside an open union’s refs is kept. A knownValues list is not a
constraint at all. Each of those is a record written by a client that
knows a newer version of a lexicon than this server does, and refusing any
of them turns a schema addition into an outage.
Errors carry a path — artifacts[2], object.a — because the whole
value of validating on write is that the client is told which field is
wrong while it still has the field in hand.
Structs§
- Invalid
Record - Why a record does not satisfy its lexicon.
Constants§
- MAX_
SCHEMA_ DEPTH - How deep a schema may nest before the walk gives up.
- ROOT 🔒
- The root of an error path, for a failure about the record as a whole.
Functions§
- check 🔒
- Checks a record body against a record definition’s schema.
- check_
blob 🔒 - Checks a
blobvalue. - check_
bytes 🔒 - Checks a
bytesvalue:{"$bytes": "<base64>"}. - check_
cid_ 🔒link - Checks a
cid-linkvalue:{"$link": "<cid>"}. - check_
integer 🔒 - Checks an integer and its bounds.
- check_
object 🔒 - Checks an object: required, nullable, declared properties, and the rest.
- check_
string 🔒 - Checks a string, its lengths, its enumeration and its format.
- check_
union 🔒 - Checks a union: an object whose
$typechooses the schema. - check_
unknown 🔒 - Checks an
unknownvalue. - check_
value 🔒 - The recursive step.
- child 🔒
- Extends an error path with a property name.
- decoded_
length 🔒 - How many bytes a base64 string of this many characters decodes to.
- index 🔒
- Extends an error path with an array index.
- kind_of 🔒
- Names the JSON kind of a value, for an error message.
- mime_
matches 🔒 - Whether a MIME type matches one
acceptpattern. - qualify 🔒
- Rewrites a ref into the
document#defform a$typewould be written in.