MCPcopy
hub / github.com/ajv-validator/ajv / SchemaEnv

Class SchemaEnv

lib/compile/index.ts:74–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74export class SchemaEnv implements SchemaEnvArgs {
75 readonly schema: AnySchema
76 readonly schemaId?: "$id" | "id"
77 readonly root: SchemaEnv
78 baseId: string // TODO possibly, it should be readonly
79 schemaPath?: string
80 localRefs?: LocalRefs
81 readonly meta?: boolean
82 readonly $async?: boolean // true if the current schema is asynchronous.
83 readonly refs: SchemaRefs = {}
84 readonly dynamicAnchors: {[Ref in string]?: true} = {}
85 validate?: AnyValidateFunction
86 validateName?: ValueScopeName
87 serialize?: (data: unknown) => string
88 serializeName?: ValueScopeName
89 parse?: (data: string) => unknown
90 parseName?: ValueScopeName
91
92 constructor(env: SchemaEnvArgs) {
93 let schema: AnySchemaObject | undefined
94 if (typeof env.schema == "object") schema = env.schema
95 this.schema = env.schema
96 this.schemaId = env.schemaId
97 this.root = env.root || this
98 this.baseId = env.baseId ?? normalizeId(schema?.[env.schemaId || "$id"])
99 this.schemaPath = env.schemaPath
100 this.localRefs = env.localRefs
101 this.meta = env.meta
102 this.$async = schema?.$async
103 this.refs = {}
104 }
105}
106
107// let codeSize = 0
108// let nodeCount = 0

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…