Index

Annotation

MMO.schemas · 1 symbol · generated 5 Oct 2026

class

Annotation

Annotation.js:22

The result of validating one value against a schema: whether it passed, and why not.

class MMO.schemas.Annotation
Namespace
MMO.schemas
An annotation mirrors the shape of the value, so a container carries one child annotation per item (`MMO.schemas.ArrayAnnotation`, `MMO.schemas.ObjectAnnotation`) and `valid` is only true when the whole tree is.

Index

valid readonly accessor
constructor(value, path)
addError(type, vars, schemaPath)Record a failure, rendering its message from the catalogue.
getErrors()
pushErrors(anno)Adopt another annotation's errors.
merge(anno, withErrors)Fold a sub validation's outcome into this one.
makeInvalid(schemaPath)Make sub annotation invalid
toJSON()Serialise in the standard JSON-Schema "basic" output format.

Properties1

Methods7

constructor(value, path)

Annotation.js:23
constructor(value, path = '')
value
path = ''

addError(type, vars, schemaPath)

Annotation.js:45

Record a failure, rendering its message from the catalogue.

addError(type, vars, schemaPath = '')
typestringthe message key MMO.schemas.MESSAGES
varsObjectinjected into the message; value and # are filled in
schemaPath = ''stringthe keyword's location in the schema
returnsthis

getErrors()

Annotation.js:56
getErrors()
returnsArray<string>the messages of THIS annotation, without the children's

merge(anno, withErrors)

Annotation.js:80

Fold a sub validation's outcome into this one.

merge(anno, withErrors = true)
annoMMO.schemas.Annotation
withErrors = truebooleanfalse to keep only the "was evaluated" flag, which is what anyOf/oneOf need: a branch that failed still marks its properties as seen

makeInvalid(schemaPath)

Annotation.js:90

Make sub annotation invalid

makeInvalid(schemaPath = '')
schemaPath = ''string[internal]
returnsnone

toJSON()

Annotation.js:104

Serialise in the standard JSON-Schema "basic" output format.

toJSON()
returnsvalid: boolean, errors: Array=}