@stdy/cli 0.15.3 → 0.16.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 (2) hide show
  1. package/README.md +35 -20
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -36,6 +36,12 @@ steady api.yaml
36
36
  # Validate spec without starting server
37
37
  steady validate api.yaml
38
38
 
39
+ # Explain a diagnostic code
40
+ steady explain E3008
41
+
42
+ # List all diagnostic codes
43
+ steady explain
44
+
39
45
  # Watch for spec changes
40
46
  steady -r api.yaml
41
47
 
@@ -50,6 +56,7 @@ steady [command] [options] <spec-file>
50
56
 
51
57
  Commands:
52
58
  validate <spec> Validate an OpenAPI spec (doesn't start server)
59
+ explain [code...] Explain diagnostic codes (e.g., steady explain E3008)
53
60
  <spec> Start mock server (default)
54
61
 
55
62
  Options:
@@ -59,8 +66,10 @@ Options:
59
66
  --log-level <level> summary | details | full (default: summary)
60
67
  --log-bodies Show request/response bodies
61
68
  --log=false Disable request logging
62
- --strict Reject invalid requests (default)
63
- --relaxed Log warnings but return responses anyway
69
+ --reject-on-sdk-error Return 400 for SDK issues instead of mock response
70
+ --fail-on-ambiguous Exit 1 if any ambiguous diagnostics found (CI mode)
71
+ --fail-on-warnings Exit 1 if any warning-level diagnostics found (CI mode)
72
+ --no-color Disable colored output (also respects NO_COLOR env)
64
73
  -h, --help Show help
65
74
 
66
75
  Validator Options:
@@ -178,7 +187,7 @@ responses:
178
187
 
179
188
  ## Request Validation
180
189
 
181
- In `--strict` mode (default), requests are validated against:
190
+ Requests are validated against:
182
191
 
183
192
  - **Path parameters** - type coercion and schema validation
184
193
  - **Query parameters** - required check, type validation
@@ -186,8 +195,9 @@ In `--strict` mode (default), requests are validated against:
186
195
  - **Cookies** - required cookies, schema validation
187
196
  - **Request body** - JSON Schema validation, content-type check
188
197
 
189
- Invalid requests return 400 with validation errors. In `--relaxed` mode,
190
- validation errors are logged but responses are still returned.
198
+ By default, validation issues are reported in `X-Steady-*` response headers
199
+ while still returning mock responses. Use `--reject-on-sdk-error` to return 400
200
+ for SDK issues (structural validation failures) instead.
191
201
 
192
202
  ### Request Headers
193
203
 
@@ -195,7 +205,7 @@ Override server behavior for individual requests:
195
205
 
196
206
  | Header | Description |
197
207
  | ------------------------------ | ---------------------------------------------------- |
198
- | `X-Steady-Mode` | Override validation mode: `strict` or `relaxed` |
208
+ | `X-Steady-Reject-On-Error` | `true` to return 400 for SDK issues on this request |
199
209
  | `X-Steady-Query-Array-Format` | Override array query param serialization format |
200
210
  | `X-Steady-Query-Object-Format` | Override object query param serialization format |
201
211
  | `X-Steady-Form-Array-Format` | Override array form field serialization format |
@@ -208,8 +218,8 @@ Override server behavior for individual requests:
208
218
  | `X-Steady-Stream-Interval-Ms` | Interval between streamed items in ms (default: 100) |
209
219
 
210
220
  ```bash
211
- # Force strict validation
212
- curl -H "X-Steady-Mode: strict" http://localhost:3000/users
221
+ # Reject SDK issues for this request
222
+ curl -H "X-Steady-Reject-On-Error: true" http://localhost:3000/users
213
223
 
214
224
  # Request 50 items in arrays
215
225
  curl -H "X-Steady-Array-Size: 50" http://localhost:3000/users
@@ -227,7 +237,8 @@ Informational headers returned by the server:
227
237
 
228
238
  | Header | Description |
229
239
  | ------------------------- | ----------------------------------------------------- |
230
- | `X-Steady-Mode` | The validation mode used for this request |
240
+ | `X-Steady-Valid` | Whether the request passed SDK validation |
241
+ | `X-Steady-Error-Count` | Number of diagnostic issues found |
231
242
  | `X-Steady-Matched-Path` | The OpenAPI path pattern that matched |
232
243
  | `X-Steady-Example-Source` | How the response was generated: `generated` or `none` |
233
244
  | `X-Steady-Streaming` | Set to `true` for streaming responses |
@@ -386,22 +397,26 @@ Supports JSON Schema draft 2020-12 with ~91% compliance.
386
397
  - `$dynamicRef` / `$dynamicAnchor`
387
398
  - External `$ref` (http://, file://)
388
399
 
389
- ## Error Attribution
400
+ ## Diagnostics
390
401
 
391
- Errors indicate whether the issue is likely in the spec or the client request:
402
+ Steady attributes every validation issue to a responsible party — SDK, spec, or
403
+ ambiguous — using compiler-style output:
392
404
 
393
405
  ```
394
- POST /users 400 Bad Request
395
-
396
- Validation errors:
397
- 1. Required parameter missing
398
- Path: query.limit
399
- Expected: integer
400
-
401
- Attribution: SDK issue (high confidence)
402
- Suggestion: Check SDK implementation - required parameter not sent
406
+ error[E3002]: Missing required query parameter
407
+ --> GET /users
408
+ |
409
+ | Required parameter 'limit' not found in query string
410
+ |
411
+ = expected: query parameter 'limit' (type: integer)
412
+ = Add the required parameter to the request
413
+
414
+ For details, try: steady explain E3002
403
415
  ```
404
416
 
417
+ Use `steady explain <code>` for detailed documentation on any diagnostic code,
418
+ including what it means, why it's categorized that way, and what to do about it.
419
+
405
420
  ## Development
406
421
 
407
422
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdy/cli",
3
- "version": "0.15.3",
3
+ "version": "0.16.0",
4
4
  "description": "OpenAPI 3 mock server. Validates SDKs against OpenAPI specs with clear error attribution.",
5
5
  "license": "Elastic-2.0",
6
6
  "repository": {
@@ -29,10 +29,10 @@
29
29
  "node": ">=14.0.0"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@stdy/cli-linux-x64": "0.15.3",
33
- "@stdy/cli-linux-arm64": "0.15.3",
34
- "@stdy/cli-darwin-x64": "0.15.3",
35
- "@stdy/cli-darwin-arm64": "0.15.3",
36
- "@stdy/cli-win32-x64": "0.15.3"
32
+ "@stdy/cli-linux-x64": "0.16.0",
33
+ "@stdy/cli-linux-arm64": "0.16.0",
34
+ "@stdy/cli-darwin-x64": "0.16.0",
35
+ "@stdy/cli-darwin-arm64": "0.16.0",
36
+ "@stdy/cli-win32-x64": "0.16.0"
37
37
  }
38
38
  }