openapi-typesafe-migrate 1.0.0-rc.7 → 1.0.0-rc.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,114 @@
1
1
  # openapi-typesafe-migrate
2
2
 
3
+ ## 1.0.0-rc.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - A shell default around a GitHub Actions expression (`${GEN:-${{ inputs.gen || 'npx
8
+ openapi-typescript' }}} api.yaml`, also with `:+`, `:=` and in `G=${G:-…}`) is migrated: the old
9
+ name in it is renamed once, and old flags after it are listed as a manual step. Before, the tool
10
+ skipped the whole file with "edits overlap" and exited with `1`. A report whose only findings were
11
+ in such a skipped file no longer also says "Nothing to migrate".
12
+
13
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - Old flags in the default of an action or workflow input (`inputs.flags.default: --immutable-types`)
14
+ are listed as a manual step where a command gets them as `${{ inputs.flags }}`, as for an `env`
15
+ value used as `$FLAGS`. Before, they were not reported, and the migrated step failed.
16
+
17
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - Old flags in an exported justfile variable are listed as a manual step where a recipe line uses it
18
+ as a shell variable: `export FLAGS := "-it"` used as `$FLAGS`, a parameter `$OPTS="-it"` used as
19
+ `$OPTS`, and every variable with `set export`. Before, only `{{flags}}` was reported, and the
20
+ migrated recipe failed.
21
+
22
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - The old generator inside a make function is renamed: `$(or $(GEN),npx openapi-typescript)`,
23
+ `$(if $(GEN),$(GEN),npx openapi-typescript)` and `$(and …)`, in a recipe line or in a variable's
24
+ value. The function may give another program, so old flags after it are still listed as a manual
25
+ step. Before, the old name stayed, and with no flags after it the report said "Nothing to migrate".
26
+
27
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - The migration keeps the old flags after a variable whose program is decided when the job runs,
28
+ and lists them as a manual step: a workflow `env` set by an expression
29
+ (`GEN: ${{ vars.GEN || 'npx openapi-typescript' }}` or `GEN: ${{ vars.GEN }}`, used as `$GEN`), a
30
+ Makefile `GEN ?= npx openapi-typescript`, which the environment can override, and a Makefile value
31
+ that make computes (`GEN := $(or $(X),npx openapi-typescript)`). Before, the flags after `$GEN`
32
+ were renamed without a word, or kept without a word, though `$GEN` may run another program.
33
+
34
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - A `transform` that returns an array of a one-member union (`createArrayTypeNode(
35
+ createUnionTypeNode([DATE_OR_NULL]))`, where `DATE_OR_NULL` is `Date | null`) is rewritten to
36
+ `"(Date | null)[]"`. Before, the parentheses were lost and the type text was `"Date | null[]"`, a
37
+ different type that still compiled.
38
+
39
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - The generator bin written with a Windows suffix is migrated: `openapi-typescript.cmd`,
40
+ `openapi-typescript.ps1`, `openapi-typescript.exe` and `node_modules\.bin\openapi-typescript.cmd`
41
+ become the same names of `openapi-typesafe`, and the old flags after them are renamed. Before, they
42
+ were neither changed nor reported, so the script called a bin that the migration had removed.
43
+
44
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - Commands that a YAML anchor shares are migrated where they are written, when an alias uses them
45
+ under a command key: a GitLab `.gen_scripts: &gen_scripts` list used as
46
+ `script: [*gen_scripts]`, an anchored `env` map, a Taskfile command. Before, such a file was
47
+ neither changed nor reported ("Nothing to migrate"), and the job kept running the old generator.
48
+
49
+ ## 1.0.0-rc.8
50
+
51
+ ### Patch Changes
52
+
53
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - When a bug of the tool would corrupt one file, only that file is left as it was: the report lists
54
+ it under "Skipped" with the reason and asks you to migrate it by hand, the other files are still
55
+ migrated (and written with `--write`), and the command exits with `1`. Before, such a bug stopped
56
+ the whole run and nothing was migrated.
57
+
58
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - A CircleCI job now takes the `shell` of the executor it names (`executor: py` with
59
+ `executors.py.shell: /usr/bin/python3`), so the Python code of its steps is no longer rewritten as
60
+ a command line; a step that names an old package is listed as a manual step. The job's own `shell`
61
+ still wins.
62
+
63
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - A Dockerfile `ARG` or `ENV` whose value has a shell default, such as
64
+ `ENV GEN=${GEN:-npx openapi-typescript}`, no longer stops the whole migration with "Edits overlap"
65
+ and exit code 1: the default is renamed once, like any other `ARG` or `ENV` value.
66
+
67
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - A GitLab CI job named `openapi`, `swagger`, `asyncapi`, `overlay` or `arazzo` no longer makes the
68
+ whole `.gitlab-ci.yml` count as an API description, so its commands are migrated again. A YAML file
69
+ counts as an API description only when such a top-level key holds a version (`openapi: 3.1.0`), and
70
+ a CI config (`.gitlab-ci.yml`, a GitHub workflow, a CircleCI config, …) never does.
71
+
72
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - Old flags in a justfile recipe parameter default (`b *flags='-it':` with `{{gen}} f.yaml
73
+ {{flags}}`) are now reported, like the flags of a `flags := '-it'` variable. Before, the run failed
74
+ later with `CLI_FLAG_REMOVED`.
75
+
76
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - A Makefile command that make computes, such as `$(or $(GEN),npx openapi-typescript) b.yaml -it`,
77
+ is now reported with the text you wrote. Before, the report showed a row of underscores instead.
78
+
79
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - A path that names the `node_modules` folder of an old package itself (`"paths": { "a":
80
+ ["./node_modules/openapi-fetch"] }` in a tsconfig, or an import of `../node_modules/openapi-fetch`)
81
+ is now reported, like a path to a file inside it.
82
+
83
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - Options passed to `openapiTS()` that take keys from another object (`{ ...base }`) are now checked
84
+ for legacy callbacks. When the file writes that object (`...{ transform }` or `const base = { … }`),
85
+ its `transform`, `postTransform` and `transformProperty` are listed as manual steps; a spread of an
86
+ object the tool cannot read (an import, a call) is listed too, so you can check it. Before, such
87
+ options were not reported at all.
88
+
89
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - A justfile recipe whose first line is a shebang for another program (`#!/usr/bin/env python3`), and
90
+ code given on the command line (`python3 -c '…'`, `node -e "…"`, `ruby -e '…'`), are no longer
91
+ read as shell commands. When such code names an old package, it is listed as a manual step
92
+ ("the script runs with python3, …"); before, it was neither changed nor reported, or a command
93
+ line inside it was rewritten.
94
+
95
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - A rewritten `transform` whose type is declared outside the function now compiles: a TypeScript
96
+ node type in the type of its `const` (`const transform: (s: SchemaObject) => ts.TypeNode`), in a
97
+ JSDoc `@type` or in a JSDoc `@returns` becomes `string`, like the returns. Before, that type stayed
98
+ and the file no longer compiled. A declared type the tool cannot map, such as a local alias, keeps
99
+ the `transform`, which is listed as a manual step.
100
+
101
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - A launcher or install command written with its Windows file suffix (`npx.cmd openapi-typescript`,
102
+ `pnpm.exe exec …`, `npm.ps1 i openapi-fetch`) is now migrated like `npx`, `pnpm` and `npm`.
103
+ Before, the old name after it was only reported.
104
+
105
+ - [#107](https://github.com/openapi-typesafe/openapi-typesafe/pull/107) [`173c82c`](https://github.com/openapi-typesafe/openapi-typesafe/commit/173c82c24fb8d59a5e3d4894596391dd48f2608f) Thanks [@fedorello](https://github.com/fedorello)! - The migration renames the old generator in GitHub Actions expressions again, such as
106
+ `run: ${{ inputs.generator || 'npx openapi-typescript' }} api.yaml` and
107
+ `npx ${{ inputs.pkg || 'openapi-typescript' }}`, and in input defaults of an `action.yml` or a
108
+ reusable workflow (`default: npx openapi-typescript`). The value of an expression comes from the
109
+ run, so old flags after it are listed as a manual step. Before, these places were neither changed
110
+ nor reported, and npx ran the old package after the migration.
111
+
3
112
  ## 1.0.0-rc.7
4
113
 
5
114
  ### Patch Changes
package/README.md CHANGED
@@ -18,16 +18,16 @@ Run it with `npx` (or `pnpm dlx`, `yarn dlx`, `bunx`), not as a dependency: it u
18
18
 
19
19
  ## What it changes
20
20
 
21
- | Where | Change |
22
- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23
- | Every `package.json` and pnpm's `package.yaml` | `dependencies`, `devDependencies`, `peerDependencies` and `optionalDependencies` get the new names, with the version of this tool, in the style of the old range (see below). `catalog:` stays; a dependency on a local package (`workspace:`, `link:`, `file:`) keeps its name and is reported, and so do the imports of it in the files for which that manifest is the nearest one that declares the name, as Node resolves it. An `npm:` alias of an original package (`"my-fetch": "npm:openapi-fetch@^0.13"`) points at the new package. The keys of `peerDependenciesMeta` and `dependenciesMeta` and the names in `bundleDependencies` get the new names too, and so do bun's `catalog` and `catalogs`. The targets of subpath `imports` (`"#client": "openapi-fetch"`, under any conditions) get the new names; the `#` keys stay. So do the keys and values of the `browser` field (`"openapi-fetch": false`). |
24
- | `pnpm-workspace.yaml`, `.yarnrc.yml` | Entries of `catalog:` and `catalogs:` (pnpm, Yarn 4.10 and newer), ranges with spaces included. |
25
- | `deno.json`, `deno.jsonc`, `import_map.json` | Keys of `imports` and `scopes` that name an original package (`openapi-fetch`, `openapi-fetch/`), and their `npm:` values, also in the file a config names as its `importMap` (`"importMap": "./deps.json"`). |
26
- | `tsconfig.json`, `tsconfig.*.json`, `jsconfig.json` | The `compilerOptions.paths` keys of an original package (`"openapi-fetch/*"`) and its name in `compilerOptions.types`. |
27
- | Commands (the files are listed below the table) | The `openapi-typescript` command (also as `npx`, `pnpm exec`, `node_modules/.bin/…` or `npm:openapi-typescript`), and the flags it renamed, in that command only: `--immutable-types` / `-it` → `--immutable`, `--support-array-length` → `--array-length`, `--redoc` → `--redocly`, `-ap` → `--additional-properties`. The old package names in install commands (`npm i`, `pnpm add`, `npx -p`, …). |
28
- | `.github/dependabot.yml` | Every old package name in `dependency-name` and `patterns`. |
29
- | Sources (`.ts`, `.tsx`, `.js`, `.mjs`, `.cjs`, `.vue`, `.svelte`, `.astro`, `.mdx`, …) | Module specifiers only: `import` / `export … from`, `import()`, `require()`, `require.resolve()`, `import("…")` types and `@import` tags in JSDoc (every block), `declare module`, `/// <reference types>`, and module mocks: `vi.mock()` and the other `vi` / `jest` module methods (`jest.setMock()`, `jest.requireActual()`, …), bun's `mock.module()`. Components: their `<script>` blocks and Astro's frontmatter; MDX: its `import` / `export` blocks. A bundler query stays (`openapi-fetch?url`). |
30
- | `openapiTS(source, { transform })` calls | When `transform` is the only callback and returns plain `ts.factory` types (or the helper constants), the returns become type text and `irCallbacks: true` is added. The options may also be a `const` of the same file that only this call uses (without a type, the option is `irCallbacks: true as const`, which keeps the type `true` that the call needs); options or a named `transform` function that other code can reach (another use, or an export) are kept and reported. Module constants and imports that only the old returns used are removed; exported ones stay. Names are resolved by scope, so a local constant is never taken for a module one. Options declared as `OpenAPITSOptions` are declared as `OpenAPITSIrOptions` then. |
21
+ | Where | Change |
22
+ | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
23
+ | Every `package.json` and pnpm's `package.yaml` | `dependencies`, `devDependencies`, `peerDependencies` and `optionalDependencies` get the new names, with the version of this tool, in the style of the old range (see below). `catalog:` stays; a dependency on a local package (`workspace:`, `link:`, `file:`) keeps its name and is reported, and so do the imports of it in the files for which that manifest is the nearest one that declares the name, as Node resolves it. An `npm:` alias of an original package (`"my-fetch": "npm:openapi-fetch@^0.13"`) points at the new package. The keys of `peerDependenciesMeta` and `dependenciesMeta` and the names in `bundleDependencies` get the new names too, and so do bun's `catalog` and `catalogs`. The targets of subpath `imports` (`"#client": "openapi-fetch"`, under any conditions) get the new names; the `#` keys stay. So do the keys and values of the `browser` field (`"openapi-fetch": false`). |
24
+ | `pnpm-workspace.yaml`, `.yarnrc.yml` | Entries of `catalog:` and `catalogs:` (pnpm, Yarn 4.10 and newer), ranges with spaces included. |
25
+ | `deno.json`, `deno.jsonc`, `import_map.json` | Keys of `imports` and `scopes` that name an original package (`openapi-fetch`, `openapi-fetch/`), and their `npm:` values, also in the file a config names as its `importMap` (`"importMap": "./deps.json"`). |
26
+ | `tsconfig.json`, `tsconfig.*.json`, `jsconfig.json` | The `compilerOptions.paths` keys of an original package (`"openapi-fetch/*"`) and its name in `compilerOptions.types`. |
27
+ | Commands (the files are listed below the table) | The `openapi-typescript` command (also as `npx`, `pnpm exec`, `node_modules/.bin/…` or `npm:openapi-typescript`), and the flags it renamed, in that command only: `--immutable-types` / `-it` → `--immutable`, `--support-array-length` → `--array-length`, `--redoc` → `--redocly`, `-ap` → `--additional-properties`. The old package names in install commands (`npm i`, `pnpm add`, `npx -p`, …). |
28
+ | `.github/dependabot.yml` | Every old package name in `dependency-name` and `patterns`. |
29
+ | Sources (`.ts`, `.tsx`, `.js`, `.mjs`, `.cjs`, `.vue`, `.svelte`, `.astro`, `.mdx`, …) | Module specifiers only: `import` / `export … from`, `import()`, `require()`, `require.resolve()`, `import("…")` types and `@import` tags in JSDoc (every block), `declare module`, `/// <reference types>`, and module mocks: `vi.mock()` and the other `vi` / `jest` module methods (`jest.setMock()`, `jest.requireActual()`, …), bun's `mock.module()`. Components: their `<script>` blocks and Astro's frontmatter; MDX: its `import` / `export` blocks. A bundler query stays (`openapi-fetch?url`). |
30
+ | `openapiTS(source, { transform })` calls | When `transform` is the only callback and returns plain `ts.factory` types (or the helper constants), the returns become type text and `irCallbacks: true` is added. The options may also be a `const` of the same file that only this call uses (without a type, the option is `irCallbacks: true as const`, which keeps the type `true` that the call needs); options or a named `transform` function that other code can reach (another use, or an export) are kept and reported. Module constants and imports that only the old returns used are removed; exported ones stay. Names are resolved by scope, so a local constant is never taken for a module one. Options declared as `OpenAPITSOptions` are declared as `OpenAPITSIrOptions` then, and a node type declared for `transform` (its return type, the type of its `const`, a JSDoc `@type` or `@returns`) becomes `string`; a declared type the tool cannot map keeps the `transform`, which is reported. |
31
31
 
32
32
  Commands are read in `package.json` scripts, shell scripts (`.sh`, `.bash`, `.zsh`), husky hooks,
33
33
  `Makefile`, `justfile`, `Dockerfile`, CI and other YAML files, Nx `project.json` targets and
@@ -36,7 +36,8 @@ scripts, Task's `Taskfile.yml` (`cmds`, `cmd`, `sh`, `status`, `defer`, `precond
36
36
  pre-commit hooks (`entry` with its `args`), and the `simple-git-hooks`, `lint-staged`,
37
37
  `nx.targets` and wireit `command` commands of a manifest, also in `.lintstagedrc*` and `.simple-git-hooks.json`. The
38
38
  generator is found behind the usual wrappers too (`npx`, `pnpm exec`, `yarn workspace <name>`,
39
- `dotenvx run`, `nx exec`, `tsx`, `timeout`, `xargs`, …). A here-document is data, except the one a
39
+ `dotenvx run`, `nx exec`, `tsx`, `timeout`, `xargs`, …), and under its Windows names
40
+ (`openapi-typescript.cmd`, `.ps1`, `.exe`, `node_modules\.bin\openapi-typescript.cmd`). A here-document is data, except the one a
40
41
  shell runs (`bash <<EOF`, `cat <<EOF | sh`). They are read word by word, the way the shell splits
41
42
  them (quotes, `\` line continuations, comments, `&&`, `|`,
42
43
  `sh -c "…"`, and the commands inside `if`, `while`, `for` and `{ … }`), so only the generator's
@@ -48,7 +49,8 @@ openapi-typescript`, also for some targets only, and `GEN := $(OAT)`) is renamed
48
49
  and the flags after `$(OAT)` (or `$G` for a one-letter name) where it runs; so is an `env` variable
49
50
  of a workflow and the flags after `$GEN` or `${{ env.GEN }}`, and a Dockerfile `ARG` or `ENV`
50
51
  variable and the flags after `$GEN`, and a justfile variable (`gen := "npx openapi-typescript"`)
51
- and the flags after `{{gen}}`. In a justfile every string and backtick of an expression is read
52
+ and the flags after `{{gen}}` (or `$gen`, when `export`, a `$gen` parameter or `set export` gives
53
+ it to the recipe's shell). In a justfile every string and backtick of an expression is read
52
54
  as a command line where it is written: in a value that just computes
53
55
  (`env_var_or_default("GEN", "npx openapi-typescript")`, an `if`), in a recipe parameter default
54
56
  (`types gen="npx openapi-typescript":`) and in an interpolation; such a value and a parameter (the
@@ -57,22 +59,41 @@ script sets itself (`GEN="npx openapi-typescript"`, also after `export`, `local`
57
59
  is renamed where it is set, and the flags after `$GEN` where it runs. The word of a default
58
60
  (`${GEN:-npx openapi-typescript}`, `${GEN:=…}`, `${GEN:+…}`) is read as a command line where it
59
61
  is written, so the old name in it is renamed; the variable may hold another program set outside
60
- the file, so the flags after such a default are reported. The flags change only when every definition of the variable
62
+ the file, so the flags after such a default are reported. The same holds for the string literals
63
+ of a GitHub Actions expression (`${{ inputs.gen || 'npx openapi-typescript' }}`), which the runner
64
+ puts into the script before the shell runs, and for the default of an input
65
+ (`inputs.command.default` of an `action.yml`, `workflow_call` and `workflow_dispatch` inputs):
66
+ the old name in them is renamed, and the flags after an expression are reported, because its value
67
+ comes from the run; so are the flags after a variable that an expression sets
68
+ (`GEN: ${{ vars.GEN || 'npx openapi-typescript' }}`, then `$GEN`). A Makefile program that make
69
+ computes (`$(or $(GEN),npx openapi-typescript)`, `$(shell …)`) may run the generator too, so the
70
+ flags after it are reported; the arguments that `$(or …)`, `$(and …)` and `$(if …)` can give are
71
+ read as command lines where they are written, so the old name in them is renamed. A Makefile
72
+ variable set with `?=` (the environment can override it) or to a value that make computes is
73
+ reported the same way where it runs. The flags change only when every definition of the variable
61
74
  in the file sets it to the generator: a variable that another Dockerfile stage, a step `env` or a
62
75
  later Makefile line or shell assignment sets to another program is reported with its old flags. So is a
63
76
  variable that runs a command but that no definition the tool reads sets: one set by another
64
77
  `script` item or step (`echo "GEN=…" >> "$GITHUB_ENV"`), a Makefile recipe's `$$GEN`, a bash
65
78
  array (`GEN=(npx openapi-typescript)`, whose items are renamed, run as `"${GEN[@]}"`), or one
66
79
  set outside the file. A variable of old
67
- flags that the generator gets (`$(FLAGS)` with `FLAGS := -it`) may serve other commands too, so it
80
+ flags that the generator gets (`$(FLAGS)` with `FLAGS := -it`, a justfile `{{flags}}` with
81
+ `flags := '-it'` or a recipe parameter `*flags='-it'`, an exported justfile `$FLAGS`, or
82
+ `${{ inputs.flags }}` with an input default `-it`) may serve other commands too, so it
68
83
  is reported, not changed. YAML files are changed only in command
69
- keys (`run`, `script`, `command`, `entrypoint`, …) and in the values of `env`, in block and flow
70
- style, never in other values. A CI step whose `shell` is another program (`shell: python`) runs
84
+ keys (`run`, `script`, `command`, `entrypoint`, …), in the values of `env` and in input
85
+ defaults, in block and flow style, never in other values. An anchor that an alias uses under such
86
+ a key (`script: [*gen_scripts]`, `env: *common`) is migrated where it is written, once. A CI step whose `shell` is another program (`shell: python`) runs
71
87
  code of that language, so its script is not changed, and it is reported when it names an old
72
88
  package. The nearest `shell` counts: the step's own, then the job's and the workflow's
73
- `defaults.run.shell` (GitHub Actions), or the job's `shell` (CircleCI). `env` (`/usr/bin/env bash
74
- -e {0}`) runs the program after it, and `msys2 {0}` and `wsl-bash {0}` run bash. An API description (a YAML document with a top-level `openapi`,
75
- `swagger`, `asyncapi`, `overlay` or `arazzo` key) is data, so it is never changed, not even an
89
+ `defaults.run.shell` (GitHub Actions), or the job's `shell` and then the `shell` of the
90
+ executor the job names (`executor: py`, CircleCI). `env` (`/usr/bin/env bash
91
+ -e {0}`) runs the program after it, and `msys2 {0}` and `wsl-bash {0}` run bash. The same holds for a
92
+ justfile recipe whose first line is a shebang for another program (`#!/usr/bin/env python3`), and
93
+ for code given on the command line (`python3 -c '…'`, `node -e "…"`, `ruby -e '…'`). An API description (a YAML document with a top-level `openapi`,
94
+ `swagger`, `asyncapi`, `overlay` or `arazzo` key whose value is a version, such as `openapi: 3.1.0`;
95
+ a CI config such as `.gitlab-ci.yml` or a workflow never is one, so a GitLab job named `openapi`
96
+ is migrated) is data, so it is never changed, not even an
76
97
  example `command`, and neither is a YAML file that such a document (YAML or JSON) reaches by
77
98
  `$ref`, directly or through other such files (a split layout's `components/schemas/Job.yaml`); a
78
99
  YAML file that names no old package is not even parsed. A config that cannot be parsed and names an old package is reported with the
@@ -120,8 +141,9 @@ or written; the report lists it under "Skipped". A file is written as a new file
120
141
  old one (same mode), so a hard link to a file elsewhere keeps its old text; the log notes it.
121
142
  A file whose bytes are not UTF-8 (a Latin-1 source, for example) is not changed, because its
122
143
  text cannot be written back without changing other characters; neither is a file that cannot be
123
- read. The report lists both under "Skipped". Every file is read and migrated before the first one
124
- is written. If a write fails, the writing stops, the command exits with `1`, and the report names
144
+ read. The report lists both under "Skipped". So does a file that a bug of the tool would corrupt
145
+ (two of its edits overlap): it is left as it was, the other files are still migrated, and the
146
+ command exits with `1`. Every file is read and migrated before the first one is written. If a write fails, the writing stops, the command exits with `1`, and the report names
125
147
  the files written before it and the ones that were not.
126
148
  The report and the log show a spec with credentials (`git+https://<token>@…`) as
127
149
  `git+https://***@…`; the file keeps it as written.
@@ -145,8 +167,9 @@ The report lists each of these with the file and line:
145
167
  code, so check whether the fix is still needed;
146
168
  - a word in a command that names an old package where the tool cannot tell what runs it (an
147
169
  argument of a program it does not know, a script name): migrate it by hand;
148
- - a CI step whose `shell` is another program (`shell: python`) and whose script names an old
149
- package: the tool does not read code of other languages, so migrate it by hand;
170
+ - a CI step whose `shell` is another program (`shell: python`), a justfile recipe with a shebang
171
+ for one, or inline code (`python3 -c '…'`) that names an old package: the tool does not read
172
+ code of other languages, so migrate it by hand;
150
173
  - an import map that a Deno config names by a URL or a path outside the folder;
151
174
  - a renamed peer dependency: users of your package must switch too;
152
175
  - a pnpm `package.json5` that names an old package: the tool does not read JSON5, so rename the
@@ -180,9 +203,14 @@ The report lists each of these with the file and line:
180
203
  `overrides` or `resolutions` (see
181
204
  [Libraries built on openapi-fetch](https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/fetch/index.md#libraries-built-on-openapi-fetch));
182
205
  - `transform` callbacks it cannot rewrite (also when their options use a type built from
183
- `OpenAPITSOptions`, such as `Partial<OpenAPITSOptions>`), and `postTransform` /
206
+ `OpenAPITSOptions`, such as `Partial<OpenAPITSOptions>`, or when the type declared for them
207
+ names another type, such as a local alias), and `postTransform` /
184
208
  `transformProperty`, also in options that other code shares, and `openapiTS()` calls whose options it cannot see (a
185
- parameter, a function call): they keep working with a deprecation warning; see
209
+ parameter, a function call). Options that take keys from another object (`{ ...base }`) are read
210
+ through it when the file writes it (`...{ … }` or a `const` with an object), so its callbacks are
211
+ reported and a `transform` in it is kept; a spread of anything else (an import, a call, a `let`)
212
+ is reported, since it may bring callbacks the tool cannot see. They keep working with a
213
+ deprecation warning; see
186
214
  [IR callbacks](https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/node.md#ir-callbacks).
187
215
 
188
216
  Then install, regenerate your types and commit them once (the file header names openapi-typesafe
@@ -202,7 +230,8 @@ The default log folder is new for each run and only you can open it (mode 0700).
202
230
  that exists gets the new lines appended, and missing parent folders are created.
203
231
 
204
232
  Exit codes: `0` done, `1` the migration failed (the message and the log say why), a file could not
205
- be written (the report names what was written), the project folder does not exist or is a file,
233
+ be written (the report names what was written), a bug of the tool left a file as it was (the report
234
+ lists it under "Skipped"), the project folder does not exist or is a file,
206
235
  or the log could not be created (nothing is changed then), `2` unknown option or argument.
207
236
 
208
237
  ## Versioning