json-schema-library 11.6.0 → 11.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"remotes.cjs","names":["draft04Meta","draft06Meta","draft07Meta","draft2019Meta","draft2019MetaApplicator","draft2019MetaContent","draft2019MetaCore","draft2019MetaFormat","draft2019MetaMetaData","draft2019MetaValidation","draft2020Meta","draft2020MetaApplicator","draft2020MetaContent","draft2020MetaCore","draft2020MetaFormatAnnotation","draft2020MetaFormatAssertion","draft2020MetaMetaData","draft2020MetaUnevaluated","draft2020MetaValidation"],"sources":["../remotes/draft04.json","../remotes/draft06.json","../remotes/draft07.json","../remotes/draft2019-09.json","../remotes/draft2019-09_meta_applicator.json","../remotes/draft2019-09_meta_content.json","../remotes/draft2019-09_meta_core.json","../remotes/draft2019-09_meta_format.json","../remotes/draft2019-09_meta_meta-data.json","../remotes/draft2019-09_meta_validation.json","../remotes/draft2020-12.json","../remotes/draft2020-12_meta_applicator.json","../remotes/draft2020-12_meta_content.json","../remotes/draft2020-12_meta_core.json","../remotes/draft2020-12_meta_format_annotation.json","../remotes/draft2020-12_meta_format_assertion.json","../remotes/draft2020-12_meta_meta_data.json","../remotes/draft2020-12_meta_unevaluated.json","../remotes/draft2020-12_meta_validation.json","../remotes/index.ts"],"sourcesContent":["","","","","","","","","","","","","","","","","","","","import { JsonSchema } from \"../src/types\";\nimport draft04Meta from \"./draft04.json\";\nimport draft06Meta from \"./draft06.json\";\nimport draft07Meta from \"./draft07.json\";\nimport draft2019Meta from \"./draft2019-09.json\";\nimport draft2019MetaApplicator from \"./draft2019-09_meta_applicator.json\";\nimport draft2019MetaContent from \"./draft2019-09_meta_content.json\";\nimport draft2019MetaCore from \"./draft2019-09_meta_core.json\";\nimport draft2019MetaFormat from \"./draft2019-09_meta_format.json\";\nimport draft2019MetaMetaData from \"./draft2019-09_meta_meta-data.json\";\nimport draft2019MetaValidation from \"./draft2019-09_meta_validation.json\";\nimport draft2020Meta from \"./draft2020-12.json\";\nimport draft2020MetaApplicator from \"./draft2020-12_meta_applicator.json\";\nimport draft2020MetaContent from \"./draft2020-12_meta_content.json\";\nimport draft2020MetaCore from \"./draft2020-12_meta_core.json\";\nimport draft2020MetaFormatAnnotation from \"./draft2020-12_meta_format_annotation.json\";\nimport draft2020MetaFormatAssertion from \"./draft2020-12_meta_format_assertion.json\";\nimport draft2020MetaMetaData from \"./draft2020-12_meta_meta_data.json\";\nimport draft2020MetaUnevaluated from \"./draft2020-12_meta_unevaluated.json\";\nimport draft2020MetaValidation from \"./draft2020-12_meta_validation.json\";\n\n/** JSON Schema meta-schemata */\nconst remotes: JsonSchema[] = [\n draft04Meta,\n draft06Meta,\n draft07Meta,\n draft2019Meta,\n draft2019MetaApplicator,\n draft2019MetaContent,\n draft2019MetaCore,\n draft2019MetaFormat,\n draft2019MetaMetaData,\n draft2019MetaValidation,\n draft2020Meta,\n draft2020MetaApplicator,\n draft2020MetaContent,\n draft2020MetaCore,\n draft2020MetaFormatAnnotation,\n draft2020MetaFormatAssertion,\n draft2020MetaMetaData,\n draft2020MetaUnevaluated,\n draft2020MetaValidation\n] as JsonSchema[];\n\nexport { remotes };\n"],"mappings":"mEmBsBA,MAAM,EAAwB,yolBAoB7B"}
1
+ {"version":3,"file":"remotes.cjs","names":["draft04Meta","draft06Meta","draft07Meta","draft2019Meta","draft2019MetaApplicator","draft2019MetaContent","draft2019MetaCore","draft2019MetaFormat","draft2019MetaMetaData","draft2019MetaValidation","draft2020Meta","draft2020MetaApplicator","draft2020MetaContent","draft2020MetaCore","draft2020MetaFormatAnnotation","draft2020MetaFormatAssertion","draft2020MetaMetaData","draft2020MetaUnevaluated","draft2020MetaValidation"],"sources":["../remotes/draft04.json","../remotes/draft06.json","../remotes/draft07.json","../remotes/draft2019-09.json","../remotes/draft2019-09_meta_applicator.json","../remotes/draft2019-09_meta_content.json","../remotes/draft2019-09_meta_core.json","../remotes/draft2019-09_meta_format.json","../remotes/draft2019-09_meta_meta-data.json","../remotes/draft2019-09_meta_validation.json","../remotes/draft2020-12.json","../remotes/draft2020-12_meta_applicator.json","../remotes/draft2020-12_meta_content.json","../remotes/draft2020-12_meta_core.json","../remotes/draft2020-12_meta_format_annotation.json","../remotes/draft2020-12_meta_format_assertion.json","../remotes/draft2020-12_meta_meta_data.json","../remotes/draft2020-12_meta_unevaluated.json","../remotes/draft2020-12_meta_validation.json","../remotes/index.ts"],"sourcesContent":["","","","","","","","","","","","","","","","","","","","import { JsonSchema } from \"../src/types\";\nimport draft04Meta from \"./draft04.json\";\nimport draft06Meta from \"./draft06.json\";\nimport draft07Meta from \"./draft07.json\";\nimport draft2019Meta from \"./draft2019-09.json\";\nimport draft2019MetaApplicator from \"./draft2019-09_meta_applicator.json\";\nimport draft2019MetaContent from \"./draft2019-09_meta_content.json\";\nimport draft2019MetaCore from \"./draft2019-09_meta_core.json\";\nimport draft2019MetaFormat from \"./draft2019-09_meta_format.json\";\nimport draft2019MetaMetaData from \"./draft2019-09_meta_meta-data.json\";\nimport draft2019MetaValidation from \"./draft2019-09_meta_validation.json\";\nimport draft2020Meta from \"./draft2020-12.json\";\nimport draft2020MetaApplicator from \"./draft2020-12_meta_applicator.json\";\nimport draft2020MetaContent from \"./draft2020-12_meta_content.json\";\nimport draft2020MetaCore from \"./draft2020-12_meta_core.json\";\nimport draft2020MetaFormatAnnotation from \"./draft2020-12_meta_format_annotation.json\";\nimport draft2020MetaFormatAssertion from \"./draft2020-12_meta_format_assertion.json\";\nimport draft2020MetaMetaData from \"./draft2020-12_meta_meta_data.json\";\nimport draft2020MetaUnevaluated from \"./draft2020-12_meta_unevaluated.json\";\nimport draft2020MetaValidation from \"./draft2020-12_meta_validation.json\";\n\n/** JSON Schema meta-schemata */\nconst remotes: JsonSchema[] = [\n draft04Meta,\n draft06Meta,\n draft07Meta,\n draft2019Meta,\n draft2019MetaApplicator,\n draft2019MetaContent,\n draft2019MetaCore,\n draft2019MetaFormat,\n draft2019MetaMetaData,\n draft2019MetaValidation,\n draft2020Meta,\n draft2020MetaApplicator,\n draft2020MetaContent,\n draft2020MetaCore,\n draft2020MetaFormatAnnotation,\n draft2020MetaFormatAssertion,\n draft2020MetaMetaData,\n draft2020MetaUnevaluated,\n draft2020MetaValidation\n] as JsonSchema[];\n\nexport { remotes };\n"],"mappings":"mEmBsBA,MAAM,EAAwB,CAC1BA,2qEAAAA,EACAC,ytEAAAA,EACAC,q7EAAAA,EACAC,uwCAAAA,EACAC,ohCAAAA,EACAC,qTAAAA,EACAC,uvBAAAA,EACAC,uOAAAA,EACAC,saAAAA,EACAC,w5CAAAA,EACAC,urDAAAA,EACAC,w8BAAAA,EACAC,yTAAAA,EACAC,q3BAAAA,EACAC,2QAAAA,EACAC,yQAAAA,EACAC,waAAAA,EACAC,0TAAAA,EACAC,05CAAAA,CACJ"}
@@ -1,5 +1,4 @@
1
- import { c as JsonSchema } from "./types-BDjKcTVR.cjs";
2
-
1
+ import { c as JsonSchema } from "./types-0Orw2kYf.cjs";
3
2
  //#region remotes/index.d.ts
4
3
  /** JSON Schema meta-schemata */
5
4
  declare const remotes: JsonSchema[];
@@ -1,5 +1,4 @@
1
- import { c as JsonSchema } from "./types-CqkCJmt8.mjs";
2
-
1
+ import { c as JsonSchema } from "./types-0Orw2kYf.mjs";
3
2
  //#region remotes/index.d.ts
4
3
  /** JSON Schema meta-schemata */
5
4
  declare const remotes: JsonSchema[];
@@ -1 +1 @@
1
- {"version":3,"file":"remotes.mjs","names":["draft04Meta","draft06Meta","draft07Meta","draft2019Meta","draft2019MetaApplicator","draft2019MetaContent","draft2019MetaCore","draft2019MetaFormat","draft2019MetaMetaData","draft2019MetaValidation","draft2020Meta","draft2020MetaApplicator","draft2020MetaContent","draft2020MetaCore","draft2020MetaFormatAnnotation","draft2020MetaFormatAssertion","draft2020MetaMetaData","draft2020MetaUnevaluated","draft2020MetaValidation"],"sources":["../remotes/draft04.json","../remotes/draft06.json","../remotes/draft07.json","../remotes/draft2019-09.json","../remotes/draft2019-09_meta_applicator.json","../remotes/draft2019-09_meta_content.json","../remotes/draft2019-09_meta_core.json","../remotes/draft2019-09_meta_format.json","../remotes/draft2019-09_meta_meta-data.json","../remotes/draft2019-09_meta_validation.json","../remotes/draft2020-12.json","../remotes/draft2020-12_meta_applicator.json","../remotes/draft2020-12_meta_content.json","../remotes/draft2020-12_meta_core.json","../remotes/draft2020-12_meta_format_annotation.json","../remotes/draft2020-12_meta_format_assertion.json","../remotes/draft2020-12_meta_meta_data.json","../remotes/draft2020-12_meta_unevaluated.json","../remotes/draft2020-12_meta_validation.json","../remotes/index.ts"],"sourcesContent":["","","","","","","","","","","","","","","","","","","","import { JsonSchema } from \"../src/types\";\nimport draft04Meta from \"./draft04.json\";\nimport draft06Meta from \"./draft06.json\";\nimport draft07Meta from \"./draft07.json\";\nimport draft2019Meta from \"./draft2019-09.json\";\nimport draft2019MetaApplicator from \"./draft2019-09_meta_applicator.json\";\nimport draft2019MetaContent from \"./draft2019-09_meta_content.json\";\nimport draft2019MetaCore from \"./draft2019-09_meta_core.json\";\nimport draft2019MetaFormat from \"./draft2019-09_meta_format.json\";\nimport draft2019MetaMetaData from \"./draft2019-09_meta_meta-data.json\";\nimport draft2019MetaValidation from \"./draft2019-09_meta_validation.json\";\nimport draft2020Meta from \"./draft2020-12.json\";\nimport draft2020MetaApplicator from \"./draft2020-12_meta_applicator.json\";\nimport draft2020MetaContent from \"./draft2020-12_meta_content.json\";\nimport draft2020MetaCore from \"./draft2020-12_meta_core.json\";\nimport draft2020MetaFormatAnnotation from \"./draft2020-12_meta_format_annotation.json\";\nimport draft2020MetaFormatAssertion from \"./draft2020-12_meta_format_assertion.json\";\nimport draft2020MetaMetaData from \"./draft2020-12_meta_meta_data.json\";\nimport draft2020MetaUnevaluated from \"./draft2020-12_meta_unevaluated.json\";\nimport draft2020MetaValidation from \"./draft2020-12_meta_validation.json\";\n\n/** JSON Schema meta-schemata */\nconst remotes: JsonSchema[] = [\n draft04Meta,\n draft06Meta,\n draft07Meta,\n draft2019Meta,\n draft2019MetaApplicator,\n draft2019MetaContent,\n draft2019MetaCore,\n draft2019MetaFormat,\n draft2019MetaMetaData,\n draft2019MetaValidation,\n draft2020Meta,\n draft2020MetaApplicator,\n draft2020MetaContent,\n draft2020MetaCore,\n draft2020MetaFormatAnnotation,\n draft2020MetaFormatAssertion,\n draft2020MetaMetaData,\n draft2020MetaUnevaluated,\n draft2020MetaValidation\n] as JsonSchema[];\n\nexport { remotes };\n"],"mappings":"AmBsBA,MAAM,EAAwB,yolBAoB7B"}
1
+ {"version":3,"file":"remotes.mjs","names":["draft04Meta","draft06Meta","draft07Meta","draft2019Meta","draft2019MetaApplicator","draft2019MetaContent","draft2019MetaCore","draft2019MetaFormat","draft2019MetaMetaData","draft2019MetaValidation","draft2020Meta","draft2020MetaApplicator","draft2020MetaContent","draft2020MetaCore","draft2020MetaFormatAnnotation","draft2020MetaFormatAssertion","draft2020MetaMetaData","draft2020MetaUnevaluated","draft2020MetaValidation"],"sources":["../remotes/draft04.json","../remotes/draft06.json","../remotes/draft07.json","../remotes/draft2019-09.json","../remotes/draft2019-09_meta_applicator.json","../remotes/draft2019-09_meta_content.json","../remotes/draft2019-09_meta_core.json","../remotes/draft2019-09_meta_format.json","../remotes/draft2019-09_meta_meta-data.json","../remotes/draft2019-09_meta_validation.json","../remotes/draft2020-12.json","../remotes/draft2020-12_meta_applicator.json","../remotes/draft2020-12_meta_content.json","../remotes/draft2020-12_meta_core.json","../remotes/draft2020-12_meta_format_annotation.json","../remotes/draft2020-12_meta_format_assertion.json","../remotes/draft2020-12_meta_meta_data.json","../remotes/draft2020-12_meta_unevaluated.json","../remotes/draft2020-12_meta_validation.json","../remotes/index.ts"],"sourcesContent":["","","","","","","","","","","","","","","","","","","","import { JsonSchema } from \"../src/types\";\nimport draft04Meta from \"./draft04.json\";\nimport draft06Meta from \"./draft06.json\";\nimport draft07Meta from \"./draft07.json\";\nimport draft2019Meta from \"./draft2019-09.json\";\nimport draft2019MetaApplicator from \"./draft2019-09_meta_applicator.json\";\nimport draft2019MetaContent from \"./draft2019-09_meta_content.json\";\nimport draft2019MetaCore from \"./draft2019-09_meta_core.json\";\nimport draft2019MetaFormat from \"./draft2019-09_meta_format.json\";\nimport draft2019MetaMetaData from \"./draft2019-09_meta_meta-data.json\";\nimport draft2019MetaValidation from \"./draft2019-09_meta_validation.json\";\nimport draft2020Meta from \"./draft2020-12.json\";\nimport draft2020MetaApplicator from \"./draft2020-12_meta_applicator.json\";\nimport draft2020MetaContent from \"./draft2020-12_meta_content.json\";\nimport draft2020MetaCore from \"./draft2020-12_meta_core.json\";\nimport draft2020MetaFormatAnnotation from \"./draft2020-12_meta_format_annotation.json\";\nimport draft2020MetaFormatAssertion from \"./draft2020-12_meta_format_assertion.json\";\nimport draft2020MetaMetaData from \"./draft2020-12_meta_meta_data.json\";\nimport draft2020MetaUnevaluated from \"./draft2020-12_meta_unevaluated.json\";\nimport draft2020MetaValidation from \"./draft2020-12_meta_validation.json\";\n\n/** JSON Schema meta-schemata */\nconst remotes: JsonSchema[] = [\n draft04Meta,\n draft06Meta,\n draft07Meta,\n draft2019Meta,\n draft2019MetaApplicator,\n draft2019MetaContent,\n draft2019MetaCore,\n draft2019MetaFormat,\n draft2019MetaMetaData,\n draft2019MetaValidation,\n draft2020Meta,\n draft2020MetaApplicator,\n draft2020MetaContent,\n draft2020MetaCore,\n draft2020MetaFormatAnnotation,\n draft2020MetaFormatAssertion,\n draft2020MetaMetaData,\n draft2020MetaUnevaluated,\n draft2020MetaValidation\n] as JsonSchema[];\n\nexport { remotes };\n"],"mappings":"AmBsBA,MAAM,EAAwB,CAC1BA,2qEAAAA,EACAC,ytEAAAA,EACAC,q7EAAAA,EACAC,uwCAAAA,EACAC,ohCAAAA,EACAC,qTAAAA,EACAC,uvBAAAA,EACAC,uOAAAA,EACAC,saAAAA,EACAC,w5CAAAA,EACAC,urDAAAA,EACAC,w8BAAAA,EACAC,yTAAAA,EACAC,q3BAAAA,EACAC,2QAAAA,EACAC,yQAAAA,EACAC,waAAAA,EACAC,0TAAAA,EACAC,05CAAAA,CACJ"}
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
@@ -4,10 +4,15 @@ type ValidationPath = {
4
4
  node: SchemaNode;
5
5
  }[];
6
6
  type JsonSchemaReducerParams = {
7
- /** data of current node */data: unknown; /** optional key to used to resolve by property without having data */
8
- key: string | number; /** node to reduce */
9
- node: SchemaNode; /** JSON pointer to data */
10
- pointer: string; /** passed through path for schema resolution, will be changed by reference */
7
+ /** data of current node */
8
+ data: unknown;
9
+ /** optional key to used to resolve by property without having data */
10
+ key: string | number;
11
+ /** node to reduce */
12
+ node: SchemaNode;
13
+ /** JSON pointer to data */
14
+ pointer: string;
15
+ /** passed through path for schema resolution, will be changed by reference */
11
16
  path: ValidationPath;
12
17
  };
13
18
  interface JsonSchemaReducer {
@@ -42,8 +47,10 @@ interface JsonSchemaValidator<Key extends keyof SchemaNode = keyof SchemaNode> {
42
47
  (options: JsonSchemaValidatorParams<Key>): ValidationReturnType;
43
48
  }
44
49
  type Keyword<Key extends keyof SchemaNode = keyof SchemaNode> = {
45
- id: string; /** unique keyword corresponding to JSON Schema keywords (or custom) */
46
- keyword: string; /** sort order of keyword. Lower numbers will be processed last. Default is 0 */
50
+ id: string;
51
+ /** unique keyword corresponding to JSON Schema keywords (or custom) */
52
+ keyword: string;
53
+ /** sort order of keyword. Lower numbers will be processed last. Default is 0 */
47
54
  order?: number;
48
55
  /**
49
56
  * Called once for each JSON Schema dduring compileSchema to evaluate keyword.
@@ -64,7 +71,8 @@ type Keyword<Key extends keyof SchemaNode = keyof SchemaNode> = {
64
71
  * a keyword properties has has child-properties. So when a properties[key] exists,
65
72
  * it will return the node of properties[key] or nothing at all
66
73
  */
67
- resolve?: JsonSchemaResolver; /** return true if the given node should run the validate-function on this keyword */
74
+ resolve?: JsonSchemaResolver;
75
+ /** return true if the given node should run the validate-function on this keyword */
68
76
  addValidate?: (node: SchemaNode) => boolean;
69
77
  /**
70
78
  * Perform validation for this keyword and the passed in data
@@ -102,7 +110,9 @@ declare function getChildSelection(node: SchemaNode, property: string | number):
102
110
  //#endregion
103
111
  //#region src/methods/getData.d.ts
104
112
  type TemplateOptions = {
105
- /** Add all properties (required and optional) to the generated data */addOptionalProps?: boolean; /** Remove data that does not match input schema. Defaults to false */
113
+ /** Add all properties (required and optional) to the generated data */
114
+ addOptionalProps?: boolean;
115
+ /** Remove data that does not match input schema. Defaults to false */
106
116
  removeInvalidData?: boolean;
107
117
  /** Set to false to take default values as they are and not extend them.
108
118
  * Defaults to true.
@@ -118,8 +128,10 @@ type TemplateOptions = {
118
128
  * Limits how often a $ref should be followed before aborting. Prevents infinite data-structure.
119
129
  * Defaults to 1
120
130
  */
121
- recursionLimit?: number; /** @internal disables recursion limit for next call */
122
- disableRecursionLimit?: boolean; /** @internal context to track recursion limit */
131
+ recursionLimit?: number;
132
+ /** @internal disables recursion limit for next call */
133
+ disableRecursionLimit?: boolean;
134
+ /** @internal context to track recursion limit */
123
135
  cache?: Record<string, Record<string, number>>;
124
136
  };
125
137
  declare function getData(node: SchemaNode, data?: unknown, opts?: TemplateOptions): any;
@@ -214,7 +226,8 @@ declare const errors: {
214
226
  "pattern-error": string;
215
227
  "pattern-properties-error": string;
216
228
  "ref-error": string;
217
- "required-property-error": string; /** return schema-warning with createSchemaWarning:true when a valid, but undefined property was found */
229
+ "required-property-error": string;
230
+ /** return schema-warning with createSchemaWarning:true when a valid, but undefined property was found */
218
231
  "schema-warning": string;
219
232
  "type-error": string;
220
233
  "undefined-value-error": string;
@@ -233,20 +246,35 @@ declare const errors: {
233
246
  declare function isSchemaNode(value: unknown): value is SchemaNode;
234
247
  declare function isReduceable(node: SchemaNode): boolean;
235
248
  type Context = {
236
- /** root node of this JSON Schema */rootNode: SchemaNode; /** Fallback _draft_ version in case no _draft_ is specified by `schema.$schema` */
237
- draft?: string; /** available draft configurations */
238
- drafts: Draft[]; /** [SHARED ACROSS REMOTES] root nodes of registered remote JSON Schema, stored by id/url */
239
- remotes: Record<string, SchemaNode>; /** references stored by fully resolved schema-$id + local-pointer */
240
- refs: Record<string, SchemaNode>; /** anchors stored by fully resolved schema-$id + $anchor */
241
- anchors: Record<string, SchemaNode>; /** [SHARED ACROSS REMOTES] dynamicAnchors stored by fully resolved schema-$id + $anchor */
242
- dynamicAnchors: Record<string, SchemaNode>; /** JSON Schema parser, validator, reducer and resolver for this JSON Schema (root schema and its child nodes) */
243
- keywords: Draft["keywords"]; /** JSON Schema draft dependend methods */
244
- methods: Draft["methods"]; /** draft version */
245
- version: Draft["version"]; /** draft errors & template-strings */
246
- errors: Draft["errors"]; /** draft formats & validators */
247
- formats: Draft["formats"]; /** [SHARED USING ADD REMOTE] getData default options */
248
- getDataDefaultOptions?: TemplateOptions; /** [SHARED USING ADD REMOTE] collect unknown keywords in schemaAnnotations */
249
- withSchemaAnnotations?: boolean; /** [SHARED USING ADD REMOTE] throw error on validation when ref cannot be resolved */
249
+ /** root node of this JSON Schema */
250
+ rootNode: SchemaNode;
251
+ /** Fallback _draft_ version in case no _draft_ is specified by `schema.$schema` */
252
+ draft?: string;
253
+ /** available draft configurations */
254
+ drafts: Draft[];
255
+ /** [SHARED ACROSS REMOTES] root nodes of registered remote JSON Schema, stored by id/url */
256
+ remotes: Record<string, SchemaNode>;
257
+ /** references stored by fully resolved schema-$id + local-pointer */
258
+ refs: Record<string, SchemaNode>;
259
+ /** anchors stored by fully resolved schema-$id + $anchor */
260
+ anchors: Record<string, SchemaNode>;
261
+ /** [SHARED ACROSS REMOTES] dynamicAnchors stored by fully resolved schema-$id + $anchor */
262
+ dynamicAnchors: Record<string, SchemaNode>;
263
+ /** JSON Schema parser, validator, reducer and resolver for this JSON Schema (root schema and its child nodes) */
264
+ keywords: Draft["keywords"];
265
+ /** JSON Schema draft dependend methods */
266
+ methods: Draft["methods"];
267
+ /** draft version */
268
+ version: Draft["version"];
269
+ /** draft errors & template-strings */
270
+ errors: Draft["errors"];
271
+ /** draft formats & validators */
272
+ formats: Draft["formats"];
273
+ /** [SHARED USING ADD REMOTE] getData default options */
274
+ getDataDefaultOptions?: TemplateOptions;
275
+ /** [SHARED USING ADD REMOTE] collect unknown keywords in schemaAnnotations */
276
+ withSchemaAnnotations?: boolean;
277
+ /** [SHARED USING ADD REMOTE] throw error on validation when ref cannot be resolved */
250
278
  throwOnInvalidRef?: boolean;
251
279
  };
252
280
  interface SchemaNode extends SchemaNodeMethodsType {
@@ -513,4 +541,4 @@ declare function isJsonAnnotation(error: unknown): error is JsonAnnotation;
513
541
  declare function isJsonError(error: unknown): error is JsonError;
514
542
  //#endregion
515
543
  export { JsonSchemaResolver as A, DraftVersion as C, DataNode as D, TemplateOptions as E, Maybe as F, ValidationAnnotation as I, ValidationPath as L, JsonSchemaValidator as M, JsonSchemaValidatorParams as N, JsonSchemaReducer as O, Keyword as P, ValidationReturnType as R, Draft as S, extendDraft as T, GetNodeOptions as _, JsonAnnotation as a, isReduceable as b, JsonSchema as c, isAnnotation as d, isBooleanSchema as f, Context as g, isJsonSchema as h, ErrorConfig as i, JsonSchemaResolverParams as j, JsonSchemaReducerParams as k, NodeOrError as l, isJsonError as m, AnnotationData as n, JsonError as o, isJsonAnnotation as p, BooleanSchema as r, JsonPointer as s, Annotation as t, OptionalNodeOrError as u, SchemaNode as v, addKeywords as w, isSchemaNode as x, ValidateReturnType as y };
516
- //# sourceMappingURL=types-BDjKcTVR.d.cts.map
544
+ //# sourceMappingURL=types-0Orw2kYf.d.cts.map
@@ -4,10 +4,15 @@ type ValidationPath = {
4
4
  node: SchemaNode;
5
5
  }[];
6
6
  type JsonSchemaReducerParams = {
7
- /** data of current node */data: unknown; /** optional key to used to resolve by property without having data */
8
- key: string | number; /** node to reduce */
9
- node: SchemaNode; /** JSON pointer to data */
10
- pointer: string; /** passed through path for schema resolution, will be changed by reference */
7
+ /** data of current node */
8
+ data: unknown;
9
+ /** optional key to used to resolve by property without having data */
10
+ key: string | number;
11
+ /** node to reduce */
12
+ node: SchemaNode;
13
+ /** JSON pointer to data */
14
+ pointer: string;
15
+ /** passed through path for schema resolution, will be changed by reference */
11
16
  path: ValidationPath;
12
17
  };
13
18
  interface JsonSchemaReducer {
@@ -42,8 +47,10 @@ interface JsonSchemaValidator<Key extends keyof SchemaNode = keyof SchemaNode> {
42
47
  (options: JsonSchemaValidatorParams<Key>): ValidationReturnType;
43
48
  }
44
49
  type Keyword<Key extends keyof SchemaNode = keyof SchemaNode> = {
45
- id: string; /** unique keyword corresponding to JSON Schema keywords (or custom) */
46
- keyword: string; /** sort order of keyword. Lower numbers will be processed last. Default is 0 */
50
+ id: string;
51
+ /** unique keyword corresponding to JSON Schema keywords (or custom) */
52
+ keyword: string;
53
+ /** sort order of keyword. Lower numbers will be processed last. Default is 0 */
47
54
  order?: number;
48
55
  /**
49
56
  * Called once for each JSON Schema dduring compileSchema to evaluate keyword.
@@ -64,7 +71,8 @@ type Keyword<Key extends keyof SchemaNode = keyof SchemaNode> = {
64
71
  * a keyword properties has has child-properties. So when a properties[key] exists,
65
72
  * it will return the node of properties[key] or nothing at all
66
73
  */
67
- resolve?: JsonSchemaResolver; /** return true if the given node should run the validate-function on this keyword */
74
+ resolve?: JsonSchemaResolver;
75
+ /** return true if the given node should run the validate-function on this keyword */
68
76
  addValidate?: (node: SchemaNode) => boolean;
69
77
  /**
70
78
  * Perform validation for this keyword and the passed in data
@@ -102,7 +110,9 @@ declare function getChildSelection(node: SchemaNode, property: string | number):
102
110
  //#endregion
103
111
  //#region src/methods/getData.d.ts
104
112
  type TemplateOptions = {
105
- /** Add all properties (required and optional) to the generated data */addOptionalProps?: boolean; /** Remove data that does not match input schema. Defaults to false */
113
+ /** Add all properties (required and optional) to the generated data */
114
+ addOptionalProps?: boolean;
115
+ /** Remove data that does not match input schema. Defaults to false */
106
116
  removeInvalidData?: boolean;
107
117
  /** Set to false to take default values as they are and not extend them.
108
118
  * Defaults to true.
@@ -118,8 +128,10 @@ type TemplateOptions = {
118
128
  * Limits how often a $ref should be followed before aborting. Prevents infinite data-structure.
119
129
  * Defaults to 1
120
130
  */
121
- recursionLimit?: number; /** @internal disables recursion limit for next call */
122
- disableRecursionLimit?: boolean; /** @internal context to track recursion limit */
131
+ recursionLimit?: number;
132
+ /** @internal disables recursion limit for next call */
133
+ disableRecursionLimit?: boolean;
134
+ /** @internal context to track recursion limit */
123
135
  cache?: Record<string, Record<string, number>>;
124
136
  };
125
137
  declare function getData(node: SchemaNode, data?: unknown, opts?: TemplateOptions): any;
@@ -214,7 +226,8 @@ declare const errors: {
214
226
  "pattern-error": string;
215
227
  "pattern-properties-error": string;
216
228
  "ref-error": string;
217
- "required-property-error": string; /** return schema-warning with createSchemaWarning:true when a valid, but undefined property was found */
229
+ "required-property-error": string;
230
+ /** return schema-warning with createSchemaWarning:true when a valid, but undefined property was found */
218
231
  "schema-warning": string;
219
232
  "type-error": string;
220
233
  "undefined-value-error": string;
@@ -233,20 +246,35 @@ declare const errors: {
233
246
  declare function isSchemaNode(value: unknown): value is SchemaNode;
234
247
  declare function isReduceable(node: SchemaNode): boolean;
235
248
  type Context = {
236
- /** root node of this JSON Schema */rootNode: SchemaNode; /** Fallback _draft_ version in case no _draft_ is specified by `schema.$schema` */
237
- draft?: string; /** available draft configurations */
238
- drafts: Draft[]; /** [SHARED ACROSS REMOTES] root nodes of registered remote JSON Schema, stored by id/url */
239
- remotes: Record<string, SchemaNode>; /** references stored by fully resolved schema-$id + local-pointer */
240
- refs: Record<string, SchemaNode>; /** anchors stored by fully resolved schema-$id + $anchor */
241
- anchors: Record<string, SchemaNode>; /** [SHARED ACROSS REMOTES] dynamicAnchors stored by fully resolved schema-$id + $anchor */
242
- dynamicAnchors: Record<string, SchemaNode>; /** JSON Schema parser, validator, reducer and resolver for this JSON Schema (root schema and its child nodes) */
243
- keywords: Draft["keywords"]; /** JSON Schema draft dependend methods */
244
- methods: Draft["methods"]; /** draft version */
245
- version: Draft["version"]; /** draft errors & template-strings */
246
- errors: Draft["errors"]; /** draft formats & validators */
247
- formats: Draft["formats"]; /** [SHARED USING ADD REMOTE] getData default options */
248
- getDataDefaultOptions?: TemplateOptions; /** [SHARED USING ADD REMOTE] collect unknown keywords in schemaAnnotations */
249
- withSchemaAnnotations?: boolean; /** [SHARED USING ADD REMOTE] throw error on validation when ref cannot be resolved */
249
+ /** root node of this JSON Schema */
250
+ rootNode: SchemaNode;
251
+ /** Fallback _draft_ version in case no _draft_ is specified by `schema.$schema` */
252
+ draft?: string;
253
+ /** available draft configurations */
254
+ drafts: Draft[];
255
+ /** [SHARED ACROSS REMOTES] root nodes of registered remote JSON Schema, stored by id/url */
256
+ remotes: Record<string, SchemaNode>;
257
+ /** references stored by fully resolved schema-$id + local-pointer */
258
+ refs: Record<string, SchemaNode>;
259
+ /** anchors stored by fully resolved schema-$id + $anchor */
260
+ anchors: Record<string, SchemaNode>;
261
+ /** [SHARED ACROSS REMOTES] dynamicAnchors stored by fully resolved schema-$id + $anchor */
262
+ dynamicAnchors: Record<string, SchemaNode>;
263
+ /** JSON Schema parser, validator, reducer and resolver for this JSON Schema (root schema and its child nodes) */
264
+ keywords: Draft["keywords"];
265
+ /** JSON Schema draft dependend methods */
266
+ methods: Draft["methods"];
267
+ /** draft version */
268
+ version: Draft["version"];
269
+ /** draft errors & template-strings */
270
+ errors: Draft["errors"];
271
+ /** draft formats & validators */
272
+ formats: Draft["formats"];
273
+ /** [SHARED USING ADD REMOTE] getData default options */
274
+ getDataDefaultOptions?: TemplateOptions;
275
+ /** [SHARED USING ADD REMOTE] collect unknown keywords in schemaAnnotations */
276
+ withSchemaAnnotations?: boolean;
277
+ /** [SHARED USING ADD REMOTE] throw error on validation when ref cannot be resolved */
250
278
  throwOnInvalidRef?: boolean;
251
279
  };
252
280
  interface SchemaNode extends SchemaNodeMethodsType {
@@ -513,4 +541,4 @@ declare function isJsonAnnotation(error: unknown): error is JsonAnnotation;
513
541
  declare function isJsonError(error: unknown): error is JsonError;
514
542
  //#endregion
515
543
  export { JsonSchemaResolver as A, DraftVersion as C, DataNode as D, TemplateOptions as E, Maybe as F, ValidationAnnotation as I, ValidationPath as L, JsonSchemaValidator as M, JsonSchemaValidatorParams as N, JsonSchemaReducer as O, Keyword as P, ValidationReturnType as R, Draft as S, extendDraft as T, GetNodeOptions as _, JsonAnnotation as a, isReduceable as b, JsonSchema as c, isAnnotation as d, isBooleanSchema as f, Context as g, isJsonSchema as h, ErrorConfig as i, JsonSchemaResolverParams as j, JsonSchemaReducerParams as k, NodeOrError as l, isJsonError as m, AnnotationData as n, JsonError as o, isJsonAnnotation as p, BooleanSchema as r, JsonPointer as s, Annotation as t, OptionalNodeOrError as u, SchemaNode as v, addKeywords as w, isSchemaNode as x, ValidateReturnType as y };
516
- //# sourceMappingURL=types-CqkCJmt8.d.mts.map
544
+ //# sourceMappingURL=types-0Orw2kYf.d.mts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-schema-library",
3
- "version": "11.6.0",
3
+ "version": "11.6.2",
4
4
  "description": "Customizable and hackable json-validator and json-schema utilities for traversal, data generation and validation",
5
5
  "types": "./dist/index.d.cts",
6
6
  "exports": {
@@ -86,22 +86,22 @@
86
86
  "@types/mocha": "^10.0.6",
87
87
  "@types/node": "^25.3.3",
88
88
  "@types/valid-url": "^1.0.7",
89
- "eslint": "^10.2.0",
89
+ "eslint": "^10.7.0",
90
90
  "glob": "^13.0.6",
91
91
  "json-schema-test-suite": "https://github.com/json-schema-org/JSON-Schema-Test-Suite#Test-JSON-Schema-Acceptance-1.037",
92
- "mocha": "^11.7.5",
92
+ "mocha": "^11.7.6",
93
93
  "nyc": "^17.1.0",
94
- "tsdown": "^0.21.2",
95
- "tsx": "^4.21.0",
94
+ "tsdown": "^0.22.9",
95
+ "tsx": "^4.23.1",
96
96
  "typescript": "^5.9.3",
97
- "typescript-eslint": "^8.57.0",
97
+ "typescript-eslint": "^8.64.0",
98
98
  "unplugin-unused": "^0.5.7",
99
99
  "watch": "^1.0.1"
100
100
  },
101
101
  "dependencies": {
102
- "@hyperjump/json-schema-formats": "^1.0.1",
102
+ "@hyperjump/json-schema-formats": "^1.0.2",
103
103
  "@sagold/json-pointer": "^7.2.1",
104
- "fast-copy": "^4.0.2",
104
+ "fast-copy": "^4.0.4",
105
105
  "fast-deep-equal": "^3.1.3",
106
106
  "uri-js": "^4.4.1",
107
107
  "valid-url": "^1.0.9"
@@ -125,7 +125,7 @@
125
125
  "main": "./dist/index.cjs",
126
126
  "module": "./dist/index.mjs",
127
127
  "inlinedDependencies": {
128
- "@hyperjump/json-schema-formats": "1.0.1",
128
+ "@hyperjump/json-schema-formats": "1.0.2",
129
129
  "@hyperjump/uri": "1.3.3",
130
130
  "idn-hostname": "15.1.8",
131
131
  "punycode": "2.3.1"