@shipworthy/openapi-cli 0.0.1 → 0.0.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 CHANGED
@@ -13,7 +13,7 @@
13
13
  Install the CLI and the generator packages you need as dev dependencies. The CLI brings its own dependencies (`effect` `^4.0.0`, `@effect/platform-node` `^4.0.0`, `@shipworthy/openapi-generator`, `@shipworthy/openapi-parser`, `@shipworthy/overlay`, and `@shipworthy/openapi-validator`):
14
14
 
15
15
  ```sh
16
- bun add -d @shipworthy/openapi-cli @shipworthy/openapi-typescript effect@^4
16
+ bun add -d @shipworthy/openapi-cli @shipworthy/openapi-typescript
17
17
  ```
18
18
 
19
19
  ### Optional peer dependencies (generators)
@@ -22,7 +22,7 @@ Install the generator package for each `generate` subcommand you use, at the sam
22
22
 
23
23
  | Command | Requires | Notes |
24
24
  | ---------------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------- |
25
- | `openapi generate typescript` | `@shipworthy/openapi-typescript` | That package peers on `effect@^4.0.0`. |
25
+ | `openapi generate typescript` | `@shipworthy/openapi-typescript` | |
26
26
  | `openapi generate zod` | `@shipworthy/openapi-zod` and `@shipworthy/openapi-typescript` | Also writes `types.ts`. |
27
27
  | `openapi generate tanstack-query` | `@shipworthy/openapi-tanstack-query` and `@shipworthy/openapi-typescript` | Also writes `types.ts`. |
28
28
  | `openapi generate standard-schema` | `@shipworthy/openapi-standard-schema` | |
@@ -42,7 +42,7 @@ The generated files import packages at runtime, so your application needs those
42
42
  Run the `openapi` commands below in a package script, or use `bunx --bun @shipworthy/openapi-cli` in place of `openapi`.
43
43
 
44
44
  ```sh
45
- bun add -d @shipworthy/openapi-cli @shipworthy/openapi-typescript effect@^4
45
+ bun add -d @shipworthy/openapi-cli @shipworthy/openapi-typescript
46
46
  bunx --bun @shipworthy/openapi-cli lint ./openapi.yaml
47
47
  bunx --bun @shipworthy/openapi-cli generate typescript ./openapi.yaml -o ./src/generated/types.ts
48
48
  ```
@@ -181,7 +181,9 @@ openapi overlay openapi.yaml --overlay selected.overlay.yaml --remove-unused-com
181
181
 
182
182
  Actions run sequentially against the bundled document. Supports RFC 9535 JSONPath, recursive
183
183
  object updates, array concatenation/appending, primitive replacement, copying from a single
184
- source node, and removal. A target matching no nodes has no effect. `extends` is metadata;
184
+ source node, and removal. Invalid JSONPath target expressions and targets matching no nodes
185
+ are skipped; the CLI logs each as a warning to stderr with its action number and target, then
186
+ writes the result of the remaining actions. `extends` is metadata;
185
187
  `<input>` determines the document. The overlaid result is written directly without another
186
188
  bundling or validation pass.
187
189
 
@@ -395,7 +397,7 @@ openapi.pipe(
395
397
  );
396
398
  ```
397
399
 
398
- This requires `effect` `^4.0.0` and `@effect/platform-node` `^4.0.0`, which the CLI also depends on. Add them to your own `package.json` if your code imports them directly. No other functions or types are exported. For direct access to the generation pipeline, use `@shipworthy/openapi-generator`, `@shipworthy/openapi-parser`, and `@shipworthy/openapi-transformer`.
400
+ This uses `effect` `^4.0.0` and `@effect/platform-node` `^4.0.0`. The CLI depends on both, but add them to your own `package.json` when your code imports them, using versions compatible with the CLI so they resolve to one copy. No other functions or types are exported. For direct access to the generation pipeline, use `@shipworthy/openapi-generator`, `@shipworthy/openapi-parser`, and `@shipworthy/openapi-transformer`.
399
401
 
400
402
  ## Errors and exit codes
401
403
 
@@ -1,4 +1,4 @@
1
- import { applyOverlay } from "@shipworthy/overlay";
1
+ import { applyOverlayWithWarnings } from "@shipworthy/overlay";
2
2
  import { bundleDocument } from "@shipworthy/openapi-parser";
3
3
  import { Console, Effect, FileSystem, Path, Schema } from "effect";
4
4
  import { Argument, Command, Flag } from "effect/cli";
@@ -11,11 +11,12 @@ const run = Effect.fn("overlay")(function* ({ input, overlay, output, removeUnus
11
11
  const text = overlay.protocol === "file:"
12
12
  ? yield* fs.readFileString(fileURLToPath(overlay))
13
13
  : yield* HttpClient.get(overlay.href).pipe(Effect.flatMap(HttpClientResponse.filterStatusOk), Effect.flatMap((response) => response.text));
14
- const result = yield* applyOverlay(document, text, { removeUnusedComponents });
14
+ const result = yield* applyOverlayWithWarnings(document, text, { removeUnusedComponents });
15
+ yield* Effect.forEach(result.warnings, (warning) => Console.warn(`WARNING Overlay action ${warning.action} (${warning.target}): ${warning.message}`), { discard: true });
15
16
  const path = yield* Path.Path;
16
17
  const outputPath = path.resolve(output);
17
18
  yield* fs.makeDirectory(path.dirname(outputPath), { recursive: true });
18
- const serialized = yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown, { space: 2 }))(result);
19
+ const serialized = yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown, { space: 2 }))(result.document);
19
20
  yield* fs.writeFileString(outputPath, `${serialized}\n`);
20
21
  yield* Console.log(`${input.href} + ${overlay.href} → ${output}`);
21
22
  }, Effect.mapError(asCliError));
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@shipworthy/openapi-cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
7
7
  "dependencies": {
8
8
  "@effect/platform-node": "^4.0.0",
9
- "@shipworthy/openapi-generator": "0.0.1",
10
- "@shipworthy/openapi-parser": "0.0.1",
11
- "@shipworthy/openapi-validator": "0.0.1",
12
- "@shipworthy/overlay": "0.0.1",
9
+ "@shipworthy/openapi-generator": "0.0.2",
10
+ "@shipworthy/openapi-parser": "0.0.2",
11
+ "@shipworthy/openapi-validator": "0.0.2",
12
+ "@shipworthy/overlay": "0.0.2",
13
13
  "effect": "^4.0.0"
14
14
  },
15
15
  "peerDependencies": {
16
- "@shipworthy/openapi-standard-schema": "0.0.1",
17
- "@shipworthy/openapi-tanstack-query": "0.0.1",
18
- "@shipworthy/openapi-typescript": "0.0.1",
19
- "@shipworthy/openapi-zod": "0.0.1"
16
+ "@shipworthy/openapi-standard-schema": "0.0.2",
17
+ "@shipworthy/openapi-tanstack-query": "0.0.2",
18
+ "@shipworthy/openapi-typescript": "0.0.2",
19
+ "@shipworthy/openapi-zod": "0.0.2"
20
20
  },
21
21
  "bin": {
22
22
  "openapi": "./dist/bin.js"
@@ -40,10 +40,10 @@
40
40
  "build": "rm -rf dist && tsc -p tsconfig.build.json && sed -i.bak '1s|^#!.*|#!/usr/bin/env node|' dist/bin.js && rm dist/bin.js.bak"
41
41
  },
42
42
  "devDependencies": {
43
- "@shipworthy/openapi-standard-schema": "0.0.1",
44
- "@shipworthy/openapi-tanstack-query": "0.0.1",
45
- "@shipworthy/openapi-typescript": "0.0.1",
46
- "@shipworthy/openapi-zod": "0.0.1",
43
+ "@shipworthy/openapi-standard-schema": "0.0.2",
44
+ "@shipworthy/openapi-tanstack-query": "0.0.2",
45
+ "@shipworthy/openapi-typescript": "0.0.2",
46
+ "@shipworthy/openapi-zod": "0.0.2",
47
47
  "@shipworthy/typescript-config": "0.0.1",
48
48
  "@types/node": "^24.10.3",
49
49
  "typescript": "^7.0.2",