@stryke/zod 0.3.0 → 0.3.3

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,37 @@
2
2
 
3
3
  # Changelog for Stryke - Zod
4
4
 
5
+ ## [0.3.3](https://github.com/storm-software/stryke/releases/tag/zod%400.3.3) (03/06/2026)
6
+
7
+ ### Updated Dependencies
8
+
9
+ - Updated **type-checks** to **v0.5.33**
10
+ - Updated **json** to **v0.14.2**
11
+
12
+ ## [0.3.2](https://github.com/storm-software/stryke/releases/tag/zod%400.3.2) (03/06/2026)
13
+
14
+ ### Updated Dependencies
15
+
16
+ - Updated **type-checks** to **v0.5.32**
17
+ - Updated **json** to **v0.14.1**
18
+
19
+ ## [0.3.1](https://github.com/storm-software/stryke/releases/tag/zod%400.3.1) (03/03/2026)
20
+
21
+ ### Updated Dependencies
22
+
23
+ - Updated **json** to **v0.14.0**
24
+
25
+ ## [0.3.0](https://github.com/storm-software/stryke/releases/tag/zod%400.3.0) (03/03/2026)
26
+
27
+ ### Features
28
+
29
+ - **zod:** Added `io` option to `extractJsonSchema` function ([172dab78](https://github.com/storm-software/stryke/commit/172dab78))
30
+
31
+ ### Updated Dependencies
32
+
33
+ - Updated **type-checks** to **v0.5.31**
34
+ - Updated **json** to **v0.13.1**
35
+
5
36
  ## [0.2.4](https://github.com/storm-software/stryke/releases/tag/zod%400.2.4) (03/03/2026)
6
37
 
7
38
  ### Updated Dependencies
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { t as ZodType } from "./types-i4I6mfMQ.cjs";
2
2
  import { n as isZod4Type, r as isZodType, t as isZod3Type } from "./is-zod-type-C-QXMMqm.cjs";
3
- import { n as extractJsonSchema, r as extractJsonSchema7, t as ExtractJsonSchemaOptions } from "./schema-6XYtc78K.cjs";
3
+ import { n as extractJsonSchema, r as extractJsonSchema7, t as ExtractJsonSchemaOptions } from "./schema-r-i8wUJm.cjs";
4
4
  export { ExtractJsonSchemaOptions, ZodType, extractJsonSchema, extractJsonSchema7, isZod3Type, isZod4Type, isZodType };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { t as ZodType } from "./types-DWWjtQA0.mjs";
2
2
  import { n as isZod4Type, r as isZodType, t as isZod3Type } from "./is-zod-type-QkJykM8H.mjs";
3
- import { n as extractJsonSchema, r as extractJsonSchema7, t as ExtractJsonSchemaOptions } from "./schema-Cj952H5H.mjs";
3
+ import { n as extractJsonSchema, r as extractJsonSchema7, t as ExtractJsonSchemaOptions } from "./schema-CM-MXRuJ.mjs";
4
4
  export { ExtractJsonSchemaOptions, ZodType, extractJsonSchema, extractJsonSchema7, isZod3Type, isZod4Type, isZodType };
@@ -6,16 +6,68 @@ import "superjson";
6
6
 
7
7
  //#region ../json/src/types.d.ts
8
8
 
9
- interface JsonSchema7AnyType {
9
+ interface JsonSchema7Metadata {
10
+ /**
11
+ * The `$id` keyword is used to identify a schema and can be used for referencing the schema within other schemas. It is a URI that serves as a unique identifier for the schema.
12
+ *
13
+ * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.1
14
+ */
15
+ $id?: string;
16
+ /**
17
+ * The `$schema` keyword is used to specify the version of the JSON Schema specification that the schema adheres to. It is a URI that indicates which version of the JSON Schema specification the schema is written against.
18
+ *
19
+ * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.2
20
+ */
21
+ $schema?: string;
22
+ /**
23
+ * The `$comment` keyword is used to add comments to a JSON Schema. It allows schema authors to include human-readable explanations or notes within the schema without affecting its validation behavior.
24
+ *
25
+ * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.3
26
+ */
27
+ $comment?: string;
28
+ /**
29
+ * The `$defs` keyword is used to define reusable sub-schemas within a JSON Schema. It allows you to define sub-schemas that can be referenced elsewhere in the schema using the `$ref` keyword. The `$defs` keyword is an object where each key is a unique identifier for the sub-schema, and the value is the sub-schema itself.
30
+ *
31
+ * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.4
32
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
33
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
34
+ */
35
+ $defs?: {
36
+ [key: string]: JsonSchema7Type;
37
+ };
38
+ /**
39
+ * The `name` keyword is a custom metadata property that can be used to provide a human-readable name for the schema. It is not part of the official JSON Schema specification but can be useful for documentation and identification purposes.
40
+ */
41
+ name?: string;
42
+ /**
43
+ * The `title` keyword is a custom metadata property that can be used to provide a human-readable title for the schema. It is not part of the official JSON Schema specification but can be useful for documentation and identification purposes.
44
+ */
45
+ title?: string;
46
+ /**
47
+ * The `default` keyword is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
48
+ *
49
+ * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.5
50
+ */
51
+ default?: any;
52
+ /**
53
+ * The `description` keyword is used to provide a human-readable description of the schema or a specific property within the schema. It is not part of the official JSON Schema specification but can be useful for documentation purposes.
54
+ */
55
+ description?: string;
56
+ /**
57
+ * The `alias` keyword is a custom metadata property that can be used to provide alternative names or aliases for the schema. It is not part of the official JSON Schema specification but can be useful for documentation and identification purposes.
58
+ */
59
+ alias?: string | string[];
60
+ }
61
+ interface JsonSchema7AnyType extends JsonSchema7Metadata {
10
62
  $ref?: string;
11
63
  }
12
- interface JsonSchema7ArrayType {
64
+ interface JsonSchema7ArrayType extends JsonSchema7Metadata {
13
65
  type: "array";
14
66
  items?: JsonSchema7Type;
15
67
  minItems?: number;
16
68
  maxItems?: number;
17
69
  }
18
- interface JsonSchema7BigintType {
70
+ interface JsonSchema7BigintType extends JsonSchema7Metadata {
19
71
  type: "integer";
20
72
  format: "int64";
21
73
  minimum?: bigint;
@@ -24,33 +76,33 @@ interface JsonSchema7BigintType {
24
76
  exclusiveMaximum?: bigint;
25
77
  multipleOf?: bigint;
26
78
  }
27
- interface JsonSchema7BooleanType {
79
+ interface JsonSchema7BooleanType extends JsonSchema7Metadata {
28
80
  type: "boolean";
29
81
  }
30
- type JsonSchema7DateType = {
82
+ type JsonSchema7DateType = JsonSchema7Metadata & ({
31
83
  type: "integer" | "string";
32
84
  format: "unix-time" | "date-time" | "date";
33
85
  minimum?: number;
34
86
  maximum?: number;
35
87
  } | {
36
88
  anyOf: JsonSchema7DateType[];
37
- };
38
- interface JsonSchema7EnumType {
89
+ });
90
+ interface JsonSchema7EnumType extends JsonSchema7Metadata {
39
91
  type: "string";
40
92
  enum: string[];
41
93
  }
42
- interface JsonSchema7AllOfType {
94
+ interface JsonSchema7AllOfType extends JsonSchema7Metadata {
43
95
  allOf: JsonSchema7Type[];
44
96
  unevaluatedProperties?: boolean;
45
97
  }
46
- interface JsonSchema7PrimitiveLiteralType {
98
+ interface JsonSchema7PrimitiveLiteralType extends JsonSchema7Metadata {
47
99
  type: "string" | "number" | "integer" | "boolean";
48
100
  const: string | number | boolean;
49
101
  }
50
- type JsonSchema7LiteralType = JsonSchema7PrimitiveLiteralType | {
102
+ type JsonSchema7LiteralType = JsonSchema7Metadata & (JsonSchema7PrimitiveLiteralType | {
51
103
  type: "object" | "array";
52
- };
53
- interface JsonSchema7MapType {
104
+ });
105
+ interface JsonSchema7MapType extends JsonSchema7Metadata {
54
106
  type: "array";
55
107
  maxItems: 125;
56
108
  items: {
@@ -60,22 +112,22 @@ interface JsonSchema7MapType {
60
112
  maxItems: 2;
61
113
  };
62
114
  }
63
- interface JsonSchema7NativeEnumType {
115
+ interface JsonSchema7NativeEnumType extends JsonSchema7Metadata {
64
116
  type: "string" | "number" | ["string", "number"];
65
117
  enum: (string | number)[];
66
118
  }
67
- interface JsonSchema7NeverType {
119
+ interface JsonSchema7NeverType extends JsonSchema7Metadata {
68
120
  not: JsonSchema7AnyType;
69
121
  }
70
- interface JsonSchema7NullType {
122
+ interface JsonSchema7NullType extends JsonSchema7Metadata {
71
123
  type: "null";
72
124
  }
73
- type JsonSchema7NullableType = {
125
+ type JsonSchema7NullableType = JsonSchema7Metadata & ({
74
126
  anyOf: [JsonSchema7Type, JsonSchema7NullType];
75
127
  } | {
76
128
  type: [string, "null"];
77
- };
78
- interface JsonSchema7NumberType {
129
+ });
130
+ interface JsonSchema7NumberType extends JsonSchema7Metadata {
79
131
  type: "number" | "integer";
80
132
  minimum?: number;
81
133
  exclusiveMinimum?: number;
@@ -83,13 +135,13 @@ interface JsonSchema7NumberType {
83
135
  exclusiveMaximum?: number;
84
136
  multipleOf?: number;
85
137
  }
86
- interface JsonSchema7ObjectType {
138
+ interface JsonSchema7ObjectType extends JsonSchema7Metadata {
87
139
  type: "object";
88
140
  properties: Record<string, JsonSchema7Type>;
89
141
  additionalProperties?: boolean | JsonSchema7Type;
90
142
  required?: string[];
91
143
  }
92
- interface JsonSchema7StringType {
144
+ interface JsonSchema7StringType extends JsonSchema7Metadata {
93
145
  type: "string";
94
146
  minLength?: number;
95
147
  maxLength?: number;
@@ -97,20 +149,20 @@ interface JsonSchema7StringType {
97
149
  pattern?: string;
98
150
  contentEncoding?: string;
99
151
  }
100
- interface JsonSchema7SetType {
152
+ interface JsonSchema7SetType extends JsonSchema7Metadata {
101
153
  type: "array";
102
154
  uniqueItems: true;
103
155
  items?: JsonSchema7Type;
104
156
  minItems?: number;
105
157
  maxItems?: number;
106
158
  }
107
- type JsonSchema7RecordPropertyNamesType = Omit<JsonSchema7StringType, "type"> | Omit<JsonSchema7EnumType, "type">;
108
- interface JsonSchema7RecordType {
159
+ type JsonSchema7RecordPropertyNamesType = JsonSchema7Metadata & (Omit<JsonSchema7StringType, "type"> | Omit<JsonSchema7EnumType, "type">);
160
+ interface JsonSchema7RecordType extends JsonSchema7Metadata {
109
161
  type: "object";
110
162
  additionalProperties?: JsonSchema7Type | true;
111
163
  propertyNames?: JsonSchema7RecordPropertyNamesType;
112
164
  }
113
- type JsonSchema7TupleType = {
165
+ type JsonSchema7TupleType = JsonSchema7Metadata & {
114
166
  type: "array";
115
167
  minItems: number;
116
168
  items: JsonSchema7Type[];
@@ -119,46 +171,30 @@ type JsonSchema7TupleType = {
119
171
  } | {
120
172
  additionalItems?: JsonSchema7Type;
121
173
  });
122
- interface JsonSchema7UndefinedType {
174
+ interface JsonSchema7UndefinedType extends JsonSchema7Metadata {
123
175
  not: JsonSchema7AnyType;
124
176
  }
125
177
  type JsonSchema7Primitive = "string" | "number" | "integer" | "boolean" | "null";
126
- type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType;
127
- type JsonSchema7PrimitiveUnionType = {
178
+ type JsonSchema7UnionType = JsonSchema7Metadata & (JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType);
179
+ type JsonSchema7PrimitiveUnionType = JsonSchema7Metadata & ({
128
180
  type: JsonSchema7Primitive | JsonSchema7Primitive[];
129
181
  } | {
130
182
  type: JsonSchema7Primitive | JsonSchema7Primitive[];
131
183
  enum: (string | number | bigint | boolean | null)[];
132
- };
133
- type JsonSchema7UnknownType = JsonSchema7AnyType;
134
- interface JsonSchema7AnyOfType {
184
+ });
185
+ type JsonSchema7UnknownType = JsonSchema7Metadata & JsonSchema7AnyType;
186
+ interface JsonSchema7AnyOfType extends JsonSchema7Metadata {
135
187
  anyOf: JsonSchema7Type[];
136
188
  }
137
- interface JsonSchema7RefType {
189
+ interface JsonSchema7RefType extends JsonSchema7Metadata {
138
190
  $ref: string;
139
191
  }
140
- interface JsonSchema7Meta {
141
- $id?: string;
142
- $ref?: string;
143
- $schema?: string;
144
- $comment?: string;
145
- title?: string;
146
- default?: any;
147
- description?: string;
148
- /**
149
- * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
150
- * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
151
- */
152
- $defs?: {
153
- [key: string]: JsonSchema7Type;
154
- };
155
- }
156
192
  type JsonSchema7TypeUnion = JsonSchema7StringType | JsonSchema7ArrayType | JsonSchema7NumberType | JsonSchema7BigintType | JsonSchema7BooleanType | JsonSchema7DateType | JsonSchema7EnumType | JsonSchema7LiteralType | JsonSchema7NativeEnumType | JsonSchema7NullType | JsonSchema7NumberType | JsonSchema7ObjectType | JsonSchema7RecordType | JsonSchema7TupleType | JsonSchema7UnionType | JsonSchema7UndefinedType | JsonSchema7RefType | JsonSchema7NeverType | JsonSchema7MapType | JsonSchema7AnyType | JsonSchema7NullableType | JsonSchema7AllOfType | JsonSchema7UnknownType | JsonSchema7SetType;
157
193
  /**
158
194
  * JSON Schema v7
159
195
  * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
160
196
  */
161
- type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Meta;
197
+ type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Metadata;
162
198
  //#endregion
163
199
  //#region src/schema.d.ts
164
200
  interface ExtractJsonSchemaOptions {
@@ -198,4 +234,4 @@ declare function extractJsonSchema(type: ZodType, options?: ExtractJsonSchemaOpt
198
234
  declare function extractJsonSchema7(type: ZodType): JsonSchema7Type;
199
235
  //#endregion
200
236
  export { extractJsonSchema as n, extractJsonSchema7 as r, ExtractJsonSchemaOptions as t };
201
- //# sourceMappingURL=schema-Cj952H5H.d.mts.map
237
+ //# sourceMappingURL=schema-CM-MXRuJ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-CM-MXRuJ.d.mts","names":[],"sources":["../../json/src/types.ts","../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA2W4C,UA3O3B,mBAAA,CA2O2B;EAG9B;;;;;EAQF,GAAA,CAAA,EAAA,MAAA;EAEK;AAIjB;AAIA;;;EAGI,OAAA,CAAA,EAAA,MAAA;EACA;;;;;EAKA,QAAA,CAAA,EAAA,MAAA;EACA;;;;;;;EAOA,KAAA,CAAA,EAAA;IACA,CAAA,GAAA,EAAA,MAAA,CAAA,EApPe,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AAkB,uBAAuB;;;UCtYpC,wBAAA;;;;EDwGA,MAAA,CAAA,EAAA,UAAA,GAAmB,eA8BjB;EA+BF;AAIjB;AAOA;AAUA;AAIA;EAaiB,EAAA,CAAA,EAAA,OAAA,GAAA,QAAoB;AAKrC;AAKA;AAKA;AAQA;;;;;AAWiB,iBCxND,iBAAA,CDwN2B,IAAQ,ECvN3C,ODuN2C,EAAA,OAAmB,CAAA,ECtN3D,wBDsN2D,CAAA,EAAA,CAAA,MAAA,GAAA;EAKrD,OAAA,CAAA,EAAA,MAAA,GAAA,SAAqB;EAIrB,WAAA,CAAA,EAAA;IAIL,CAAA,GAAA,EAAA,MAAA,CAAA,ECnO4B,mBAAA,CAAA,eDmOL;EAAG,CAAA,GAAA,SAAA;CAGtB,CAAA,kCAAA,YAAA,CAAA,OAAA,EAAA,OAAA,sBAAA,CAAA,OAAA,EAAA,OAAA,CAAA,CAAA,CAAA;;;AAOhB;AASA;;;;;;AAOiB,iBCtND,kBAAA,CDsN+B,IAAA,ECtNN,ODsNM,CAAA,ECrNa,eDqNM"}
@@ -4,16 +4,68 @@ import * as zod_to_json_schema0 from "zod-to-json-schema";
4
4
 
5
5
  //#region ../json/src/types.d.ts
6
6
 
7
- interface JsonSchema7AnyType {
7
+ interface JsonSchema7Metadata {
8
+ /**
9
+ * The `$id` keyword is used to identify a schema and can be used for referencing the schema within other schemas. It is a URI that serves as a unique identifier for the schema.
10
+ *
11
+ * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.1
12
+ */
13
+ $id?: string;
14
+ /**
15
+ * The `$schema` keyword is used to specify the version of the JSON Schema specification that the schema adheres to. It is a URI that indicates which version of the JSON Schema specification the schema is written against.
16
+ *
17
+ * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.2
18
+ */
19
+ $schema?: string;
20
+ /**
21
+ * The `$comment` keyword is used to add comments to a JSON Schema. It allows schema authors to include human-readable explanations or notes within the schema without affecting its validation behavior.
22
+ *
23
+ * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.3
24
+ */
25
+ $comment?: string;
26
+ /**
27
+ * The `$defs` keyword is used to define reusable sub-schemas within a JSON Schema. It allows you to define sub-schemas that can be referenced elsewhere in the schema using the `$ref` keyword. The `$defs` keyword is an object where each key is a unique identifier for the sub-schema, and the value is the sub-schema itself.
28
+ *
29
+ * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.4
30
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
31
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
32
+ */
33
+ $defs?: {
34
+ [key: string]: JsonSchema7Type;
35
+ };
36
+ /**
37
+ * The `name` keyword is a custom metadata property that can be used to provide a human-readable name for the schema. It is not part of the official JSON Schema specification but can be useful for documentation and identification purposes.
38
+ */
39
+ name?: string;
40
+ /**
41
+ * The `title` keyword is a custom metadata property that can be used to provide a human-readable title for the schema. It is not part of the official JSON Schema specification but can be useful for documentation and identification purposes.
42
+ */
43
+ title?: string;
44
+ /**
45
+ * The `default` keyword is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
46
+ *
47
+ * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.5
48
+ */
49
+ default?: any;
50
+ /**
51
+ * The `description` keyword is used to provide a human-readable description of the schema or a specific property within the schema. It is not part of the official JSON Schema specification but can be useful for documentation purposes.
52
+ */
53
+ description?: string;
54
+ /**
55
+ * The `alias` keyword is a custom metadata property that can be used to provide alternative names or aliases for the schema. It is not part of the official JSON Schema specification but can be useful for documentation and identification purposes.
56
+ */
57
+ alias?: string | string[];
58
+ }
59
+ interface JsonSchema7AnyType extends JsonSchema7Metadata {
8
60
  $ref?: string;
9
61
  }
10
- interface JsonSchema7ArrayType {
62
+ interface JsonSchema7ArrayType extends JsonSchema7Metadata {
11
63
  type: "array";
12
64
  items?: JsonSchema7Type;
13
65
  minItems?: number;
14
66
  maxItems?: number;
15
67
  }
16
- interface JsonSchema7BigintType {
68
+ interface JsonSchema7BigintType extends JsonSchema7Metadata {
17
69
  type: "integer";
18
70
  format: "int64";
19
71
  minimum?: bigint;
@@ -22,33 +74,33 @@ interface JsonSchema7BigintType {
22
74
  exclusiveMaximum?: bigint;
23
75
  multipleOf?: bigint;
24
76
  }
25
- interface JsonSchema7BooleanType {
77
+ interface JsonSchema7BooleanType extends JsonSchema7Metadata {
26
78
  type: "boolean";
27
79
  }
28
- type JsonSchema7DateType = {
80
+ type JsonSchema7DateType = JsonSchema7Metadata & ({
29
81
  type: "integer" | "string";
30
82
  format: "unix-time" | "date-time" | "date";
31
83
  minimum?: number;
32
84
  maximum?: number;
33
85
  } | {
34
86
  anyOf: JsonSchema7DateType[];
35
- };
36
- interface JsonSchema7EnumType {
87
+ });
88
+ interface JsonSchema7EnumType extends JsonSchema7Metadata {
37
89
  type: "string";
38
90
  enum: string[];
39
91
  }
40
- interface JsonSchema7AllOfType {
92
+ interface JsonSchema7AllOfType extends JsonSchema7Metadata {
41
93
  allOf: JsonSchema7Type[];
42
94
  unevaluatedProperties?: boolean;
43
95
  }
44
- interface JsonSchema7PrimitiveLiteralType {
96
+ interface JsonSchema7PrimitiveLiteralType extends JsonSchema7Metadata {
45
97
  type: "string" | "number" | "integer" | "boolean";
46
98
  const: string | number | boolean;
47
99
  }
48
- type JsonSchema7LiteralType = JsonSchema7PrimitiveLiteralType | {
100
+ type JsonSchema7LiteralType = JsonSchema7Metadata & (JsonSchema7PrimitiveLiteralType | {
49
101
  type: "object" | "array";
50
- };
51
- interface JsonSchema7MapType {
102
+ });
103
+ interface JsonSchema7MapType extends JsonSchema7Metadata {
52
104
  type: "array";
53
105
  maxItems: 125;
54
106
  items: {
@@ -58,22 +110,22 @@ interface JsonSchema7MapType {
58
110
  maxItems: 2;
59
111
  };
60
112
  }
61
- interface JsonSchema7NativeEnumType {
113
+ interface JsonSchema7NativeEnumType extends JsonSchema7Metadata {
62
114
  type: "string" | "number" | ["string", "number"];
63
115
  enum: (string | number)[];
64
116
  }
65
- interface JsonSchema7NeverType {
117
+ interface JsonSchema7NeverType extends JsonSchema7Metadata {
66
118
  not: JsonSchema7AnyType;
67
119
  }
68
- interface JsonSchema7NullType {
120
+ interface JsonSchema7NullType extends JsonSchema7Metadata {
69
121
  type: "null";
70
122
  }
71
- type JsonSchema7NullableType = {
123
+ type JsonSchema7NullableType = JsonSchema7Metadata & ({
72
124
  anyOf: [JsonSchema7Type, JsonSchema7NullType];
73
125
  } | {
74
126
  type: [string, "null"];
75
- };
76
- interface JsonSchema7NumberType {
127
+ });
128
+ interface JsonSchema7NumberType extends JsonSchema7Metadata {
77
129
  type: "number" | "integer";
78
130
  minimum?: number;
79
131
  exclusiveMinimum?: number;
@@ -81,13 +133,13 @@ interface JsonSchema7NumberType {
81
133
  exclusiveMaximum?: number;
82
134
  multipleOf?: number;
83
135
  }
84
- interface JsonSchema7ObjectType {
136
+ interface JsonSchema7ObjectType extends JsonSchema7Metadata {
85
137
  type: "object";
86
138
  properties: Record<string, JsonSchema7Type>;
87
139
  additionalProperties?: boolean | JsonSchema7Type;
88
140
  required?: string[];
89
141
  }
90
- interface JsonSchema7StringType {
142
+ interface JsonSchema7StringType extends JsonSchema7Metadata {
91
143
  type: "string";
92
144
  minLength?: number;
93
145
  maxLength?: number;
@@ -95,20 +147,20 @@ interface JsonSchema7StringType {
95
147
  pattern?: string;
96
148
  contentEncoding?: string;
97
149
  }
98
- interface JsonSchema7SetType {
150
+ interface JsonSchema7SetType extends JsonSchema7Metadata {
99
151
  type: "array";
100
152
  uniqueItems: true;
101
153
  items?: JsonSchema7Type;
102
154
  minItems?: number;
103
155
  maxItems?: number;
104
156
  }
105
- type JsonSchema7RecordPropertyNamesType = Omit<JsonSchema7StringType, "type"> | Omit<JsonSchema7EnumType, "type">;
106
- interface JsonSchema7RecordType {
157
+ type JsonSchema7RecordPropertyNamesType = JsonSchema7Metadata & (Omit<JsonSchema7StringType, "type"> | Omit<JsonSchema7EnumType, "type">);
158
+ interface JsonSchema7RecordType extends JsonSchema7Metadata {
107
159
  type: "object";
108
160
  additionalProperties?: JsonSchema7Type | true;
109
161
  propertyNames?: JsonSchema7RecordPropertyNamesType;
110
162
  }
111
- type JsonSchema7TupleType = {
163
+ type JsonSchema7TupleType = JsonSchema7Metadata & {
112
164
  type: "array";
113
165
  minItems: number;
114
166
  items: JsonSchema7Type[];
@@ -117,46 +169,30 @@ type JsonSchema7TupleType = {
117
169
  } | {
118
170
  additionalItems?: JsonSchema7Type;
119
171
  });
120
- interface JsonSchema7UndefinedType {
172
+ interface JsonSchema7UndefinedType extends JsonSchema7Metadata {
121
173
  not: JsonSchema7AnyType;
122
174
  }
123
175
  type JsonSchema7Primitive = "string" | "number" | "integer" | "boolean" | "null";
124
- type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType;
125
- type JsonSchema7PrimitiveUnionType = {
176
+ type JsonSchema7UnionType = JsonSchema7Metadata & (JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType);
177
+ type JsonSchema7PrimitiveUnionType = JsonSchema7Metadata & ({
126
178
  type: JsonSchema7Primitive | JsonSchema7Primitive[];
127
179
  } | {
128
180
  type: JsonSchema7Primitive | JsonSchema7Primitive[];
129
181
  enum: (string | number | bigint | boolean | null)[];
130
- };
131
- type JsonSchema7UnknownType = JsonSchema7AnyType;
132
- interface JsonSchema7AnyOfType {
182
+ });
183
+ type JsonSchema7UnknownType = JsonSchema7Metadata & JsonSchema7AnyType;
184
+ interface JsonSchema7AnyOfType extends JsonSchema7Metadata {
133
185
  anyOf: JsonSchema7Type[];
134
186
  }
135
- interface JsonSchema7RefType {
187
+ interface JsonSchema7RefType extends JsonSchema7Metadata {
136
188
  $ref: string;
137
189
  }
138
- interface JsonSchema7Meta {
139
- $id?: string;
140
- $ref?: string;
141
- $schema?: string;
142
- $comment?: string;
143
- title?: string;
144
- default?: any;
145
- description?: string;
146
- /**
147
- * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
148
- * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
149
- */
150
- $defs?: {
151
- [key: string]: JsonSchema7Type;
152
- };
153
- }
154
190
  type JsonSchema7TypeUnion = JsonSchema7StringType | JsonSchema7ArrayType | JsonSchema7NumberType | JsonSchema7BigintType | JsonSchema7BooleanType | JsonSchema7DateType | JsonSchema7EnumType | JsonSchema7LiteralType | JsonSchema7NativeEnumType | JsonSchema7NullType | JsonSchema7NumberType | JsonSchema7ObjectType | JsonSchema7RecordType | JsonSchema7TupleType | JsonSchema7UnionType | JsonSchema7UndefinedType | JsonSchema7RefType | JsonSchema7NeverType | JsonSchema7MapType | JsonSchema7AnyType | JsonSchema7NullableType | JsonSchema7AllOfType | JsonSchema7UnknownType | JsonSchema7SetType;
155
191
  /**
156
192
  * JSON Schema v7
157
193
  * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
158
194
  */
159
- type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Meta;
195
+ type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Metadata;
160
196
  //#endregion
161
197
  //#region src/schema.d.ts
162
198
  interface ExtractJsonSchemaOptions {
@@ -196,4 +232,4 @@ declare function extractJsonSchema(type: ZodType, options?: ExtractJsonSchemaOpt
196
232
  declare function extractJsonSchema7(type: ZodType): JsonSchema7Type;
197
233
  //#endregion
198
234
  export { extractJsonSchema as n, extractJsonSchema7 as r, ExtractJsonSchemaOptions as t };
199
- //# sourceMappingURL=schema-6XYtc78K.d.cts.map
235
+ //# sourceMappingURL=schema-r-i8wUJm.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-r-i8wUJm.d.cts","names":[],"sources":["../../json/src/types.ts","../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;;AA8WqC,UA9OpB,mBAAA,CA8OoB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GQ,kBAAA,SAA2B;;;KAIhC,oBAAA,GACR,wBACA,uBACA,wBACA,wBACA,yBACA,sBACA,sBACA,yBACA,4BACA,sBACA,wBACA,wBACA,wBACA,uBACA,uBACA,2BACA,qBACA,uBACA,qBACA,qBACA,0BACA,uBACA,yBACA;;;;;KAMQ,eAAA,GAAkB,uBAAuB;;;UCtYpC,wBAAA;;ADwGjB;AA6DA;EAIiB,MAAA,CAAA,EAAA,UAAA,GAAA,eAEP;EAKO;AAUjB;AAIA;AAaA;AAKA;EAKiB,EAAA,CAAA,EAAA,OAAA,GAAA,QAAA;AAKjB;AAQA;;;;;AAWA;AAKA;AAIiB,iBCjOD,iBAAA,CDiO6B,IAAA,EChOrC,ODgOqC,EAAA,OAAmB,CAAA,EC/NrD,wBD+NqD,CAAA,EAAA,CAAA,MAAA,GAAA;EAIpD,OAAA,CAAA,EAAA,MAAA,GAAA,SAAuB;EAAG,WAAA,CAAA,EAAA;IAGtB,CAAA,GAAA,EAAA,MAAA,CAAA,ECtOwB,mBAAA,CAAA,eDsOxB;EAAiB,CAAA,GAAA,SAAA;CAAmB,CAAA,kCAAA,YAAA,CAAA,OAAA,EAAA,OAAA,sBAAA,CAAA,OAAA,EAAA,OAAA,CAAA,CAAA,CAAA;AAOpD;AASA;;;;;;AAOA;AAmBA;AAQY,iBCjPI,kBAAA,CDiP8B,IAAA,ECjPL,ODiPK,CAAA,EChPc,eDgPd"}
package/dist/schema.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as extractJsonSchema, r as extractJsonSchema7, t as ExtractJsonSchemaOptions } from "./schema-6XYtc78K.cjs";
1
+ import { n as extractJsonSchema, r as extractJsonSchema7, t as ExtractJsonSchemaOptions } from "./schema-r-i8wUJm.cjs";
2
2
  export { ExtractJsonSchemaOptions, extractJsonSchema, extractJsonSchema7 };
package/dist/schema.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  import "./types-DWWjtQA0.mjs";
2
- import { n as extractJsonSchema, r as extractJsonSchema7, t as ExtractJsonSchemaOptions } from "./schema-Cj952H5H.mjs";
2
+ import { n as extractJsonSchema, r as extractJsonSchema7, t as ExtractJsonSchemaOptions } from "./schema-CM-MXRuJ.mjs";
3
3
  export { ExtractJsonSchemaOptions, extractJsonSchema, extractJsonSchema7 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/zod",
3
- "version": "0.3.0",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "description": "A package containing helper utilities for working with zod schemas.",
6
6
  "repository": {
@@ -70,14 +70,14 @@
70
70
  "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" },
71
71
  "peerDependenciesMeta": { "zod": { "optional": true } },
72
72
  "dependencies": {
73
- "@stryke/type-checks": "^0.5.31",
73
+ "@stryke/type-checks": "^0.5.33",
74
74
  "zod-to-json-schema": "^3.25.1"
75
75
  },
76
76
  "devDependencies": {
77
- "@stryke/json": "^0.13.1",
77
+ "@stryke/json": "^0.14.2",
78
78
  "tsdown": "^0.17.2",
79
79
  "zod": "^4.3.6"
80
80
  },
81
81
  "publishConfig": { "access": "public" },
82
- "gitHead": "7d12d78184a0812114d762186fe34f82d9e9083d"
82
+ "gitHead": "08467a1f278a507f90161aefc9e954602a626be6"
83
83
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-6XYtc78K.d.cts","names":[],"sources":["../../json/src/types.ts","../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;;AAgWI,UAhOa,kBAAA,CAgOb;EACA,IAAA,CAAA,EAAA,MAAA;;AAEA,UA/Na,oBAAA,CA+Nb;EACA,IAAA,EAAA,OAAA;EACA,KAAA,CAAA,EA/NM,eA+NN;EACA,QAAA,CAAA,EAAA,MAAA;EACA,QAAA,CAAA,EAAA,MAAA;;AACkB,UA7NL,qBAAA,CA6NK;EAMV,IAAA,EAAA,SAAA;;;;ECtVK,OAAA,CAAA,EAAA,MAAA;EAqBD,gBAAA,CAAA,EAAA,MAAiB;EACzB,UAA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