@nldoc/openapi-test-set-generator 1.2.25 → 1.3.0

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.
Files changed (64) hide show
  1. package/README.md +39 -0
  2. package/dist/commands/extract-examples.js +8 -8
  3. package/dist/commands/extract-examples.js.map +1 -1
  4. package/dist/lib/condition/schema/schemaPropertyChecker.d.ts +2 -3
  5. package/dist/lib/condition/schema/schemaPropertyChecker.js +8 -1
  6. package/dist/lib/condition/schema/schemaPropertyChecker.js.map +1 -1
  7. package/dist/lib/condition/schemaPropertySelector.d.ts +7 -8
  8. package/dist/lib/condition/schemaPropertySelector.js +31 -7
  9. package/dist/lib/condition/schemaPropertySelector.js.map +1 -1
  10. package/dist/lib/isJsonObject.d.ts +2 -0
  11. package/dist/lib/isJsonObject.js +4 -0
  12. package/dist/lib/isJsonObject.js.map +1 -0
  13. package/dist/lib/modification/createExampleVariantsFromSchemaOnQueries.d.ts +5 -5
  14. package/dist/lib/modification/createExampleVariantsFromSchemaOnQueries.js +3 -1
  15. package/dist/lib/modification/createExampleVariantsFromSchemaOnQueries.js.map +1 -1
  16. package/dist/lib/modification/createExampleVariantsFromSchemaOnQuery.d.ts +6 -5
  17. package/dist/lib/modification/createExampleVariantsFromSchemaOnQuery.js +3 -0
  18. package/dist/lib/modification/createExampleVariantsFromSchemaOnQuery.js.map +1 -1
  19. package/dist/lib/modification/createExampleVariantsFromSchemasOnQueries.d.ts +5 -5
  20. package/dist/lib/modification/createExampleVariantsFromSchemasOnQueries.js +5 -5
  21. package/dist/lib/modification/createExampleVariantsFromSchemasOnQueries.js.map +1 -1
  22. package/dist/lib/modification/modifyPropertyInExample.d.ts +8 -7
  23. package/dist/lib/modification/modifyPropertyInExample.js +33 -15
  24. package/dist/lib/modification/modifyPropertyInExample.js.map +1 -1
  25. package/dist/lib/modification/modifyPropertyInSchemaExamples.d.ts +7 -10
  26. package/dist/lib/modification/modifyPropertyInSchemaExamples.js +35 -13
  27. package/dist/lib/modification/modifyPropertyInSchemaExamples.js.map +1 -1
  28. package/dist/lib/openapi/PropertyResolver.d.ts +2 -2
  29. package/dist/lib/openapi/PropertyResolver.js.map +1 -1
  30. package/dist/lib/openapi/SchemaPropertyResolver.d.ts +32 -9
  31. package/dist/lib/openapi/SchemaPropertyResolver.js +71 -17
  32. package/dist/lib/openapi/SchemaPropertyResolver.js.map +1 -1
  33. package/dist/lib/openapi/extractSchemaObjectsWithExamples.d.ts +6 -0
  34. package/dist/lib/openapi/extractSchemaObjectsWithExamples.js +10 -0
  35. package/dist/lib/openapi/extractSchemaObjectsWithExamples.js.map +1 -0
  36. package/dist/lib/openapi/isReferenceObject.d.ts +2 -0
  37. package/dist/lib/openapi/isReferenceObject.js +4 -0
  38. package/dist/lib/openapi/isReferenceObject.js.map +1 -0
  39. package/dist/lib/openapi/isSchemaObject.d.ts +2 -0
  40. package/dist/lib/openapi/isSchemaObject.js +4 -0
  41. package/dist/lib/openapi/isSchemaObject.js.map +1 -0
  42. package/dist/lib/openapi/isSchemaObjectWithExamples.d.ts +4 -0
  43. package/dist/lib/openapi/isSchemaObjectWithExamples.js +8 -0
  44. package/dist/lib/openapi/isSchemaObjectWithExamples.js.map +1 -0
  45. package/dist/lib/openapi/isSchemaObjectWithProperties.d.ts +4 -0
  46. package/dist/lib/openapi/isSchemaObjectWithProperties.js +9 -0
  47. package/dist/lib/openapi/isSchemaObjectWithProperties.js.map +1 -0
  48. package/dist/types/InputFile.d.ts +32 -32
  49. package/dist/types/condition/SchemaPropertySelectorCondition.d.ts +8 -8
  50. package/dist/types/modification/SchemaPropertyVariantQuery.d.ts +16 -16
  51. package/dist/types/openapi/HasExamples.d.ts +4 -0
  52. package/dist/types/openapi/HasExamples.js +2 -0
  53. package/dist/types/openapi/HasExamples.js.map +1 -0
  54. package/package.json +1 -1
  55. package/LICENSE.txt +0 -287
  56. package/dist/lib/openapi/extractObjectSchemasWithExamples.d.ts +0 -8
  57. package/dist/lib/openapi/extractObjectSchemasWithExamples.js +0 -16
  58. package/dist/lib/openapi/extractObjectSchemasWithExamples.js.map +0 -1
  59. package/dist/types/openapi/HasObjectExamples.d.ts +0 -4
  60. package/dist/types/openapi/HasObjectExamples.js +0 -2
  61. package/dist/types/openapi/HasObjectExamples.js.map +0 -1
  62. package/dist/types/openapi/HasResolvedProperties.d.ts +0 -4
  63. package/dist/types/openapi/HasResolvedProperties.js +0 -2
  64. package/dist/types/openapi/HasResolvedProperties.js.map +0 -1
@@ -1,21 +1,44 @@
1
+ import { type ReferenceObject, type SchemaObject } from 'openapi3-ts/oas31.js';
1
2
  import { type PropertyResolver } from './PropertyResolver.js';
2
- import { type SchemaObject } from 'openapi3-ts/oas31.js';
3
- import { type HasResolvedProperties } from '../../types/openapi/HasResolvedProperties.js';
3
+ /**
4
+ * Resolves OpenAPI schemas by recursively resolving references while avoiding
5
+ * circular reference loops.
6
+ */
4
7
  export declare class SchemaPropertyResolver {
5
8
  private resolver;
6
9
  constructor(resolver: PropertyResolver);
7
10
  /**
8
- * Resolve all properties of a schema.
11
+ * Resolves a schema and its nested references.
9
12
  *
10
- * @param {SchemaObject} schema - The schema that contains the properties to resolve
11
- *
12
- * @todo Use `Promise.all` to resolve all properties concurrently.
13
+ * @param params Object containing the schema key and schema to resolve
14
+ * @returns The key and resolved schema with references resolved where possible
13
15
  */
14
- resolveProperties<T extends SchemaObject>({ key, schema, }: {
16
+ resolve({ key, schema, }: {
15
17
  key: string;
16
- schema: T;
18
+ schema: SchemaObject | ReferenceObject;
17
19
  }): Promise<{
18
20
  key: string;
19
- schema: T & HasResolvedProperties;
21
+ schema: SchemaObject | ReferenceObject;
20
22
  }>;
23
+ /**
24
+ * Recursively resolves a schema object and its nested properties,
25
+ * preventing infinite loops from circular references.
26
+ *
27
+ * @param schema The schema or reference to resolve
28
+ * @param visitedRefs Set of reference paths already visited in this resolution chain
29
+ * @returns The schema with references resolved where possible
30
+ */
31
+ private resolveSchemaRecursively;
32
+ /**
33
+ * Resolves a reference object, handling circular references.
34
+ */
35
+ private resolveReference;
36
+ /**
37
+ * Resolves all properties in a properties object.
38
+ */
39
+ private resolveProperties;
40
+ /**
41
+ * Resolves composition keywords (allOf, anyOf, oneOf).
42
+ */
43
+ private resolveCompositionKeywords;
21
44
  }
@@ -1,33 +1,87 @@
1
- function isReferenceObject(schema) {
2
- return '$ref' in schema;
3
- }
1
+ import { isReferenceObject } from './isReferenceObject.js';
2
+ /**
3
+ * Resolves OpenAPI schemas by recursively resolving references while avoiding
4
+ * circular reference loops.
5
+ */
4
6
  export class SchemaPropertyResolver {
5
7
  resolver;
6
8
  constructor(resolver) {
7
9
  this.resolver = resolver;
8
10
  }
9
11
  /**
10
- * Resolve all properties of a schema.
12
+ * Resolves a schema and its nested references.
11
13
  *
12
- * @param {SchemaObject} schema - The schema that contains the properties to resolve
14
+ * @param params Object containing the schema key and schema to resolve
15
+ * @returns The key and resolved schema with references resolved where possible
16
+ */
17
+ async resolve({ key, schema, }) {
18
+ const resolvedSchema = await this.resolveSchemaRecursively(schema, new Set());
19
+ return { key, schema: resolvedSchema };
20
+ }
21
+ /**
22
+ * Recursively resolves a schema object and its nested properties,
23
+ * preventing infinite loops from circular references.
13
24
  *
14
- * @todo Use `Promise.all` to resolve all properties concurrently.
25
+ * @param schema The schema or reference to resolve
26
+ * @param visitedRefs Set of reference paths already visited in this resolution chain
27
+ * @returns The schema with references resolved where possible
28
+ */
29
+ async resolveSchemaRecursively(schema, visitedRefs) {
30
+ if (isReferenceObject(schema)) {
31
+ return this.resolveReference(schema, visitedRefs);
32
+ }
33
+ const resolvedSchema = { ...schema };
34
+ if (resolvedSchema.properties) {
35
+ resolvedSchema.properties = await this.resolveProperties(resolvedSchema.properties, visitedRefs);
36
+ }
37
+ if (resolvedSchema.items) {
38
+ resolvedSchema.items = await this.resolveSchemaRecursively(resolvedSchema.items, visitedRefs);
39
+ }
40
+ await this.resolveCompositionKeywords(resolvedSchema, visitedRefs);
41
+ if (resolvedSchema.not) {
42
+ resolvedSchema.not = await this.resolveSchemaRecursively(resolvedSchema.not, visitedRefs);
43
+ }
44
+ return resolvedSchema;
45
+ }
46
+ /**
47
+ * Resolves a reference object, handling circular references.
15
48
  */
16
- async resolveProperties({ key, schema, }) {
17
- if (!schema.properties) {
18
- return { key, schema: { ...schema, properties: undefined } };
49
+ async resolveReference(ref, visitedRefs) {
50
+ if (visitedRefs.has(ref.$ref)) {
51
+ return ref;
19
52
  }
53
+ const newVisitedRefs = new Set(visitedRefs);
54
+ newVisitedRefs.add(ref.$ref);
55
+ try {
56
+ const resolvedSchema = await this.resolver.resolve(ref.$ref);
57
+ return await this.resolveSchemaRecursively(resolvedSchema, newVisitedRefs);
58
+ }
59
+ catch (error) {
60
+ console.error(`Failed to resolve reference: ${ref.$ref}`, error);
61
+ return ref;
62
+ }
63
+ }
64
+ /**
65
+ * Resolves all properties in a properties object.
66
+ */
67
+ async resolveProperties(properties, visitedRefs) {
20
68
  const resolvedProperties = {};
21
- for (const key in schema.properties) {
22
- const property = schema.properties[key];
23
- if (isReferenceObject(property)) {
24
- resolvedProperties[key] = await this.resolver.resolve(property.$ref);
25
- }
26
- else {
27
- resolvedProperties[key] = property;
69
+ for (const [key, property] of Object.entries(properties)) {
70
+ resolvedProperties[key] = await this.resolveSchemaRecursively(property, visitedRefs);
71
+ }
72
+ return resolvedProperties;
73
+ }
74
+ /**
75
+ * Resolves composition keywords (allOf, anyOf, oneOf).
76
+ */
77
+ async resolveCompositionKeywords(schema, visitedRefs) {
78
+ const compositionKeywords = ['allOf', 'anyOf', 'oneOf'];
79
+ for (const keyword of compositionKeywords) {
80
+ const items = schema[keyword];
81
+ if (items && Array.isArray(items)) {
82
+ schema[keyword] = await Promise.all(items.map((item) => this.resolveSchemaRecursively(item, visitedRefs)));
28
83
  }
29
84
  }
30
- return { key, schema: { ...schema, properties: resolvedProperties } };
31
85
  }
32
86
  }
33
87
  //# sourceMappingURL=SchemaPropertyResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaPropertyResolver.js","sourceRoot":"","sources":["../../../src/lib/openapi/SchemaPropertyResolver.ts"],"names":[],"mappings":"AAIA,SAAS,iBAAiB,CAAC,MAAsC;IAC7D,OAAO,MAAM,IAAI,MAAM,CAAA;AAC3B,CAAC;AAED,MAAM,OAAO,sBAAsB;IACX;IAApB,YAAoB,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;IAAG,CAAC;IAElD;;;;;;OAMG;IACI,KAAK,CAAC,iBAAiB,CAAyB,EACnD,GAAG,EACH,MAAM,GAIT;QACG,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACrB,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,CAAA;QAChE,CAAC;QAED,MAAM,kBAAkB,GAAiC,EAAE,CAAA;QAE3D,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YAEvC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC9B,kBAAkB,CAAC,GAAG,CAAC,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;YACxE,CAAC;iBAAM,CAAC;gBACJ,kBAAkB,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA;YACtC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,EAAE,CAAA;IACzE,CAAC;CACJ"}
1
+ {"version":3,"file":"SchemaPropertyResolver.js","sourceRoot":"","sources":["../../../src/lib/openapi/SchemaPropertyResolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D;;;GAGG;A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AI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CACxE,CAAA;YACL,CAAC;QACL,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,6 @@
1
+ import { type OpenAPIObject } from 'openapi3-ts/oas31.js';
2
+ import { type SchemaObjectWithExamples } from './isSchemaObjectWithExamples.js';
3
+ export declare function extractSchemaObjectsWithExamples(openApi: OpenAPIObject): {
4
+ key: string;
5
+ schema: SchemaObjectWithExamples;
6
+ }[];
@@ -0,0 +1,10 @@
1
+ import { isSchemaObjectWithExamples, } from './isSchemaObjectWithExamples.js';
2
+ export function extractSchemaObjectsWithExamples(openApi) {
3
+ return Object.entries(openApi.components?.schemas ?? {})
4
+ .filter(isSchemaObjectWithExamples)
5
+ .map(([key, schema]) => ({
6
+ key,
7
+ schema,
8
+ }));
9
+ }
10
+ //# sourceMappingURL=extractSchemaObjectsWithExamples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractSchemaObjectsWithExamples.js","sourceRoot":"","sources":["../../../src/lib/openapi/extractSchemaObjectsWithExamples.ts"],"names":[],"mappings":"AACA,OAAO,EACH,0BAA0B,GAE7B,MAAM,iCAAiC,CAAA;AAExC,MAAM,UAAU,gCAAgC,CAC5C,OAAsB;IAEtB,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,IAAI,EAAE,CAAC;SACnD,MAAM,CAAC,0BAA0B,CAAC;SAClC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAqD,EAAE,CAAC,CAAC;QACxE,GAAG;QACH,MAAM;KACT,CAAC,CAAC,CAAA;AACX,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type ReferenceObject } from 'openapi3-ts/oas31';
2
+ export declare function isReferenceObject(obj: unknown): obj is ReferenceObject;
@@ -0,0 +1,4 @@
1
+ export function isReferenceObject(obj) {
2
+ return obj !== null && typeof obj === 'object' && '$ref' in obj;
3
+ }
4
+ //# sourceMappingURL=isReferenceObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isReferenceObject.js","sourceRoot":"","sources":["../../../src/lib/openapi/isReferenceObject.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC1C,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,CAAA;AACnE,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type SchemaObject } from 'openapi3-ts/oas31';
2
+ export declare function isSchemaObject(schema: unknown): schema is SchemaObject;
@@ -0,0 +1,4 @@
1
+ export function isSchemaObject(schema) {
2
+ return typeof schema === 'object' && schema !== null && !('$ref' in schema);
3
+ }
4
+ //# sourceMappingURL=isSchemaObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSchemaObject.js","sourceRoot":"","sources":["../../../src/lib/openapi/isSchemaObject.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc,CAAC,MAAe;IAC1C,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,CAAA;AAC/E,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type ReferenceObject, type SchemaObject } from 'openapi3-ts/oas31';
2
+ import { type HasExamples } from '../../types/openapi/HasExamples.js';
3
+ export type SchemaObjectWithExamples = SchemaObject & HasExamples;
4
+ export declare const isSchemaObjectWithExamples: (schema: [string, SchemaObject | ReferenceObject]) => schema is [string, SchemaObjectWithExamples];
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ import { Json } from '../../types/Json.js';
3
+ import { isSchemaObject } from './isSchemaObject.js';
4
+ export const isSchemaObjectWithExamples = (schema) => isSchemaObject(schema[1]) &&
5
+ 'examples' in schema[1] &&
6
+ (schema[1].examples?.length ?? 0) > 0 &&
7
+ z.array(Json).safeParse(schema[1].examples).success;
8
+ //# sourceMappingURL=isSchemaObjectWithExamples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSchemaObjectWithExamples.js","sourceRoot":"","sources":["../../../src/lib/openapi/isSchemaObjectWithExamples.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAIpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACtC,MAAgD,EACJ,EAAE,CAC9C,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACzB,UAAU,IAAI,MAAM,CAAC,CAAC,CAAC;IACvB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC;IACrC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { type SchemaObject } from 'openapi3-ts/oas31';
2
+ export declare function isSchemaObjectWithProperties(obj: unknown): obj is SchemaObject & {
3
+ properties: SchemaObject;
4
+ };
@@ -0,0 +1,9 @@
1
+ import { isReferenceObject } from './isReferenceObject.js';
2
+ import { isSchemaObject } from './isSchemaObject.js';
3
+ export function isSchemaObjectWithProperties(obj) {
4
+ return (isSchemaObject(obj) &&
5
+ 'properties' in obj &&
6
+ obj.properties !== undefined &&
7
+ !isReferenceObject(obj.properties));
8
+ }
9
+ //# sourceMappingURL=isSchemaObjectWithProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSchemaObjectWithProperties.js","sourceRoot":"","sources":["../../../src/lib/openapi/isSchemaObjectWithProperties.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,UAAU,4BAA4B,CACxC,GAAY;IAEZ,OAAO,CACH,cAAc,CAAC,GAAG,CAAC;QACnB,YAAY,IAAI,GAAG;QACnB,GAAG,CAAC,UAAU,KAAK,SAAS;QAC5B,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CACrC,CAAA;AACL,CAAC"}
@@ -104,12 +104,14 @@ export declare const InputFile: z.ZodObject<{
104
104
  $ne?: string | null | undefined;
105
105
  $in?: (string | null)[] | undefined;
106
106
  } | undefined;
107
+ required?: boolean | undefined;
108
+ hasDefault?: boolean | undefined;
107
109
  format?: {
108
110
  $eq?: string | null | undefined;
109
111
  $ne?: string | null | undefined;
110
112
  $in?: (string | null)[] | undefined;
111
113
  } | undefined;
112
- maxLength?: {
114
+ minLength?: {
113
115
  $gte?: number | undefined;
114
116
  $lte?: number | undefined;
115
117
  $lt?: number | undefined;
@@ -118,7 +120,7 @@ export declare const InputFile: z.ZodObject<{
118
120
  $ne?: number | null | undefined;
119
121
  $in?: (number | null)[] | undefined;
120
122
  } | undefined;
121
- minLength?: {
123
+ maxLength?: {
122
124
  $gte?: number | undefined;
123
125
  $lte?: number | undefined;
124
126
  $lt?: number | undefined;
@@ -127,20 +129,20 @@ export declare const InputFile: z.ZodObject<{
127
129
  $ne?: number | null | undefined;
128
130
  $in?: (number | null)[] | undefined;
129
131
  } | undefined;
130
- required?: boolean | undefined;
131
- hasDefault?: boolean | undefined;
132
132
  }, {
133
133
  type?: {
134
134
  $eq?: string | null | undefined;
135
135
  $ne?: string | null | undefined;
136
136
  $in?: (string | null)[] | undefined;
137
137
  } | undefined;
138
+ required?: boolean | undefined;
139
+ hasDefault?: boolean | undefined;
138
140
  format?: {
139
141
  $eq?: string | null | undefined;
140
142
  $ne?: string | null | undefined;
141
143
  $in?: (string | null)[] | undefined;
142
144
  } | undefined;
143
- maxLength?: {
145
+ minLength?: {
144
146
  $gte?: number | undefined;
145
147
  $lte?: number | undefined;
146
148
  $lt?: number | undefined;
@@ -149,7 +151,7 @@ export declare const InputFile: z.ZodObject<{
149
151
  $ne?: number | null | undefined;
150
152
  $in?: (number | null)[] | undefined;
151
153
  } | undefined;
152
- minLength?: {
154
+ maxLength?: {
153
155
  $gte?: number | undefined;
154
156
  $lte?: number | undefined;
155
157
  $lt?: number | undefined;
@@ -158,8 +160,6 @@ export declare const InputFile: z.ZodObject<{
158
160
  $ne?: number | null | undefined;
159
161
  $in?: (number | null)[] | undefined;
160
162
  } | undefined;
161
- required?: boolean | undefined;
162
- hasDefault?: boolean | undefined;
163
163
  }>>;
164
164
  do: z.ZodDefault<z.ZodObject<{
165
165
  set: z.ZodOptional<z.ZodType<import("./Json.js").Json, z.ZodTypeDef, import("./Json.js").Json>>;
@@ -180,12 +180,14 @@ export declare const InputFile: z.ZodObject<{
180
180
  $ne?: string | null | undefined;
181
181
  $in?: (string | null)[] | undefined;
182
182
  } | undefined;
183
+ required?: boolean | undefined;
184
+ hasDefault?: boolean | undefined;
183
185
  format?: {
184
186
  $eq?: string | null | undefined;
185
187
  $ne?: string | null | undefined;
186
188
  $in?: (string | null)[] | undefined;
187
189
  } | undefined;
188
- maxLength?: {
190
+ minLength?: {
189
191
  $gte?: number | undefined;
190
192
  $lte?: number | undefined;
191
193
  $lt?: number | undefined;
@@ -194,7 +196,7 @@ export declare const InputFile: z.ZodObject<{
194
196
  $ne?: number | null | undefined;
195
197
  $in?: (number | null)[] | undefined;
196
198
  } | undefined;
197
- minLength?: {
199
+ maxLength?: {
198
200
  $gte?: number | undefined;
199
201
  $lte?: number | undefined;
200
202
  $lt?: number | undefined;
@@ -203,8 +205,6 @@ export declare const InputFile: z.ZodObject<{
203
205
  $ne?: number | null | undefined;
204
206
  $in?: (number | null)[] | undefined;
205
207
  } | undefined;
206
- required?: boolean | undefined;
207
- hasDefault?: boolean | undefined;
208
208
  };
209
209
  do: {
210
210
  set?: import("./Json.js").Json | undefined;
@@ -218,12 +218,14 @@ export declare const InputFile: z.ZodObject<{
218
218
  $ne?: string | null | undefined;
219
219
  $in?: (string | null)[] | undefined;
220
220
  } | undefined;
221
+ required?: boolean | undefined;
222
+ hasDefault?: boolean | undefined;
221
223
  format?: {
222
224
  $eq?: string | null | undefined;
223
225
  $ne?: string | null | undefined;
224
226
  $in?: (string | null)[] | undefined;
225
227
  } | undefined;
226
- maxLength?: {
228
+ minLength?: {
227
229
  $gte?: number | undefined;
228
230
  $lte?: number | undefined;
229
231
  $lt?: number | undefined;
@@ -232,7 +234,7 @@ export declare const InputFile: z.ZodObject<{
232
234
  $ne?: number | null | undefined;
233
235
  $in?: (number | null)[] | undefined;
234
236
  } | undefined;
235
- minLength?: {
237
+ maxLength?: {
236
238
  $gte?: number | undefined;
237
239
  $lte?: number | undefined;
238
240
  $lt?: number | undefined;
@@ -241,8 +243,6 @@ export declare const InputFile: z.ZodObject<{
241
243
  $ne?: number | null | undefined;
242
244
  $in?: (number | null)[] | undefined;
243
245
  } | undefined;
244
- required?: boolean | undefined;
245
- hasDefault?: boolean | undefined;
246
246
  } | undefined;
247
247
  do?: {
248
248
  set?: import("./Json.js").Json | undefined;
@@ -258,12 +258,14 @@ export declare const InputFile: z.ZodObject<{
258
258
  $ne?: string | null | undefined;
259
259
  $in?: (string | null)[] | undefined;
260
260
  } | undefined;
261
+ required?: boolean | undefined;
262
+ hasDefault?: boolean | undefined;
261
263
  format?: {
262
264
  $eq?: string | null | undefined;
263
265
  $ne?: string | null | undefined;
264
266
  $in?: (string | null)[] | undefined;
265
267
  } | undefined;
266
- maxLength?: {
268
+ minLength?: {
267
269
  $gte?: number | undefined;
268
270
  $lte?: number | undefined;
269
271
  $lt?: number | undefined;
@@ -272,7 +274,7 @@ export declare const InputFile: z.ZodObject<{
272
274
  $ne?: number | null | undefined;
273
275
  $in?: (number | null)[] | undefined;
274
276
  } | undefined;
275
- minLength?: {
277
+ maxLength?: {
276
278
  $gte?: number | undefined;
277
279
  $lte?: number | undefined;
278
280
  $lt?: number | undefined;
@@ -281,8 +283,6 @@ export declare const InputFile: z.ZodObject<{
281
283
  $ne?: number | null | undefined;
282
284
  $in?: (number | null)[] | undefined;
283
285
  } | undefined;
284
- required?: boolean | undefined;
285
- hasDefault?: boolean | undefined;
286
286
  };
287
287
  do: {
288
288
  set?: import("./Json.js").Json | undefined;
@@ -298,12 +298,14 @@ export declare const InputFile: z.ZodObject<{
298
298
  $ne?: string | null | undefined;
299
299
  $in?: (string | null)[] | undefined;
300
300
  } | undefined;
301
+ required?: boolean | undefined;
302
+ hasDefault?: boolean | undefined;
301
303
  format?: {
302
304
  $eq?: string | null | undefined;
303
305
  $ne?: string | null | undefined;
304
306
  $in?: (string | null)[] | undefined;
305
307
  } | undefined;
306
- maxLength?: {
308
+ minLength?: {
307
309
  $gte?: number | undefined;
308
310
  $lte?: number | undefined;
309
311
  $lt?: number | undefined;
@@ -312,7 +314,7 @@ export declare const InputFile: z.ZodObject<{
312
314
  $ne?: number | null | undefined;
313
315
  $in?: (number | null)[] | undefined;
314
316
  } | undefined;
315
- minLength?: {
317
+ maxLength?: {
316
318
  $gte?: number | undefined;
317
319
  $lte?: number | undefined;
318
320
  $lt?: number | undefined;
@@ -321,8 +323,6 @@ export declare const InputFile: z.ZodObject<{
321
323
  $ne?: number | null | undefined;
322
324
  $in?: (number | null)[] | undefined;
323
325
  } | undefined;
324
- required?: boolean | undefined;
325
- hasDefault?: boolean | undefined;
326
326
  } | undefined;
327
327
  do?: {
328
328
  set?: import("./Json.js").Json | undefined;
@@ -347,12 +347,14 @@ export declare const InputFile: z.ZodObject<{
347
347
  $ne?: string | null | undefined;
348
348
  $in?: (string | null)[] | undefined;
349
349
  } | undefined;
350
+ required?: boolean | undefined;
351
+ hasDefault?: boolean | undefined;
350
352
  format?: {
351
353
  $eq?: string | null | undefined;
352
354
  $ne?: string | null | undefined;
353
355
  $in?: (string | null)[] | undefined;
354
356
  } | undefined;
355
- maxLength?: {
357
+ minLength?: {
356
358
  $gte?: number | undefined;
357
359
  $lte?: number | undefined;
358
360
  $lt?: number | undefined;
@@ -361,7 +363,7 @@ export declare const InputFile: z.ZodObject<{
361
363
  $ne?: number | null | undefined;
362
364
  $in?: (number | null)[] | undefined;
363
365
  } | undefined;
364
- minLength?: {
366
+ maxLength?: {
365
367
  $gte?: number | undefined;
366
368
  $lte?: number | undefined;
367
369
  $lt?: number | undefined;
@@ -370,8 +372,6 @@ export declare const InputFile: z.ZodObject<{
370
372
  $ne?: number | null | undefined;
371
373
  $in?: (number | null)[] | undefined;
372
374
  } | undefined;
373
- required?: boolean | undefined;
374
- hasDefault?: boolean | undefined;
375
375
  };
376
376
  do: {
377
377
  set?: import("./Json.js").Json | undefined;
@@ -396,12 +396,14 @@ export declare const InputFile: z.ZodObject<{
396
396
  $ne?: string | null | undefined;
397
397
  $in?: (string | null)[] | undefined;
398
398
  } | undefined;
399
+ required?: boolean | undefined;
400
+ hasDefault?: boolean | undefined;
399
401
  format?: {
400
402
  $eq?: string | null | undefined;
401
403
  $ne?: string | null | undefined;
402
404
  $in?: (string | null)[] | undefined;
403
405
  } | undefined;
404
- maxLength?: {
406
+ minLength?: {
405
407
  $gte?: number | undefined;
406
408
  $lte?: number | undefined;
407
409
  $lt?: number | undefined;
@@ -410,7 +412,7 @@ export declare const InputFile: z.ZodObject<{
410
412
  $ne?: number | null | undefined;
411
413
  $in?: (number | null)[] | undefined;
412
414
  } | undefined;
413
- minLength?: {
415
+ maxLength?: {
414
416
  $gte?: number | undefined;
415
417
  $lte?: number | undefined;
416
418
  $lt?: number | undefined;
@@ -419,8 +421,6 @@ export declare const InputFile: z.ZodObject<{
419
421
  $ne?: number | null | undefined;
420
422
  $in?: (number | null)[] | undefined;
421
423
  } | undefined;
422
- required?: boolean | undefined;
423
- hasDefault?: boolean | undefined;
424
424
  } | undefined;
425
425
  do?: {
426
426
  set?: import("./Json.js").Json | undefined;
@@ -84,12 +84,14 @@ export declare const SchemaPropertySelectorCondition: z.ZodObject<{
84
84
  $ne?: string | null | undefined;
85
85
  $in?: (string | null)[] | undefined;
86
86
  } | undefined;
87
+ required?: boolean | undefined;
88
+ hasDefault?: boolean | undefined;
87
89
  format?: {
88
90
  $eq?: string | null | undefined;
89
91
  $ne?: string | null | undefined;
90
92
  $in?: (string | null)[] | undefined;
91
93
  } | undefined;
92
- maxLength?: {
94
+ minLength?: {
93
95
  $gte?: number | undefined;
94
96
  $lte?: number | undefined;
95
97
  $lt?: number | undefined;
@@ -98,7 +100,7 @@ export declare const SchemaPropertySelectorCondition: z.ZodObject<{
98
100
  $ne?: number | null | undefined;
99
101
  $in?: (number | null)[] | undefined;
100
102
  } | undefined;
101
- minLength?: {
103
+ maxLength?: {
102
104
  $gte?: number | undefined;
103
105
  $lte?: number | undefined;
104
106
  $lt?: number | undefined;
@@ -107,20 +109,20 @@ export declare const SchemaPropertySelectorCondition: z.ZodObject<{
107
109
  $ne?: number | null | undefined;
108
110
  $in?: (number | null)[] | undefined;
109
111
  } | undefined;
110
- required?: boolean | undefined;
111
- hasDefault?: boolean | undefined;
112
112
  }, {
113
113
  type?: {
114
114
  $eq?: string | null | undefined;
115
115
  $ne?: string | null | undefined;
116
116
  $in?: (string | null)[] | undefined;
117
117
  } | undefined;
118
+ required?: boolean | undefined;
119
+ hasDefault?: boolean | undefined;
118
120
  format?: {
119
121
  $eq?: string | null | undefined;
120
122
  $ne?: string | null | undefined;
121
123
  $in?: (string | null)[] | undefined;
122
124
  } | undefined;
123
- maxLength?: {
125
+ minLength?: {
124
126
  $gte?: number | undefined;
125
127
  $lte?: number | undefined;
126
128
  $lt?: number | undefined;
@@ -129,7 +131,7 @@ export declare const SchemaPropertySelectorCondition: z.ZodObject<{
129
131
  $ne?: number | null | undefined;
130
132
  $in?: (number | null)[] | undefined;
131
133
  } | undefined;
132
- minLength?: {
134
+ maxLength?: {
133
135
  $gte?: number | undefined;
134
136
  $lte?: number | undefined;
135
137
  $lt?: number | undefined;
@@ -138,7 +140,5 @@ export declare const SchemaPropertySelectorCondition: z.ZodObject<{
138
140
  $ne?: number | null | undefined;
139
141
  $in?: (number | null)[] | undefined;
140
142
  } | undefined;
141
- required?: boolean | undefined;
142
- hasDefault?: boolean | undefined;
143
143
  }>;
144
144
  export type SchemaPropertySelectorCondition = z.infer<typeof SchemaPropertySelectorCondition>;