@nldoc/openapi-test-set-generator 1.2.26 → 1.3.1
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/README.md +39 -0
- package/dist/commands/extract-examples.js +8 -8
- package/dist/commands/extract-examples.js.map +1 -1
- package/dist/lib/condition/schema/schemaPropertyChecker.d.ts +2 -3
- package/dist/lib/condition/schema/schemaPropertyChecker.js +8 -1
- package/dist/lib/condition/schema/schemaPropertyChecker.js.map +1 -1
- package/dist/lib/condition/schemaPropertySelector.d.ts +7 -8
- package/dist/lib/condition/schemaPropertySelector.js +31 -7
- package/dist/lib/condition/schemaPropertySelector.js.map +1 -1
- package/dist/lib/isJsonObject.d.ts +2 -0
- package/dist/lib/isJsonObject.js +4 -0
- package/dist/lib/isJsonObject.js.map +1 -0
- package/dist/lib/modification/createExampleVariantsFromSchemaOnQueries.d.ts +5 -5
- package/dist/lib/modification/createExampleVariantsFromSchemaOnQueries.js +3 -1
- package/dist/lib/modification/createExampleVariantsFromSchemaOnQueries.js.map +1 -1
- package/dist/lib/modification/createExampleVariantsFromSchemaOnQuery.d.ts +6 -5
- package/dist/lib/modification/createExampleVariantsFromSchemaOnQuery.js +3 -0
- package/dist/lib/modification/createExampleVariantsFromSchemaOnQuery.js.map +1 -1
- package/dist/lib/modification/createExampleVariantsFromSchemasOnQueries.d.ts +5 -5
- package/dist/lib/modification/createExampleVariantsFromSchemasOnQueries.js +5 -5
- package/dist/lib/modification/createExampleVariantsFromSchemasOnQueries.js.map +1 -1
- package/dist/lib/modification/modifyPropertyInExample.d.ts +8 -7
- package/dist/lib/modification/modifyPropertyInExample.js +33 -15
- package/dist/lib/modification/modifyPropertyInExample.js.map +1 -1
- package/dist/lib/modification/modifyPropertyInSchemaExamples.d.ts +7 -10
- package/dist/lib/modification/modifyPropertyInSchemaExamples.js +35 -13
- package/dist/lib/modification/modifyPropertyInSchemaExamples.js.map +1 -1
- package/dist/lib/openapi/PropertyResolver.d.ts +2 -2
- package/dist/lib/openapi/PropertyResolver.js.map +1 -1
- package/dist/lib/openapi/SchemaPropertyResolver.d.ts +32 -9
- package/dist/lib/openapi/SchemaPropertyResolver.js +71 -17
- package/dist/lib/openapi/SchemaPropertyResolver.js.map +1 -1
- package/dist/lib/openapi/extractSchemaObjectsWithExamples.d.ts +6 -0
- package/dist/lib/openapi/extractSchemaObjectsWithExamples.js +10 -0
- package/dist/lib/openapi/extractSchemaObjectsWithExamples.js.map +1 -0
- package/dist/lib/openapi/isReferenceObject.d.ts +2 -0
- package/dist/lib/openapi/isReferenceObject.js +4 -0
- package/dist/lib/openapi/isReferenceObject.js.map +1 -0
- package/dist/lib/openapi/isSchemaObject.d.ts +2 -0
- package/dist/lib/openapi/isSchemaObject.js +4 -0
- package/dist/lib/openapi/isSchemaObject.js.map +1 -0
- package/dist/lib/openapi/isSchemaObjectWithExamples.d.ts +4 -0
- package/dist/lib/openapi/isSchemaObjectWithExamples.js +8 -0
- package/dist/lib/openapi/isSchemaObjectWithExamples.js.map +1 -0
- package/dist/lib/openapi/isSchemaObjectWithProperties.d.ts +4 -0
- package/dist/lib/openapi/isSchemaObjectWithProperties.js +9 -0
- package/dist/lib/openapi/isSchemaObjectWithProperties.js.map +1 -0
- package/dist/types/InputFile.d.ts +32 -32
- package/dist/types/condition/SchemaPropertySelectorCondition.d.ts +8 -8
- package/dist/types/modification/SchemaPropertyVariantQuery.d.ts +16 -16
- package/dist/types/openapi/HasExamples.d.ts +4 -0
- package/dist/types/openapi/HasExamples.js +2 -0
- package/dist/types/openapi/HasExamples.js.map +1 -0
- package/package.json +1 -1
- package/dist/lib/openapi/extractObjectSchemasWithExamples.d.ts +0 -8
- package/dist/lib/openapi/extractObjectSchemasWithExamples.js +0 -16
- package/dist/lib/openapi/extractObjectSchemasWithExamples.js.map +0 -1
- package/dist/types/openapi/HasObjectExamples.d.ts +0 -4
- package/dist/types/openapi/HasObjectExamples.js +0 -2
- package/dist/types/openapi/HasObjectExamples.js.map +0 -1
- package/dist/types/openapi/HasResolvedProperties.d.ts +0 -4
- package/dist/types/openapi/HasResolvedProperties.js +0 -2
- package/dist/types/openapi/HasResolvedProperties.js.map +0 -1
@@ -85,12 +85,14 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
85
85
|
$ne?: string | null | undefined;
|
86
86
|
$in?: (string | null)[] | undefined;
|
87
87
|
} | undefined;
|
88
|
+
required?: boolean | undefined;
|
89
|
+
hasDefault?: boolean | undefined;
|
88
90
|
format?: {
|
89
91
|
$eq?: string | null | undefined;
|
90
92
|
$ne?: string | null | undefined;
|
91
93
|
$in?: (string | null)[] | undefined;
|
92
94
|
} | undefined;
|
93
|
-
|
95
|
+
minLength?: {
|
94
96
|
$gte?: number | undefined;
|
95
97
|
$lte?: number | undefined;
|
96
98
|
$lt?: number | undefined;
|
@@ -99,7 +101,7 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
99
101
|
$ne?: number | null | undefined;
|
100
102
|
$in?: (number | null)[] | undefined;
|
101
103
|
} | undefined;
|
102
|
-
|
104
|
+
maxLength?: {
|
103
105
|
$gte?: number | undefined;
|
104
106
|
$lte?: number | undefined;
|
105
107
|
$lt?: number | undefined;
|
@@ -108,20 +110,20 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
108
110
|
$ne?: number | null | undefined;
|
109
111
|
$in?: (number | null)[] | undefined;
|
110
112
|
} | undefined;
|
111
|
-
required?: boolean | undefined;
|
112
|
-
hasDefault?: boolean | undefined;
|
113
113
|
}, {
|
114
114
|
type?: {
|
115
115
|
$eq?: string | null | undefined;
|
116
116
|
$ne?: string | null | undefined;
|
117
117
|
$in?: (string | null)[] | undefined;
|
118
118
|
} | undefined;
|
119
|
+
required?: boolean | undefined;
|
120
|
+
hasDefault?: boolean | undefined;
|
119
121
|
format?: {
|
120
122
|
$eq?: string | null | undefined;
|
121
123
|
$ne?: string | null | undefined;
|
122
124
|
$in?: (string | null)[] | undefined;
|
123
125
|
} | undefined;
|
124
|
-
|
126
|
+
minLength?: {
|
125
127
|
$gte?: number | undefined;
|
126
128
|
$lte?: number | undefined;
|
127
129
|
$lt?: number | undefined;
|
@@ -130,7 +132,7 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
130
132
|
$ne?: number | null | undefined;
|
131
133
|
$in?: (number | null)[] | undefined;
|
132
134
|
} | undefined;
|
133
|
-
|
135
|
+
maxLength?: {
|
134
136
|
$gte?: number | undefined;
|
135
137
|
$lte?: number | undefined;
|
136
138
|
$lt?: number | undefined;
|
@@ -139,8 +141,6 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
139
141
|
$ne?: number | null | undefined;
|
140
142
|
$in?: (number | null)[] | undefined;
|
141
143
|
} | undefined;
|
142
|
-
required?: boolean | undefined;
|
143
|
-
hasDefault?: boolean | undefined;
|
144
144
|
}>>;
|
145
145
|
do: z.ZodDefault<z.ZodObject<{
|
146
146
|
set: z.ZodOptional<z.ZodType<import("../Json.js").Json, z.ZodTypeDef, import("../Json.js").Json>>;
|
@@ -161,12 +161,14 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
161
161
|
$ne?: string | null | undefined;
|
162
162
|
$in?: (string | null)[] | undefined;
|
163
163
|
} | undefined;
|
164
|
+
required?: boolean | undefined;
|
165
|
+
hasDefault?: boolean | undefined;
|
164
166
|
format?: {
|
165
167
|
$eq?: string | null | undefined;
|
166
168
|
$ne?: string | null | undefined;
|
167
169
|
$in?: (string | null)[] | undefined;
|
168
170
|
} | undefined;
|
169
|
-
|
171
|
+
minLength?: {
|
170
172
|
$gte?: number | undefined;
|
171
173
|
$lte?: number | undefined;
|
172
174
|
$lt?: number | undefined;
|
@@ -175,7 +177,7 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
175
177
|
$ne?: number | null | undefined;
|
176
178
|
$in?: (number | null)[] | undefined;
|
177
179
|
} | undefined;
|
178
|
-
|
180
|
+
maxLength?: {
|
179
181
|
$gte?: number | undefined;
|
180
182
|
$lte?: number | undefined;
|
181
183
|
$lt?: number | undefined;
|
@@ -184,8 +186,6 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
184
186
|
$ne?: number | null | undefined;
|
185
187
|
$in?: (number | null)[] | undefined;
|
186
188
|
} | undefined;
|
187
|
-
required?: boolean | undefined;
|
188
|
-
hasDefault?: boolean | undefined;
|
189
189
|
};
|
190
190
|
do: {
|
191
191
|
set?: import("../Json.js").Json | undefined;
|
@@ -199,12 +199,14 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
199
199
|
$ne?: string | null | undefined;
|
200
200
|
$in?: (string | null)[] | undefined;
|
201
201
|
} | undefined;
|
202
|
+
required?: boolean | undefined;
|
203
|
+
hasDefault?: boolean | undefined;
|
202
204
|
format?: {
|
203
205
|
$eq?: string | null | undefined;
|
204
206
|
$ne?: string | null | undefined;
|
205
207
|
$in?: (string | null)[] | undefined;
|
206
208
|
} | undefined;
|
207
|
-
|
209
|
+
minLength?: {
|
208
210
|
$gte?: number | undefined;
|
209
211
|
$lte?: number | undefined;
|
210
212
|
$lt?: number | undefined;
|
@@ -213,7 +215,7 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
213
215
|
$ne?: number | null | undefined;
|
214
216
|
$in?: (number | null)[] | undefined;
|
215
217
|
} | undefined;
|
216
|
-
|
218
|
+
maxLength?: {
|
217
219
|
$gte?: number | undefined;
|
218
220
|
$lte?: number | undefined;
|
219
221
|
$lt?: number | undefined;
|
@@ -222,8 +224,6 @@ export declare const SchemaPropertyVariantQuery: z.ZodObject<{
|
|
222
224
|
$ne?: number | null | undefined;
|
223
225
|
$in?: (number | null)[] | undefined;
|
224
226
|
} | undefined;
|
225
|
-
required?: boolean | undefined;
|
226
|
-
hasDefault?: boolean | undefined;
|
227
227
|
} | undefined;
|
228
228
|
do?: {
|
229
229
|
set?: import("../Json.js").Json | undefined;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"HasExamples.js","sourceRoot":"","sources":["../../../src/types/openapi/HasExamples.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
@@ -1,8 +0,0 @@
|
|
1
|
-
import { type OpenAPIObject, type SchemaObject } from 'openapi3-ts/oas31.js';
|
2
|
-
import { type HasObjectExamples } from '../../types/openapi/HasObjectExamples.js';
|
3
|
-
type SchemaWithExamples = SchemaObject & HasObjectExamples;
|
4
|
-
export declare function extractObjectSchemasWithExamples(openApi: OpenAPIObject): Promise<{
|
5
|
-
key: string;
|
6
|
-
schema: SchemaWithExamples;
|
7
|
-
}[]>;
|
8
|
-
export {};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { JsonObject } from '../../types/Json.js';
|
2
|
-
import { z } from 'zod';
|
3
|
-
const isSchemaObjectWithExamples = (schema) => 'examples' in schema[1] && (schema[1].examples?.length ?? 0) > 0 && schema[1].type === 'object';
|
4
|
-
export async function extractObjectSchemasWithExamples(openApi) {
|
5
|
-
const promisedSchemas = Object.entries(openApi.components?.schemas ?? {})
|
6
|
-
.filter(isSchemaObjectWithExamples)
|
7
|
-
.map((schema) => z
|
8
|
-
.array(JsonObject)
|
9
|
-
.parseAsync(schema[1].examples)
|
10
|
-
.then((examples) => ({
|
11
|
-
key: schema[0],
|
12
|
-
schema: { ...schema[1], examples: examples },
|
13
|
-
})));
|
14
|
-
return Promise.all(promisedSchemas);
|
15
|
-
}
|
16
|
-
//# sourceMappingURL=extractObjectSchemasWithExamples.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"extractObjectSchemasWithExamples.js","sourceRoot":"","sources":["../../../src/lib/openapi/extractObjectSchemasWithExamples.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,MAAM,0BAA0B,GAAG,CAC/B,MAAgD,EAChB,EAAE,CAClC,UAAU,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAA;AAEnG,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAClD,OAAsB;IAEtB,MAAM,eAAe,GAA2D,MAAM,CAAC,OAAO,CAC1F,OAAO,CAAC,UAAU,EAAE,OAAO,IAAI,EAAE,CACpC;SACI,MAAM,CAAC,0BAA0B,CAAC;SAClC,GAAG,CACA,CAAC,MAAM,EAAwD,EAAE,CAC7D,CAAC;SACI,KAAK,CAAC,UAAU,CAAC;SACjB,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;SAC9B,IAAI,CAAC,CAAC,QAAsB,EAAE,EAAE,CAAC,CAAC;QAC/B,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;QACd,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE;KAC/C,CAAC,CAAC,CACd,CAAA;IAEL,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;AACvC,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"HasObjectExamples.js","sourceRoot":"","sources":["../../../src/types/openapi/HasObjectExamples.ts"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"HasResolvedProperties.js","sourceRoot":"","sources":["../../../src/types/openapi/HasResolvedProperties.ts"],"names":[],"mappings":""}
|