@mettlecast/domain-cli 0.2.12 → 0.2.13

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.
@@ -139,7 +139,8 @@ export async function runValidate(domainRoot, exitOnFailure = true, config = { m
139
139
  message: `API '${api.id}' (${api.method} ${api.path}) has invalid method "${api.method}". Use one of: ${[...VALID_METHODS].join(', ')}.`,
140
140
  });
141
141
  }
142
- if (!api.examples?.request) {
142
+ const isVoidInput = api.requestSchema?.type === 'null';
143
+ if (!isVoidInput && !api.examples?.request) {
143
144
  errors.push({
144
145
  code: 'MISSING_API_REQUEST_EXAMPLE',
145
146
  message: `API '${api.id}' (${api.method} ${api.path}) has no request example. Add examples: { request: {...}, response: {...} } to the defineApi config.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mettlecast/domain-cli",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",
@@ -195,7 +195,8 @@ export async function runValidate(
195
195
  message: `API '${api.id}' (${api.method} ${api.path}) has invalid method "${api.method}". Use one of: ${[...VALID_METHODS].join(', ')}.`,
196
196
  });
197
197
  }
198
- if (!api.examples?.request) {
198
+ const isVoidInput = api.requestSchema?.type === 'null';
199
+ if (!isVoidInput && !api.examples?.request) {
199
200
  errors.push({
200
201
  code: 'MISSING_API_REQUEST_EXAMPLE',
201
202
  message: `API '${api.id}' (${api.method} ${api.path}) has no request example. Add examples: { request: {...}, response: {...} } to the defineApi config.`,