diff --git a/.changeset/olive-dots-sing.md b/.changeset/olive-dots-sing.md deleted file mode 100644 index 97610118a..000000000 --- a/.changeset/olive-dots-sing.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-typescript": minor ---- - -Works around an issue where operation IDs containing the "#" character failed to generate teh correct type mappings diff --git a/packages/openapi-typescript/CHANGELOG.md b/packages/openapi-typescript/CHANGELOG.md index 85de8c409..1cfb151ba 100644 --- a/packages/openapi-typescript/CHANGELOG.md +++ b/packages/openapi-typescript/CHANGELOG.md @@ -2,41 +2,47 @@ ## 7.0.0 +### Minor Changes + +- [#1545](https://github.com/drwpow/openapi-typescript/pull/1545) [`9158b81`](https://github.com/drwpow/openapi-typescript/commit/9158b81e8fdd45491afde8e291a786d7b2abc154) Thanks [@jaredLunde](https://github.com/jaredLunde)! - Works around an issue where operation IDs containing the "#" character failed to generate teh correct type mappings + +## 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"; + ```diff + + import ts from "typescript"; - + const DATE = ts.factory.createIdentifier("Date"); - + const NULL = ts.factory.createLiteralTypeNode(ts.factory.createNull()); + + 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; - } - }, - }; - ``` + 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). + 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. + 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. + 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` + - 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. diff --git a/packages/openapi-typescript/package.json b/packages/openapi-typescript/package.json index be040373f..de80546c3 100644 --- a/packages/openapi-typescript/package.json +++ b/packages/openapi-typescript/package.json @@ -1,7 +1,7 @@ { "name": "openapi-typescript", "description": "Convert OpenAPI 3.0 & 3.1 schemas to TypeScript", - "version": "7.0.0-next.0", + "version": "7.0.0", "author": { "name": "Drew Powers", "email": "drew@pow.rs"