Releases: openapi-ts/openapi-typescript
openapi-typescript@7.1.1
openapi-typescript@7.1.0
Minor Changes
Patch Changes
-
#1772
41cb9a2
Thanks @ashwin153! - fix: add explicit import of performance to fix bazel compatibility issues -
#1764
2793049
Thanks @michalfedyna! - Fix --properties-required-by-default flag not working -
#1763
19b9383
Thanks @nkt! - fix: schema.content might be omitted
openapi-typescript@7.0.4
openapi-typescript@7.0.3
openapi-typescript@7.0.2
openapi-typescript@7.0.1
openapi-fetch@0.10.2
openapi-fetch@0.10.1
openapi-typescript@7.0.0
Major Changes
-
6d1eb32
Thanks @drwpow! -⚠️ Breaking: The Node.js API now returns the TypeScript AST for the main method as well astransform()
andpostTransform()
. To migrate, you’ll have to use thetypescript
compiler API:+ 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’s
typescript
parser to inspect how TypeScript is interpreted as an AST. -
6d1eb32
Thanks @drwpow! -⚠️ Breaking: Changing of several CLI flags and Node.js API options- The
--auth
,--httpHeaders
,--httpMethod
, andfetch
(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 that specifies your auth options in the http setting
- 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
-
fbaf96d
Thanks @drwpow! -⚠️ Breaking: Remove globbing schemas in favor ofredocly.yaml
config. Specify multiple schemas with outputs in there instead. See Multiple schemas for more info. -
6d1eb32
Thanks @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
Thanks @drwpow! -⚠️ Breaking: No moreexternal
export in schemas anymore. Everything gets flattened into thecomponents
object instead (if referencing a schema object from a remote partial, note it may have had a minor name change to avoid conflict). -
6d1eb32
Thanks @drwpow! -⚠️ BreakingdefaultNonNullable
option now defaults totrue
. You’ll now need to manually setfalse
to return to old behavior. -
799194d
Thanks @drwpow~ -⚠️ Breaking TypeScript is now a peerDependency and must be installed alongsideopenapi-typescript
Minor Changes
-
6d1eb32
Thanks @drwpow! - ✨ Feature: automatically validate schemas with Redocly CLI (docs). 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
-
312b7ba
Thanks @drwpow! - ✨ Feature: allow configuration of schemas viaapis
key in redocly.config.yaml. See docs for more info.- Any options passed into your redocly.yaml config are respected
-
6d1eb32
Thanks @drwpow! - ✨ Feature: addenum
option to export top-level enums from schemas -
6d1eb32
Thanks @drwpow! - ✨ Feature: addformatOptions
to allow formatting TS output -
6d1eb32
Thanks @drwpow! - ✨ Feature: header responses add[key: string]: unknown
index type to allow for additional untyped headers -
6d1eb32
Thanks @drwpow! - ✨ Feature: bundle schemas with Redocly CLI -
6d1eb32
Thanks @drwpow! - ✨ Feature: Added debugger that lets you profile performance and see more in-depth messages -
#1374
7ac5174
Thanks @ElForastero! - Add support for x-enum-varnames and x-enum-descriptions -
#1545
9158b81
Thanks @jaredLunde! - Replace # characters in operation IDs with a slash
Patch Changes
openapi-fetch@0.10.0
Minor Changes
-
⚠️ Breaking Change:openapi-typescript@7
is needed to work. You’ll get type errors withopenapi-typescript@6
and below. -
⚠️ Breaking Change: The Middleware API has changed to be an object rather than(request, options)
or(response, options)
. See Middleware docs for updated API. -
⚠️ Breaking Change: TheContent-Type
header is no longer sent by default if a body payload is attached. -
⚠️ Breaking Change: TheEdit: this has been reverted due to errors reported in some environments. ThecustomFetch
type now callsfetch(input: string, init: RequestInit)
and the types have been updated, rather thanfetch(input: Request)
introduced in0.9.0
.0.9.0
behavior is still present wherefetch(input: Request)
is called for the final request. -
⚠️ Breaking Change: the error type no longer is a union of all possible values; it will take the first it finds (due to some error type in some schemas being missing or incomplete, resulting in an unresolvable union)
Patch Changes
- Added
id
to middleware handlers that create a unique ID per-fetch