From cc8817e2f4534c8fdc8c1f605cf0384fee69dc50 Mon Sep 17 00:00:00 2001 From: Drew Powers <drew@pow.rs> Date: Tue, 3 Oct 2023 22:07:57 -0600 Subject: [PATCH] Bump version --- .changeset/beige-students-wink.md | 5 -- .changeset/blue-ladybugs-laugh.md | 5 -- .changeset/giant-scissors-repeat.md | 5 -- .changeset/happy-lamps-bathe.md | 5 -- .changeset/lazy-ads-add.md | 5 -- .changeset/modern-bobcats-think.md | 5 -- .changeset/nasty-candles-rescue.md | 5 -- .changeset/rude-jokes-grin.md | 11 ---- .changeset/shaggy-adults-obey.md | 5 -- .changeset/shaggy-experts-confess.md | 7 --- .changeset/shaggy-windows-worry.md | 5 -- .changeset/short-llamas-listen.md | 5 -- .changeset/thirty-turkeys-leave.md | 5 -- .changeset/warm-masks-decide.md | 8 --- .changeset/wise-coins-hug.md | 29 ---------- packages/openapi-typescript/CHANGELOG.md | 73 ++++++++++++++++++++++++ 16 files changed, 73 insertions(+), 110 deletions(-) delete mode 100644 .changeset/beige-students-wink.md delete mode 100644 .changeset/blue-ladybugs-laugh.md delete mode 100644 .changeset/giant-scissors-repeat.md delete mode 100644 .changeset/happy-lamps-bathe.md delete mode 100644 .changeset/lazy-ads-add.md delete mode 100644 .changeset/modern-bobcats-think.md delete mode 100644 .changeset/nasty-candles-rescue.md delete mode 100644 .changeset/rude-jokes-grin.md delete mode 100644 .changeset/shaggy-adults-obey.md delete mode 100644 .changeset/shaggy-experts-confess.md delete mode 100644 .changeset/shaggy-windows-worry.md delete mode 100644 .changeset/short-llamas-listen.md delete mode 100644 .changeset/thirty-turkeys-leave.md delete mode 100644 .changeset/warm-masks-decide.md delete mode 100644 .changeset/wise-coins-hug.md diff --git a/.changeset/beige-students-wink.md b/.changeset/beige-students-wink.md deleted file mode 100644 index a20abaaf9..000000000 --- a/.changeset/beige-students-wink.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": minor ---- - -✨ **Feature**: add `formatOptions` to allow formatting TS output diff --git a/.changeset/blue-ladybugs-laugh.md b/.changeset/blue-ladybugs-laugh.md deleted file mode 100644 index 548dda45f..000000000 --- a/.changeset/blue-ladybugs-laugh.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": major ---- - -⚠️ **Breaking**: Most optional objects are now always present in types, just typed as `:never`. This includes keys of the Components Object as well as HTTP methods. diff --git a/.changeset/giant-scissors-repeat.md b/.changeset/giant-scissors-repeat.md deleted file mode 100644 index 578dc9ad1..000000000 --- a/.changeset/giant-scissors-repeat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": minor ---- - -✨ **Feature**: add `enum` option to export top-level enums from schemas diff --git a/.changeset/happy-lamps-bathe.md b/.changeset/happy-lamps-bathe.md deleted file mode 100644 index e4f453b57..000000000 --- a/.changeset/happy-lamps-bathe.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": patch ---- - -🧹 Cleaned up and reorganized all tests diff --git a/.changeset/lazy-ads-add.md b/.changeset/lazy-ads-add.md deleted file mode 100644 index 4197ecf15..000000000 --- a/.changeset/lazy-ads-add.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": major ---- - -⚠️ **Breaking**: No more `external` export in schemas anymore. Everything gets flattened into the `components` object instead (if referencing a schema object from a remote partial, note it may have had a minor name change to avoid conflict). diff --git a/.changeset/modern-bobcats-think.md b/.changeset/modern-bobcats-think.md deleted file mode 100644 index 2ee8d6f50..000000000 --- a/.changeset/modern-bobcats-think.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": minor ---- - -✨ **Feature**: header responses add `[key: string]: unknown` index type to allow for additional untyped headers diff --git a/.changeset/nasty-candles-rescue.md b/.changeset/nasty-candles-rescue.md deleted file mode 100644 index 746612a1d..000000000 --- a/.changeset/nasty-candles-rescue.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": patch ---- - -Refactor internals to use TypeScript AST rather than string mashing diff --git a/.changeset/rude-jokes-grin.md b/.changeset/rude-jokes-grin.md deleted file mode 100644 index 7d9889d39..000000000 --- a/.changeset/rude-jokes-grin.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"openapi-typescript": major ---- - -⚠️ **Breaking**: Changing of several CLI flags and Node.js API options - -- The `--auth`, `--httpHeaders`, `--httpMethod`, and `fetch` (Node.js-only) options were all removed from the CLI and Node.js API - - To migrate, you’ll need to create a [redocly.yaml config](https://redocly.com/docs/cli/configuration/) that specifies your auth options [in the http setting](https://redocly.com/docs/cli/configuration/#resolve-non-public-or-non-remote-urls) - - You can also set your fetch client in redocly.yaml as well. -- `--immutable-types` has been renamed to `--immutable` -- `--support-array-length` has been renamed to `--array-length` diff --git a/.changeset/shaggy-adults-obey.md b/.changeset/shaggy-adults-obey.md deleted file mode 100644 index a2fda02b4..000000000 --- a/.changeset/shaggy-adults-obey.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": major ---- - -⚠️ **Breaking** `defaultNonNullable` option now defaults to `true`. You’ll now need to manually set `false` to return to old behavior. diff --git a/.changeset/shaggy-experts-confess.md b/.changeset/shaggy-experts-confess.md deleted file mode 100644 index 2afb1b7a4..000000000 --- a/.changeset/shaggy-experts-confess.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"openapi-typescript": minor ---- - -✨ **Feature**: bundle schemas with Redocly CLI - -- Any options passed into your [redocly.yaml config](https://redocly.com/docs/cli/configuration/) are respected diff --git a/.changeset/shaggy-windows-worry.md b/.changeset/shaggy-windows-worry.md deleted file mode 100644 index 140809f54..000000000 --- a/.changeset/shaggy-windows-worry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": major ---- - -⚠️ **Breaking**: Remove globbing schemas in favor of `redocly.yaml` config. Specify multiple schemas with outputs in there instead. See [Multiple schemas](https://openapi-ts.pages.dev/docs/cli/#multiple-schemas) for more info. diff --git a/.changeset/short-llamas-listen.md b/.changeset/short-llamas-listen.md deleted file mode 100644 index 637c4f7a0..000000000 --- a/.changeset/short-llamas-listen.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": minor ---- - -✨ **Feature:** allow configuration of schemas via `apis` key in redocly.config.yaml. [See docs](https://openapi-ts.pages.dev/cli/) for more info. diff --git a/.changeset/thirty-turkeys-leave.md b/.changeset/thirty-turkeys-leave.md deleted file mode 100644 index 94f3c6e30..000000000 --- a/.changeset/thirty-turkeys-leave.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": major ---- - -⚠️ **Breaking**: additionalProperties no longer have `| undefined` automatically appended diff --git a/.changeset/warm-masks-decide.md b/.changeset/warm-masks-decide.md deleted file mode 100644 index b2b5ad5d5..000000000 --- a/.changeset/warm-masks-decide.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"openapi-typescript": minor ---- - -✨ **Feature**: automatically validate schemas with Redocly CLI ([docs](https://redocly.com/docs/cli/)). No more need for external tools to report errors! 🎉 - -- By default, it will only throw on actual schema errors (uses Redocly’s default settings) -- For stricter linting or custom rules, you can create a [redocly.yaml config](https://redocly.com/docs/cli/configuration/) diff --git a/.changeset/wise-coins-hug.md b/.changeset/wise-coins-hug.md deleted file mode 100644 index da01c8f05..000000000 --- a/.changeset/wise-coins-hug.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -"openapi-typescript": major ---- - -⚠️ **Breaking**: The Node.js API now returns the TypeScript AST for the main method as well as `transform()` and `postTransform()`. To migrate, you’ll have to use the `typescript` compiler API: - -```diff -+ import ts from "typescript"; - -+ const DATE = ts.factory.createIdentifier("Date"); -+ const NULL = ts.factory.createLiteralTypeNode(ts.factory.createNull()); - - const ast = await openapiTS(mySchema, { - transform(schemaObject, metadata) { - if (schemaObject.format === "date-time") { -- return schemaObject.nullable ? "Date | null" : "Date"; -+ return schemaObject.nullable -+ ? ts.factory.createUnionTypeNode([DATE, NULL]) -+ : DATE; - } - }, - }; -``` - -Though it’s more verbose, it’s also more powerful, as now you have access to additional properties of the generated code you didn’t before (such as injecting comments). - -For example syntax, search this codebae to see how the TypeScript AST is used. - -Also see [AST Explorer](https://astexplorer.net/)’s `typescript` parser to inspect how TypeScript is interpreted as an AST. diff --git a/packages/openapi-typescript/CHANGELOG.md b/packages/openapi-typescript/CHANGELOG.md index 1b8963b3d..12a1a96bc 100644 --- a/packages/openapi-typescript/CHANGELOG.md +++ b/packages/openapi-typescript/CHANGELOG.md @@ -1,5 +1,78 @@ # openapi-typescript +## 7.0.0 + +### Major Changes + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ⚠️ **Breaking**: The Node.js API now returns the TypeScript AST for the main method as well as `transform()` and `postTransform()`. To migrate, you’ll have to use the `typescript` compiler API: + + ```diff + + import ts from "typescript"; + + + const DATE = ts.factory.createIdentifier("Date"); + + const NULL = ts.factory.createLiteralTypeNode(ts.factory.createNull()); + + const ast = await openapiTS(mySchema, { + transform(schemaObject, metadata) { + if (schemaObject.format === "date-time") { + - return schemaObject.nullable ? "Date | null" : "Date"; + + return schemaObject.nullable + + ? ts.factory.createUnionTypeNode([DATE, NULL]) + + : DATE; + } + }, + }; + ``` + + Though it’s more verbose, it’s also more powerful, as now you have access to additional properties of the generated code you didn’t before (such as injecting comments). + + For example syntax, search this codebae to see how the TypeScript AST is used. + + Also see [AST Explorer](https://astexplorer.net/)’s `typescript` parser to inspect how TypeScript is interpreted as an AST. + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ⚠️ **Breaking**: Changing of several CLI flags and Node.js API options + + - The `--auth`, `--httpHeaders`, `--httpMethod`, and `fetch` (Node.js-only) options were all removed from the CLI and Node.js API + - To migrate, you’ll need to create a [redocly.yaml config](https://redocly.com/docs/cli/configuration/) that specifies your auth options [in the http setting](https://redocly.com/docs/cli/configuration/#resolve-non-public-or-non-remote-urls) + - You can also set your fetch client in redocly.yaml as well. + - `--immutable-types` has been renamed to `--immutable` + - `--support-array-length` has been renamed to `--array-length` + +- [`fbaf96d`](https://github.com/drwpow/openapi-typescript/commit/fbaf96d33181a2fabd3d4748e54c0f111ed6756e) Thanks [@drwpow](https://github.com/drwpow)! - ⚠️ **Breaking**: Remove globbing schemas in favor of `redocly.yaml` config. Specify multiple schemas with outputs in there instead. See [Multiple schemas](https://openapi-ts.pages.dev/docs/cli/#multiple-schemas) for more info. + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ⚠️ **Breaking**: Most optional objects are now always present in types, just typed as `:never`. This includes keys of the Components Object as well as HTTP methods. + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ⚠️ **Breaking**: No more `external` export in schemas anymore. Everything gets flattened into the `components` object instead (if referencing a schema object from a remote partial, note it may have had a minor name change to avoid conflict). + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ⚠️ **Breaking** `defaultNonNullable` option now defaults to `true`. You’ll now need to manually set `false` to return to old behavior. + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ⚠️ **Breaking**: additionalProperties no longer have `| undefined` automatically appended + +### Minor Changes + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ✨ **Feature**: automatically validate schemas with Redocly CLI ([docs](https://redocly.com/docs/cli/)). No more need for external tools to report errors! 🎉 + + - By default, it will only throw on actual schema errors (uses Redocly’s default settings) + - For stricter linting or custom rules, you can create a [redocly.yaml config](https://redocly.com/docs/cli/configuration/) + +- [`312b7ba`](https://github.com/drwpow/openapi-typescript/commit/312b7ba03fc0334153d4eeb51d6159f3fc63934e) Thanks [@drwpow](https://github.com/drwpow)! - ✨ **Feature:** allow configuration of schemas via `apis` key in redocly.config.yaml. [See docs](https://openapi-ts.pages.dev/cli/) for more info. + + - Any options passed into your [redocly.yaml config](https://redocly.com/docs/cli/configuration/) are respected + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ✨ **Feature**: add `enum` option to export top-level enums from schemas + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ✨ **Feature**: add `formatOptions` to allow formatting TS output + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ✨ **Feature**: header responses add `[key: string]: unknown` index type to allow for additional untyped headers + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - ✨ **Feature**: bundle schemas with Redocly CLI + +### Patch Changes + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - Refactor internals to use TypeScript AST rather than string mashing + +- [`6d1eb32`](https://github.com/drwpow/openapi-typescript/commit/6d1eb32e610cb62effbd1a817ae8fc93337126a6) Thanks [@drwpow](https://github.com/drwpow)! - 🧹 Cleaned up and reorganized all tests + ## 6.7.0 ### Minor Changes