names.ts 1.1 KB

123456789101112131415161718192021222324252627
  1. import {Name} from "./codegen"
  2. const names = {
  3. // validation function arguments
  4. data: new Name("data"), // data passed to validation function
  5. // args passed from referencing schema
  6. valCxt: new Name("valCxt"), // validation/data context - should not be used directly, it is destructured to the names below
  7. instancePath: new Name("instancePath"),
  8. parentData: new Name("parentData"),
  9. parentDataProperty: new Name("parentDataProperty"),
  10. rootData: new Name("rootData"), // root data - same as the data passed to the first/top validation function
  11. dynamicAnchors: new Name("dynamicAnchors"), // used to support recursiveRef and dynamicRef
  12. // function scoped variables
  13. vErrors: new Name("vErrors"), // null or array of validation errors
  14. errors: new Name("errors"), // counter of validation errors
  15. this: new Name("this"),
  16. // "globals"
  17. self: new Name("self"),
  18. scope: new Name("scope"),
  19. // JTD serialize/parse name for JSON string and position
  20. json: new Name("json"),
  21. jsonPos: new Name("jsonPos"),
  22. jsonLen: new Name("jsonLen"),
  23. jsonPart: new Name("jsonPart"),
  24. }
  25. export default names