@mettlecast/domain-cli 0.2.8 → 0.2.10
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.
|
@@ -33,7 +33,7 @@ function isZod(v) {
|
|
|
33
33
|
return v && typeof v === 'object' && typeof v.parse === 'function' && typeof v.safeParse === 'function' && v._def !== undefined;
|
|
34
34
|
}
|
|
35
35
|
function toJsonSchema(v) {
|
|
36
|
-
try { return z.toJSONSchema(v); } catch {
|
|
36
|
+
try { return z.toJSONSchema(v); } catch { return { type: 'null' }; }
|
|
37
37
|
}
|
|
38
38
|
function strip(obj) {
|
|
39
39
|
const out = {};
|
|
@@ -148,16 +148,10 @@ export async function runValidate(domainRoot, exitOnFailure = true, config = { m
|
|
|
148
148
|
return Array.isArray(examples) && examples.length > 0;
|
|
149
149
|
}
|
|
150
150
|
if (api.requestSchema && !hasExampleOrDefault(api.requestSchema)) {
|
|
151
|
-
|
|
152
|
-
code: 'MISSING_API_REQUEST_EXAMPLE',
|
|
153
|
-
message: `API '${api.id}' (${api.method} ${api.path}) request schema has no example data. Add .default({...}) to your Zod schema.`,
|
|
154
|
-
});
|
|
151
|
+
warnings.push(`API '${api.id}' (${api.method} ${api.path}) request schema has no example data. Add .default({...}) to your Zod schema.`);
|
|
155
152
|
}
|
|
156
153
|
if (api.responseSchema && !hasExampleOrDefault(api.responseSchema)) {
|
|
157
|
-
|
|
158
|
-
code: 'MISSING_API_RESPONSE_EXAMPLE',
|
|
159
|
-
message: `API '${api.id}' (${api.method} ${api.path}) response schema has no example data. Add .default({...}) to your Zod schema.`,
|
|
160
|
-
});
|
|
154
|
+
warnings.push(`API '${api.id}' (${api.method} ${api.path}) response schema has no example data. Add .default({...}) to your Zod schema.`);
|
|
161
155
|
}
|
|
162
156
|
}
|
|
163
157
|
const rawPathErrors = await checkRawPathViolations(registry.domainRoot, config);
|
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@ function isZod(v) {
|
|
|
50
50
|
return v && typeof v === 'object' && typeof v.parse === 'function' && typeof v.safeParse === 'function' && v._def !== undefined;
|
|
51
51
|
}
|
|
52
52
|
function toJsonSchema(v) {
|
|
53
|
-
try { return z.toJSONSchema(v); } catch {
|
|
53
|
+
try { return z.toJSONSchema(v); } catch { return { type: 'null' }; }
|
|
54
54
|
}
|
|
55
55
|
function strip(obj) {
|
|
56
56
|
const out = {};
|
package/src/commands/validate.ts
CHANGED
|
@@ -202,16 +202,10 @@ export async function runValidate(
|
|
|
202
202
|
return Array.isArray(examples) && examples.length > 0;
|
|
203
203
|
}
|
|
204
204
|
if (api.requestSchema && !hasExampleOrDefault(api.requestSchema)) {
|
|
205
|
-
|
|
206
|
-
code: 'MISSING_API_REQUEST_EXAMPLE',
|
|
207
|
-
message: `API '${api.id}' (${api.method} ${api.path}) request schema has no example data. Add .default({...}) to your Zod schema.`,
|
|
208
|
-
});
|
|
205
|
+
warnings.push(`API '${api.id}' (${api.method} ${api.path}) request schema has no example data. Add .default({...}) to your Zod schema.`);
|
|
209
206
|
}
|
|
210
207
|
if (api.responseSchema && !hasExampleOrDefault(api.responseSchema)) {
|
|
211
|
-
|
|
212
|
-
code: 'MISSING_API_RESPONSE_EXAMPLE',
|
|
213
|
-
message: `API '${api.id}' (${api.method} ${api.path}) response schema has no example data. Add .default({...}) to your Zod schema.`,
|
|
214
|
-
});
|
|
208
|
+
warnings.push(`API '${api.id}' (${api.method} ${api.path}) response schema has no example data. Add .default({...}) to your Zod schema.`);
|
|
215
209
|
}
|
|
216
210
|
}
|
|
217
211
|
|