@stdy/cli 0.15.2 → 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.
- package/README.md +65 -20
- 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,14 +66,18 @@ 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
|
-
--
|
|
63
|
-
--
|
|
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:
|
|
67
76
|
--validator-strict-oneof Require exactly one oneOf variant to match
|
|
68
77
|
--validator-query-array-format=<fmt> Array query param serialization (see below)
|
|
69
78
|
--validator-query-object-format=<fmt> Object query param serialization (see below)
|
|
79
|
+
--validator-form-array-format=<fmt> Array form field serialization (see below)
|
|
80
|
+
--validator-form-object-format=<fmt> Object form field serialization (see below)
|
|
70
81
|
|
|
71
82
|
Generator Options:
|
|
72
83
|
--generator-array-size=<n> Exact size for all generated arrays
|
|
@@ -103,6 +114,32 @@ per-request via headers.
|
|
|
103
114
|
| `brackets` | `id[role]=admin&id[firstName]=Alex` | `style=deepObject` |
|
|
104
115
|
| `dots` | `id.role=admin&id.firstName=Alex` | Non-standard (SDK compat) |
|
|
105
116
|
|
|
117
|
+
### Form Parameter Serialization
|
|
118
|
+
|
|
119
|
+
Form body parameters (application/x-www-form-urlencoded) use the same formats as
|
|
120
|
+
query parameters. Configure via CLI flags or per-request headers.
|
|
121
|
+
|
|
122
|
+
**Array formats** (`--validator-form-array-format`):
|
|
123
|
+
|
|
124
|
+
| Format | Example | OpenAPI Equivalent |
|
|
125
|
+
| ---------- | ------------------------ | ------------------------------ |
|
|
126
|
+
| `auto` | Read from spec (default) | - |
|
|
127
|
+
| `repeat` | `tags=a&tags=b` | `style=form, explode=true` |
|
|
128
|
+
| `comma` | `tags=a,b` | `style=form, explode=false` |
|
|
129
|
+
| `space` | `tags=a%20b` | `style=spaceDelimited` |
|
|
130
|
+
| `pipe` | `tags=a\|b` | `style=pipeDelimited` |
|
|
131
|
+
| `brackets` | `tags[]=a&tags[]=b` | PHP/Rails style (non-standard) |
|
|
132
|
+
|
|
133
|
+
**Object formats** (`--validator-form-object-format`):
|
|
134
|
+
|
|
135
|
+
| Format | Example | OpenAPI Equivalent |
|
|
136
|
+
| ------------ | ------------------------------ | --------------------------- |
|
|
137
|
+
| `auto` | Read from spec (default) | - |
|
|
138
|
+
| `flat` | `name=sam&age=30` | `style=form, explode=true` |
|
|
139
|
+
| `flat-comma` | `id=role,admin,firstName,Alex` | `style=form, explode=false` |
|
|
140
|
+
| `brackets` | `user[name]=sam` | `style=deepObject` |
|
|
141
|
+
| `dots` | `user.name=sam` | Non-standard (SDK compat) |
|
|
142
|
+
|
|
106
143
|
### Port Configuration
|
|
107
144
|
|
|
108
145
|
The server port is determined in this order:
|
|
@@ -150,7 +187,7 @@ responses:
|
|
|
150
187
|
|
|
151
188
|
## Request Validation
|
|
152
189
|
|
|
153
|
-
|
|
190
|
+
Requests are validated against:
|
|
154
191
|
|
|
155
192
|
- **Path parameters** - type coercion and schema validation
|
|
156
193
|
- **Query parameters** - required check, type validation
|
|
@@ -158,8 +195,9 @@ In `--strict` mode (default), requests are validated against:
|
|
|
158
195
|
- **Cookies** - required cookies, schema validation
|
|
159
196
|
- **Request body** - JSON Schema validation, content-type check
|
|
160
197
|
|
|
161
|
-
|
|
162
|
-
|
|
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.
|
|
163
201
|
|
|
164
202
|
### Request Headers
|
|
165
203
|
|
|
@@ -167,9 +205,11 @@ Override server behavior for individual requests:
|
|
|
167
205
|
|
|
168
206
|
| Header | Description |
|
|
169
207
|
| ------------------------------ | ---------------------------------------------------- |
|
|
170
|
-
| `X-Steady-
|
|
208
|
+
| `X-Steady-Reject-On-Error` | `true` to return 400 for SDK issues on this request |
|
|
171
209
|
| `X-Steady-Query-Array-Format` | Override array query param serialization format |
|
|
172
210
|
| `X-Steady-Query-Object-Format` | Override object query param serialization format |
|
|
211
|
+
| `X-Steady-Form-Array-Format` | Override array form field serialization format |
|
|
212
|
+
| `X-Steady-Form-Object-Format` | Override object form field serialization format |
|
|
173
213
|
| `X-Steady-Array-Size` | Override array size (sets both min and max) |
|
|
174
214
|
| `X-Steady-Array-Min` | Override minimum array size |
|
|
175
215
|
| `X-Steady-Array-Max` | Override maximum array size |
|
|
@@ -178,8 +218,8 @@ Override server behavior for individual requests:
|
|
|
178
218
|
| `X-Steady-Stream-Interval-Ms` | Interval between streamed items in ms (default: 100) |
|
|
179
219
|
|
|
180
220
|
```bash
|
|
181
|
-
#
|
|
182
|
-
curl -H "X-Steady-
|
|
221
|
+
# Reject SDK issues for this request
|
|
222
|
+
curl -H "X-Steady-Reject-On-Error: true" http://localhost:3000/users
|
|
183
223
|
|
|
184
224
|
# Request 50 items in arrays
|
|
185
225
|
curl -H "X-Steady-Array-Size: 50" http://localhost:3000/users
|
|
@@ -197,7 +237,8 @@ Informational headers returned by the server:
|
|
|
197
237
|
|
|
198
238
|
| Header | Description |
|
|
199
239
|
| ------------------------- | ----------------------------------------------------- |
|
|
200
|
-
| `X-Steady-
|
|
240
|
+
| `X-Steady-Valid` | Whether the request passed SDK validation |
|
|
241
|
+
| `X-Steady-Error-Count` | Number of diagnostic issues found |
|
|
201
242
|
| `X-Steady-Matched-Path` | The OpenAPI path pattern that matched |
|
|
202
243
|
| `X-Steady-Example-Source` | How the response was generated: `generated` or `none` |
|
|
203
244
|
| `X-Steady-Streaming` | Set to `true` for streaming responses |
|
|
@@ -356,22 +397,26 @@ Supports JSON Schema draft 2020-12 with ~91% compliance.
|
|
|
356
397
|
- `$dynamicRef` / `$dynamicAnchor`
|
|
357
398
|
- External `$ref` (http://, file://)
|
|
358
399
|
|
|
359
|
-
##
|
|
400
|
+
## Diagnostics
|
|
360
401
|
|
|
361
|
-
|
|
402
|
+
Steady attributes every validation issue to a responsible party — SDK, spec, or
|
|
403
|
+
ambiguous — using compiler-style output:
|
|
362
404
|
|
|
363
405
|
```
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
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
|
|
373
415
|
```
|
|
374
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
|
+
|
|
375
420
|
## Development
|
|
376
421
|
|
|
377
422
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdy/cli",
|
|
3
|
-
"version": "0.
|
|
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.
|
|
33
|
-
"@stdy/cli-linux-arm64": "0.
|
|
34
|
-
"@stdy/cli-darwin-x64": "0.
|
|
35
|
-
"@stdy/cli-darwin-arm64": "0.
|
|
36
|
-
"@stdy/cli-win32-x64": "0.
|
|
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
|
}
|