@techspokes/typescript-wsdl-client 0.10.0 → 0.10.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.
- package/README.md +66 -2253
- package/docs/AGENTS.md +47 -0
- package/docs/README.md +35 -0
- package/docs/api-reference.md +223 -0
- package/docs/architecture.md +115 -0
- package/docs/cli-reference.md +518 -0
- package/docs/concepts.md +212 -0
- package/docs/configuration.md +74 -0
- package/docs/gateway-guide.md +124 -0
- package/docs/generated-code.md +74 -0
- package/docs/migration.md +107 -0
- package/docs/production.md +80 -0
- package/docs/troubleshooting.md +70 -0
- package/llms.txt +53 -0
- package/package.json +14 -7
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
# CLI Reference
|
|
2
|
+
|
|
3
|
+
The `wsdl-tsc` tool generates TypeScript SOAP clients, OpenAPI specifications, and Fastify gateways from WSDL files.
|
|
4
|
+
|
|
5
|
+
## Commands Overview
|
|
6
|
+
|
|
7
|
+
The tool provides six commands for different integration scenarios.
|
|
8
|
+
|
|
9
|
+
| Command | Purpose | Typical Use Case |
|
|
10
|
+
|---------|---------|------------------|
|
|
11
|
+
| pipeline | Full pipeline: client + OpenAPI + gateway + app | CI/CD automation, complete stack generation |
|
|
12
|
+
| client | TypeScript SOAP client from WSDL or catalog | Standard SOAP integration |
|
|
13
|
+
| openapi | OpenAPI 3.1 spec from WSDL or catalog | Documentation, REST proxies, API gateways |
|
|
14
|
+
| gateway | Fastify gateway from OpenAPI spec | Production REST gateway with SOAP backend |
|
|
15
|
+
| app | Runnable Fastify app from client + gateway + OpenAPI | Local testing, demos |
|
|
16
|
+
| compile | Parse WSDL to catalog.json only | Debugging, multi-stage builds |
|
|
17
|
+
|
|
18
|
+
## pipeline
|
|
19
|
+
|
|
20
|
+
Run the complete generation pipeline in one pass: WSDL parsing, TypeScript client, OpenAPI spec, Fastify gateway, and optional app. This is the recommended command for most use cases.
|
|
21
|
+
|
|
22
|
+
### Usage
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx wsdl-tsc pipeline \
|
|
26
|
+
--wsdl-source <file|url> \
|
|
27
|
+
[--catalog-file <path>] \
|
|
28
|
+
[--client-dir <path>] \
|
|
29
|
+
[--openapi-file <path>] \
|
|
30
|
+
[--gateway-dir <path>] \
|
|
31
|
+
[options]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Required Flags
|
|
35
|
+
|
|
36
|
+
| Flag | Description |
|
|
37
|
+
|------|-------------|
|
|
38
|
+
| `--wsdl-source` | Path or URL to WSDL file |
|
|
39
|
+
|
|
40
|
+
At least one of `--client-dir`, `--openapi-file`, or `--gateway-dir` must be provided.
|
|
41
|
+
|
|
42
|
+
### Output Flags
|
|
43
|
+
|
|
44
|
+
| Flag | Default | Description |
|
|
45
|
+
|------|---------|-------------|
|
|
46
|
+
| `--catalog-file` | Co-located with first output | Output path for catalog.json |
|
|
47
|
+
|
|
48
|
+
The catalog is auto-placed alongside the first available output directory: `{client-dir}`, `{openapi-file-dir}`, or `{gateway-dir}`.
|
|
49
|
+
|
|
50
|
+
### Generation Control Flags
|
|
51
|
+
|
|
52
|
+
| Flag | Description |
|
|
53
|
+
|------|-------------|
|
|
54
|
+
| `--client-dir` | Generate TypeScript client in this directory |
|
|
55
|
+
| `--openapi-file` | Generate OpenAPI spec at this path |
|
|
56
|
+
| `--gateway-dir` | Generate Fastify gateway in this directory |
|
|
57
|
+
| `--generate-app` | Generate runnable app (requires gateway) |
|
|
58
|
+
|
|
59
|
+
### Client Flags
|
|
60
|
+
|
|
61
|
+
| Flag | Default | Description |
|
|
62
|
+
|------|---------|-------------|
|
|
63
|
+
| `--import-extensions` | `js` | Import style: js, ts, or bare |
|
|
64
|
+
| `--client-attributes-key` | `$attributes` | Attribute bag key |
|
|
65
|
+
| `--client-class-name` | (derived) | Override client class name |
|
|
66
|
+
| `--client-int64-as` | `string` | Map 64-bit integers |
|
|
67
|
+
| `--client-bigint-as` | `string` | Map arbitrary-size integers |
|
|
68
|
+
| `--client-decimal-as` | `string` | Map xs:decimal |
|
|
69
|
+
| `--client-date-as` | `string` | Map date/time types |
|
|
70
|
+
| `--client-choice-mode` | `all-optional` | Choice element strategy |
|
|
71
|
+
| `--client-fail-on-unresolved` | `false` | Fail on unresolved references |
|
|
72
|
+
| `--client-nillable-as-optional` | `false` | Treat nillable as optional |
|
|
73
|
+
|
|
74
|
+
### OpenAPI Flags
|
|
75
|
+
|
|
76
|
+
| Flag | Default | Description |
|
|
77
|
+
|------|---------|-------------|
|
|
78
|
+
| `--openapi-format` | `json` | Output format: json, yaml, or both |
|
|
79
|
+
| `--openapi-title` | (derived) | API title |
|
|
80
|
+
| `--openapi-version` | `0.0.0` | API version |
|
|
81
|
+
| `--openapi-description` | (empty) | API description |
|
|
82
|
+
| `--openapi-servers` | `/` | Comma-separated server URLs |
|
|
83
|
+
| `--openapi-base-path` | (empty) | Base path prefix |
|
|
84
|
+
| `--openapi-path-style` | `kebab` | Path transform: kebab, asis, or lower |
|
|
85
|
+
| `--openapi-method` | `post` | Default HTTP method |
|
|
86
|
+
| `--openapi-tag-style` | `default` | Tag inference: default, service, or first |
|
|
87
|
+
| `--openapi-closed-schemas` | `false` | Add additionalProperties: false |
|
|
88
|
+
| `--openapi-prune-unused-schemas` | `false` | Emit only referenced schemas |
|
|
89
|
+
| `--openapi-envelope-namespace` | `ResponseEnvelope` | Envelope component name suffix |
|
|
90
|
+
| `--openapi-error-namespace` | `ErrorObject` | Error object name suffix |
|
|
91
|
+
| `--openapi-validate` | `true` | Validate spec with swagger-parser |
|
|
92
|
+
| `--openapi-security-config-file` | | Path to security.json |
|
|
93
|
+
| `--openapi-tags-file` | | Path to tags.json |
|
|
94
|
+
| `--openapi-ops-file` | | Path to ops.json |
|
|
95
|
+
|
|
96
|
+
### Gateway Flags
|
|
97
|
+
|
|
98
|
+
| Flag | Default | Description |
|
|
99
|
+
|------|---------|-------------|
|
|
100
|
+
| `--gateway-service-name` | (required if --gateway-dir) | Service identifier for URN |
|
|
101
|
+
| `--gateway-version-prefix` | (required if --gateway-dir) | Version prefix for URN |
|
|
102
|
+
| `--gateway-default-status-codes` | 200,400,401,403,404,409,422,429,500,502,503,504 | Status codes to backfill |
|
|
103
|
+
| `--gateway-stub-handlers` | `false` | Generate stubs instead of full handlers |
|
|
104
|
+
| `--gateway-client-class-name` | (auto-detected) | Override SOAP client class name |
|
|
105
|
+
| `--gateway-decorator-name` | {serviceSlug}Client | Fastify decorator name |
|
|
106
|
+
| `--gateway-skip-plugin` | `false` | Skip plugin.ts generation |
|
|
107
|
+
| `--gateway-skip-runtime` | `false` | Skip runtime.ts generation |
|
|
108
|
+
|
|
109
|
+
### Pipeline Workflow
|
|
110
|
+
|
|
111
|
+
Steps execute in order:
|
|
112
|
+
|
|
113
|
+
1. Parse WSDL and validate
|
|
114
|
+
2. Compile catalog (intermediate representation)
|
|
115
|
+
3. Write catalog.json (always)
|
|
116
|
+
4. Generate client (if --client-dir)
|
|
117
|
+
5. Generate OpenAPI (if --openapi-file)
|
|
118
|
+
6. Generate gateway (if --gateway-dir)
|
|
119
|
+
7. Generate app (if --generate-app)
|
|
120
|
+
|
|
121
|
+
All steps share the same parsed WSDL and compiled catalog.
|
|
122
|
+
|
|
123
|
+
### Examples
|
|
124
|
+
|
|
125
|
+
Complete stack:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npx wsdl-tsc pipeline \
|
|
129
|
+
--wsdl-source examples/minimal/weather.wsdl \
|
|
130
|
+
--client-dir tmp/client \
|
|
131
|
+
--openapi-file tmp/openapi.json \
|
|
132
|
+
--gateway-dir tmp/gateway \
|
|
133
|
+
--gateway-service-name weather \
|
|
134
|
+
--gateway-version-prefix v1
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
With app generation:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
npx wsdl-tsc pipeline \
|
|
141
|
+
--wsdl-source examples/minimal/weather.wsdl \
|
|
142
|
+
--client-dir tmp/client \
|
|
143
|
+
--openapi-file tmp/openapi.json \
|
|
144
|
+
--gateway-dir tmp/gateway \
|
|
145
|
+
--gateway-service-name weather \
|
|
146
|
+
--gateway-version-prefix v1 \
|
|
147
|
+
--generate-app
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Client and OpenAPI only:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npx wsdl-tsc pipeline \
|
|
154
|
+
--wsdl-source https://example.com/Hotel.wsdl \
|
|
155
|
+
--client-dir ./build/client \
|
|
156
|
+
--openapi-file ./docs/hotel-api.json \
|
|
157
|
+
--openapi-format both
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## client
|
|
161
|
+
|
|
162
|
+
Generate strongly-typed TypeScript SOAP client code from WSDL or a pre-compiled catalog.
|
|
163
|
+
|
|
164
|
+
### Usage
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
npx wsdl-tsc client --wsdl-source <file|url> --client-dir <path> [options]
|
|
168
|
+
npx wsdl-tsc client --catalog-file <path> --client-dir <path> [options]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Required Flags
|
|
172
|
+
|
|
173
|
+
| Flag | Description |
|
|
174
|
+
|------|-------------|
|
|
175
|
+
| `--wsdl-source` | Path or URL to WSDL file |
|
|
176
|
+
| `--client-dir` | Output directory for generated files |
|
|
177
|
+
|
|
178
|
+
Provide either `--wsdl-source` (compile from WSDL) or `--catalog-file` (use pre-compiled catalog). When using `--wsdl-source`, the catalog is auto-generated in the client directory unless overridden with `--catalog-file`.
|
|
179
|
+
|
|
180
|
+
### Generated Files
|
|
181
|
+
|
|
182
|
+
| File | Purpose |
|
|
183
|
+
|------|---------|
|
|
184
|
+
| `client.ts` | Typed SOAP client with one method per operation |
|
|
185
|
+
| `types.ts` | Flattened TypeScript interfaces, type aliases, enums |
|
|
186
|
+
| `utils.ts` | Runtime metadata for JSON-to-SOAP conversion |
|
|
187
|
+
| `catalog.json` | Generated in client directory when using --wsdl-source |
|
|
188
|
+
|
|
189
|
+
### Optional Flags
|
|
190
|
+
|
|
191
|
+
All flags from the compile command apply, plus the client-specific flags listed in the pipeline section.
|
|
192
|
+
|
|
193
|
+
### Key Modeling Rules
|
|
194
|
+
|
|
195
|
+
- Attributes and elements become peer properties (flattened)
|
|
196
|
+
- Text content becomes `$value` property
|
|
197
|
+
- Required: `use!="optional"` for attributes; `minOccurs>=1` for elements
|
|
198
|
+
- Arrays: `maxOccurs>1` or `unbounded` become arrays
|
|
199
|
+
- Nillable: `nillable="true"` preserved (optionally model as optional)
|
|
200
|
+
- Inheritance: extensions merged or emitted as extends
|
|
201
|
+
|
|
202
|
+
### Examples
|
|
203
|
+
|
|
204
|
+
Basic:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
npx wsdl-tsc client \
|
|
208
|
+
--wsdl-source examples/minimal/weather.wsdl \
|
|
209
|
+
--client-dir tmp/client
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
From catalog:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
npx wsdl-tsc client \
|
|
216
|
+
--catalog-file build/hotel-catalog.json \
|
|
217
|
+
--client-dir ./src/services/hotel
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## openapi
|
|
221
|
+
|
|
222
|
+
Generate OpenAPI 3.1 specification from WSDL or pre-compiled catalog.
|
|
223
|
+
|
|
224
|
+
### Usage
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
npx wsdl-tsc openapi --wsdl-source <file|url> --openapi-file <path> [options]
|
|
228
|
+
npx wsdl-tsc openapi --catalog-file <path> --openapi-file <path> [options]
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Required Flags
|
|
232
|
+
|
|
233
|
+
| Flag | Description |
|
|
234
|
+
|------|-------------|
|
|
235
|
+
| `--openapi-file` | Output path for OpenAPI specification |
|
|
236
|
+
|
|
237
|
+
### Input Source Flags
|
|
238
|
+
|
|
239
|
+
These flags are mutually exclusive.
|
|
240
|
+
|
|
241
|
+
| Flag | Default | Description |
|
|
242
|
+
|------|---------|-------------|
|
|
243
|
+
| `--wsdl-source` | (none) | Path or URL to WSDL |
|
|
244
|
+
| `--catalog-file` | {openapi-file-dir}/catalog.json | Pre-compiled catalog |
|
|
245
|
+
|
|
246
|
+
### Response Envelope
|
|
247
|
+
|
|
248
|
+
All responses are wrapped in a standard envelope (always-on since v0.7.1).
|
|
249
|
+
|
|
250
|
+
Base structure:
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
{
|
|
254
|
+
status: string;
|
|
255
|
+
message: string | null;
|
|
256
|
+
data: T | null;
|
|
257
|
+
error: ErrorObject | null;
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Error structure:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
{
|
|
265
|
+
code: string;
|
|
266
|
+
message: string;
|
|
267
|
+
details: object | null;
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
The base envelope is named `${serviceName}ResponseEnvelope` (override with `--openapi-envelope-namespace`). The error object is named `${serviceName}ErrorObject` (override with `--openapi-error-namespace`). Per-operation envelopes are named `<PayloadType|OperationName><EnvelopeNamespace>`. If a payload type ends with the namespace prefix, an underscore is inserted to avoid collisions.
|
|
272
|
+
|
|
273
|
+
### Tag Inference Strategies
|
|
274
|
+
|
|
275
|
+
| Strategy | Behavior |
|
|
276
|
+
|----------|----------|
|
|
277
|
+
| `default` | Single tag = service name (fallback SOAP) |
|
|
278
|
+
| `service` | Always service name |
|
|
279
|
+
| `first` | First lexical CamelCase segment |
|
|
280
|
+
|
|
281
|
+
Use `--openapi-tags-file` for explicit mapping.
|
|
282
|
+
|
|
283
|
+
### Output Determinism
|
|
284
|
+
|
|
285
|
+
All specs have deterministic ordering. Paths, methods, schemas, security schemes, parameters, and tags are sorted alphabetically.
|
|
286
|
+
|
|
287
|
+
### Examples
|
|
288
|
+
|
|
289
|
+
Basic:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
npx wsdl-tsc openapi \
|
|
293
|
+
--wsdl-source examples/minimal/weather.wsdl \
|
|
294
|
+
--openapi-file ./docs/weather-api.json
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Multi-format:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
npx wsdl-tsc openapi \
|
|
301
|
+
--wsdl-source https://example.com/Hotel.wsdl \
|
|
302
|
+
--openapi-file ./docs/hotel-api \
|
|
303
|
+
--openapi-format both \
|
|
304
|
+
--openapi-servers https://api.example.com/v1
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## gateway
|
|
308
|
+
|
|
309
|
+
Generate production-ready Fastify gateway with route handlers from an OpenAPI specification.
|
|
310
|
+
|
|
311
|
+
### Usage
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
npx wsdl-tsc gateway \
|
|
315
|
+
--openapi-file <path> \
|
|
316
|
+
--client-dir <path> \
|
|
317
|
+
--gateway-dir <path> \
|
|
318
|
+
--gateway-service-name <slug> \
|
|
319
|
+
--gateway-version-prefix <slug> \
|
|
320
|
+
[options]
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Required Flags
|
|
324
|
+
|
|
325
|
+
| Flag | Description |
|
|
326
|
+
|------|-------------|
|
|
327
|
+
| `--openapi-file` | Path to OpenAPI 3.1 JSON or YAML file |
|
|
328
|
+
| `--client-dir` | Path to client directory |
|
|
329
|
+
| `--gateway-dir` | Output directory for gateway code |
|
|
330
|
+
| `--gateway-service-name` | Service identifier for URN generation |
|
|
331
|
+
| `--gateway-version-prefix` | Version prefix for URN generation |
|
|
332
|
+
|
|
333
|
+
Route URLs are derived from OpenAPI paths, which include any base path from `--openapi-base-path`.
|
|
334
|
+
|
|
335
|
+
### Generated Output Structure
|
|
336
|
+
|
|
337
|
+
```text
|
|
338
|
+
{gateway-dir}/
|
|
339
|
+
├── schemas/
|
|
340
|
+
│ ├── models/ # JSON Schema with URN IDs
|
|
341
|
+
│ └── operations/ # Fastify operation schemas
|
|
342
|
+
├── routes/ # Route handlers with full implementations
|
|
343
|
+
├── schemas.ts # Schema registration module
|
|
344
|
+
├── routes.ts # Route aggregator
|
|
345
|
+
├── runtime.ts # Envelope builders, error handlers
|
|
346
|
+
└── plugin.ts # Fastify plugin wrapper (recommended entry point)
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### URN-Based Schema IDs
|
|
350
|
+
|
|
351
|
+
Format: `urn:services:{serviceSlug}:{versionSlug}:schemas:{models|operations}:{schemaSlug}`
|
|
352
|
+
|
|
353
|
+
### Contract Assumptions
|
|
354
|
+
|
|
355
|
+
- All request/response bodies must use `$ref` to `components.schemas`
|
|
356
|
+
- Every operation must have a default response with `application/json`
|
|
357
|
+
- All referenced schemas must exist in `components.schemas`
|
|
358
|
+
|
|
359
|
+
### Examples
|
|
360
|
+
|
|
361
|
+
Basic:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
npx wsdl-tsc gateway \
|
|
365
|
+
--openapi-file ./docs/weather-api.json \
|
|
366
|
+
--client-dir ./src/services/weather \
|
|
367
|
+
--gateway-dir ./src/gateway/weather \
|
|
368
|
+
--gateway-service-name weather \
|
|
369
|
+
--gateway-version-prefix v1
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
## app
|
|
373
|
+
|
|
374
|
+
Generate a runnable Fastify application integrating client, gateway, and OpenAPI spec.
|
|
375
|
+
|
|
376
|
+
### Usage
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
npx wsdl-tsc app \
|
|
380
|
+
--client-dir <path> \
|
|
381
|
+
--gateway-dir <path> \
|
|
382
|
+
--openapi-file <path> \
|
|
383
|
+
[--app-dir <path>] \
|
|
384
|
+
[options]
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Required Flags
|
|
388
|
+
|
|
389
|
+
| Flag | Description |
|
|
390
|
+
|------|-------------|
|
|
391
|
+
| `--client-dir` | Path to client directory |
|
|
392
|
+
| `--gateway-dir` | Path to gateway directory |
|
|
393
|
+
| `--openapi-file` | Path to OpenAPI spec |
|
|
394
|
+
|
|
395
|
+
### Optional Flags
|
|
396
|
+
|
|
397
|
+
| Flag | Default | Description |
|
|
398
|
+
|------|---------|-------------|
|
|
399
|
+
| `--catalog-file` | {client-dir}/catalog.json | Path to catalog.json |
|
|
400
|
+
| `--app-dir` | {gateway-dir}/../app | Output directory |
|
|
401
|
+
| `--import-extensions` | Inferred or js | Import style |
|
|
402
|
+
| `--host` | 127.0.0.1 | Default server host |
|
|
403
|
+
| `--port` | 3000 | Default server port |
|
|
404
|
+
| `--prefix` | (empty) | Route prefix |
|
|
405
|
+
| `--logger` | true | Enable Fastify logger |
|
|
406
|
+
| `--openapi-mode` | copy | copy or reference |
|
|
407
|
+
|
|
408
|
+
### Generated Structure
|
|
409
|
+
|
|
410
|
+
```text
|
|
411
|
+
app/
|
|
412
|
+
├── server.js # Main entry point
|
|
413
|
+
├── config.js # Configuration with env support
|
|
414
|
+
├── .env.example # Environment template
|
|
415
|
+
├── README.md # Usage instructions
|
|
416
|
+
└── openapi.json # OpenAPI spec (when --openapi-mode=copy)
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### Environment Variables
|
|
420
|
+
|
|
421
|
+
| Variable | Default | Description |
|
|
422
|
+
|----------|---------|-------------|
|
|
423
|
+
| `WSDL_SOURCE` | From catalog or required | WSDL URL or path |
|
|
424
|
+
| `HOST` | 127.0.0.1 | Server bind address |
|
|
425
|
+
| `PORT` | 3000 | Server listen port |
|
|
426
|
+
| `PREFIX` | (empty) | Route prefix |
|
|
427
|
+
| `LOGGER` | true | Fastify logger |
|
|
428
|
+
|
|
429
|
+
### Endpoints
|
|
430
|
+
|
|
431
|
+
- `GET /health` returns `{ "ok": true }`
|
|
432
|
+
- `GET /openapi.json` returns the OpenAPI specification
|
|
433
|
+
- All SOAP operations are exposed as REST endpoints
|
|
434
|
+
|
|
435
|
+
The app can also be generated via pipeline with `--generate-app`.
|
|
436
|
+
|
|
437
|
+
## compile
|
|
438
|
+
|
|
439
|
+
Parse WSDL and generate only the intermediate catalog.json representation. This is an advanced command for debugging and multi-stage builds.
|
|
440
|
+
|
|
441
|
+
### Usage
|
|
442
|
+
|
|
443
|
+
```bash
|
|
444
|
+
npx wsdl-tsc compile --wsdl-source <file|url> --catalog-file <path> [options]
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### Required Flags
|
|
448
|
+
|
|
449
|
+
| Flag | Description |
|
|
450
|
+
|------|-------------|
|
|
451
|
+
| `--wsdl-source` | Path or URL to WSDL file |
|
|
452
|
+
| `--catalog-file` | Output path for catalog.json |
|
|
453
|
+
|
|
454
|
+
### Catalog Co-location
|
|
455
|
+
|
|
456
|
+
Default behavior varies by command:
|
|
457
|
+
|
|
458
|
+
| Command | Default catalog location |
|
|
459
|
+
|---------|--------------------------|
|
|
460
|
+
| compile | Always requires explicit `--catalog-file` |
|
|
461
|
+
| client | `{client-dir}/catalog.json` |
|
|
462
|
+
| openapi | `{openapi-file-dir}/catalog.json` |
|
|
463
|
+
| pipeline | Cascade: `{client-dir}` then `{openapi-dir}` then `{gateway-dir}` then `tmp/` |
|
|
464
|
+
|
|
465
|
+
## Common Workflows
|
|
466
|
+
|
|
467
|
+
### Choosing a Command
|
|
468
|
+
|
|
469
|
+
| Goal | Command | Example |
|
|
470
|
+
|------|---------|---------|
|
|
471
|
+
| Everything | pipeline | `npx wsdl-tsc pipeline --wsdl-source svc.wsdl --client-dir ./client --openapi-file ./api.json --gateway-dir ./gw --gateway-service-name svc --gateway-version-prefix v1` |
|
|
472
|
+
| TypeScript client only | client | `npx wsdl-tsc client --wsdl-source svc.wsdl --client-dir ./client` |
|
|
473
|
+
| OpenAPI spec only | openapi | `npx wsdl-tsc openapi --wsdl-source svc.wsdl --openapi-file ./api.json` |
|
|
474
|
+
| REST gateway only | gateway | `npx wsdl-tsc gateway --openapi-file ./api.json --client-dir ./client --gateway-dir ./gw --gateway-service-name svc --gateway-version-prefix v1` |
|
|
475
|
+
| Runnable server | app | `npx wsdl-tsc app --client-dir ./client --gateway-dir ./gw --openapi-file ./api.json` |
|
|
476
|
+
| Debug WSDL | compile | `npx wsdl-tsc compile --wsdl-source svc.wsdl --catalog-file ./catalog.json` |
|
|
477
|
+
|
|
478
|
+
### CI/CD Multi-Stage Build
|
|
479
|
+
|
|
480
|
+
Compile once and reuse the catalog across multiple generation steps:
|
|
481
|
+
|
|
482
|
+
```bash
|
|
483
|
+
npx wsdl-tsc compile \
|
|
484
|
+
--wsdl-source ./wsdl/Service.wsdl \
|
|
485
|
+
--catalog-file ./build/service-catalog.json
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
```bash
|
|
489
|
+
npx wsdl-tsc client \
|
|
490
|
+
--catalog-file ./build/service-catalog.json \
|
|
491
|
+
--client-dir ./src/services/service
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
npx wsdl-tsc openapi \
|
|
496
|
+
--catalog-file ./build/service-catalog.json \
|
|
497
|
+
--openapi-file ./docs/service-api.json
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### Debugging Complex WSDL
|
|
501
|
+
|
|
502
|
+
Compile to catalog and inspect the intermediate representation:
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
npx wsdl-tsc compile \
|
|
506
|
+
--wsdl-source ./wsdl/Complex.wsdl \
|
|
507
|
+
--catalog-file ./debug/catalog.json
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
Inspect types and operations with `jq`:
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
cat ./debug/catalog.json | jq '.types'
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
cat ./debug/catalog.json | jq '.operations'
|
|
518
|
+
```
|