@minia2a/x402-check 0.1.1 → 0.1.2

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 (2) hide show
  1. package/cli.js +5 -2
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -140,8 +140,11 @@ function checkDiscovery(doc) {
140
140
  else {
141
141
  if (!input.method) add('WARN', 'no-method', 'info.input.method is missing');
142
142
  const params = input.queryParams || input.body;
143
- if (!params || (typeof params === 'object' && Object.keys(params).length === 0)) {
144
- add('WARN', 'empty-input-example', 'info.input carries no example params: the advertised call is not runnable as written');
143
+ const required = Array.isArray(input.schema && input.schema.required) ? input.schema.required : [];
144
+ if ((!params || (typeof params === 'object' && Object.keys(params).length === 0)) && required.length === 0) {
145
+ // A service that takes no input legitimately has no example params. From
146
+ // outside we cannot tell that apart from an omitted example, so say so.
147
+ add('INFO', 'no-example-params', 'info.input carries no example params (fine if the service takes no input)');
145
148
  }
146
149
  if (input.schema && Array.isArray(input.schema.required) && params && typeof params === 'object') {
147
150
  const missing = input.schema.required.filter(k => !(k in params));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minia2a/x402-check",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Inspect a live x402 endpoint before you pay it: challenge shape, door parity, EIP-712 domain, discovery examples, and the $1 client-cap trap.",
5
5
  "bin": {
6
6
  "x402-check": "cli.js"