Skip to content

Commit b549d02

Browse files
authored
doc: document variables referencing schemas in code (#174)
1 parent 2b08cb6 commit b549d02

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/compile.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ const generateMeta = (root, $schema, enforce, requireSchema) => {
7575
}
7676
}
7777

78+
/*
79+
Variables referencing schemas:
80+
1. `root` -- top-level schema, entry point
81+
2. `schema` -- portion of the schema currently being compiled to a separate function,
82+
i.e. top-level or referenced ($ref/etc)
83+
3. `node` (defined in visit()) -- schema object being visited by visit()
84+
4. `schemas` aka `opts.schemas` -- a Map() of sibling schemas that could be referenced by
85+
their $id (and optionally subreferenced via json pointer path)
86+
*/
87+
7888
const compileSchema = (schema, root, opts, scope, basePathRoot = '') => {
7989
const {
8090
mode = 'default',

0 commit comments

Comments
 (0)