Skip to content

[ci] release #1553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/olive-dots-sing.md

This file was deleted.

52 changes: 29 additions & 23 deletions packages/openapi-typescript/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-typescript/package.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
Expand Down