Skip to content

Releases: openapi-ts/openapi-typescript

openapi-typescript@7.1.1

29 Jul 14:56
4215f50
Compare
Choose a tag to compare

Patch Changes

  • #1784 c2f8655 Thanks @yoshi2no! - Fix: Correct handling of identical minItems and maxItems in array schemas when arrayLength option is true

openapi-typescript@7.1.0

19 Jul 18:05
30b93bb
Compare
Choose a tag to compare

Minor Changes

Patch Changes

openapi-typescript@7.0.4

17 Jul 14:11
990a16f
Compare
Choose a tag to compare

Patch Changes

  • #1746 e705909 Thanks @phk422! - fix: Correct handling of default parameter values in referenced component schema

openapi-typescript@7.0.3

16 Jul 20:54
855d5b8
Compare
Choose a tag to compare

Patch Changes

  • #1761 8043c5d Thanks @yoshi2no! - fix: Enum option cannot generate enums if values are not valid property names

openapi-typescript@7.0.2

04 Jul 13:46
45cea6b
Compare
Choose a tag to compare

Patch Changes

openapi-typescript@7.0.1

02 Jul 15:50
3a39b68
Compare
Choose a tag to compare

Patch Changes

openapi-fetch@0.10.2

24 Jun 17:03
a9f529e
Compare
Choose a tag to compare

Patch Changes

openapi-fetch@0.10.1

21 Jun 23:25
ff93eac
Compare
Choose a tag to compare

Patch Changes

openapi-typescript@7.0.0

20 Jun 03:48
d7494ba
Compare
Choose a tag to compare

Major Changes

  • 6d1eb32 Thanks @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:

    + 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, and fetch (Node.js-only) options were all removed from the CLI and Node.js API
    • --immutable-types has been renamed to --immutable
    • --support-array-length has been renamed to --array-length
  • fbaf96d Thanks @drwpow! - ⚠️ Breaking: Remove globbing schemas in favor of redocly.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 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 Thanks @drwpow! - ⚠️ Breaking defaultNonNullable option now defaults to true. You’ll now need to manually set false to return to old behavior.

  • 799194d Thanks @drwpow~ - ⚠️ Breaking TypeScript is now a peerDependency and must be installed alongside openapi-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 via apis key in redocly.config.yaml. See docs for more info.

  • 6d1eb32 Thanks @drwpow! - ✨ Feature: add enum option to export top-level enums from schemas

  • 6d1eb32 Thanks @drwpow! - ✨ Feature: add formatOptions 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

  • 6d1eb32 Thanks @drwpow! - Refactor internals to use TypeScript AST rather than string mashing

  • 6d1eb32 Thanks @drwpow! - 🧹 Cleaned up and reorganized all tests

  • #1602 9da96cd Thanks @JeanRemiDelteil! - Do not add readonly on Typescript enum when the --immutable option is used.

openapi-fetch@0.10.0

20 Jun 03:47
b43f815
Compare
Choose a tag to compare

Minor Changes

  • ⚠️ Breaking Change: openapi-typescript@7 is needed to work. You’ll get type errors with openapi-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: The Content-Type header is no longer sent by default if a body payload is attached.

  • ⚠️ Breaking Change: The customFetch type now calls fetch(input: string, init: RequestInit) and the types have been updated, rather than fetch(input: Request) introduced in 0.9.0. Edit: this has been reverted due to errors reported in some environments. The 0.9.0 behavior is still present where fetch(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