Skip to content

Releases: hey-api/openapi-ts

@hey-api/[email protected]

06 Dec 17:52
eae21a2
Compare
Choose a tag to compare

Patch Changes

  • #1394 ec48d32 Thanks @mrlubos! - fix: disallow additional query parameters in experimental parser output

@hey-api/[email protected]

06 Dec 17:52
eae21a2
Compare
Choose a tag to compare

Patch Changes

  • #1394 ec48d32 Thanks @mrlubos! - fix: disallow additional query parameters in experimental parser output

@hey-api/[email protected]

05 Dec 00:05
8dd356f
Compare
Choose a tag to compare

Minor Changes

  • #1387 7c4335d Thanks @mrlubos! - feat: add logs.level option

    Added logs.level option

    You can now configure different log levels. As part of this feature, we had to introduce a breaking change by moving the debug option to logs.level. This will affect you if you're calling @hey-api/openapi-ts from Node.js (not CLI) or using the configuration file.

    export default {
      client: '@hey-api/client-fetch',
      debug: true, // [!code --]
      input: 'path/to/openapi.json',
      logs: {
        level: 'debug', // [!code ++]
      },
      output: 'src/client',
    };
  • #1389 f4c98ec Thanks @mrlubos! - feat: remove @hey-api/schemas from default plugins

    Updated default plugins

    @hey-api/schemas has been removed from the default plugins. To continue using it, add it to your plugins array.

    import { defaultPlugins } from '@hey-api/openapi-ts';
    
    export default {
      client: '@hey-api/client-fetch',
      experimentalParser: true,
      input: 'path/to/openapi.json',
      output: 'src/client',
      plugins: [
        ...defaultPlugins,
        '@hey-api/schemas', // [!code ++]
      ],
    };

Patch Changes

@hey-api/[email protected]

05 Dec 00:05
8dd356f
Compare
Choose a tag to compare

Patch Changes

  • #1391 fa8b0f1 Thanks @mrlubos! - fix: assign default fetch implementation dynamically to work with msw

@hey-api/[email protected]

02 Dec 07:15
df7618a
Compare
Choose a tag to compare

Minor Changes

  • #1353 efd3e54 Thanks @mrlubos! - feat: add typescript.identifierCase option

    Added typescript.identifierCase option

    This change affects only the experimental parser. By default, the generated TypeScript interfaces will follow the PascalCase naming convention. In the previous versions, we tried to preserve the original name as much as possible. To keep the previous behavior, set typescript.identifierCase to preserve.

    export default {
      client: '@hey-api/client-fetch',
      experimentalParser: true,
      input: 'path/to/openapi.json',
      output: 'src/client',
      plugins: [
        // ...other plugins
        {
          identifierCase: 'preserve', // [!code ++]
          name: '@hey-api/typescript',
        },
      ],
    };
  • #1360 5f6ddd7 Thanks @mrlubos! - fix: remove schemas and transformers re-exports from index.ts

    Removed schemas.gen.ts re-export

    index.ts will no longer re-export schemas.gen.ts to reduce the chance of producing broken output. Please update your code to import from schemas.gen.ts directly.

    import { mySchema } from 'client'; // [!code --]
    import { mySchema } from 'client/schemas.gen'; // [!code ++]

    Removed transformers.gen.ts re-export

    index.ts will no longer re-export transformers.gen.ts to reduce the chance of producing broken output. Please update your code to import from transformers.gen.ts directly.

    import { myTransformer } from 'client'; // [!code --]
    import { myTransformer } from 'client/transformers.gen'; // [!code ++]
  • #1360 5f6ddd7 Thanks @mrlubos! - feat: add output.clean option

    Added output.clean option

    By default, the output.path folder will be emptied on every run. To preserve the previous behavior, set output.clean to false.

    export default {
      client: '@hey-api/client-fetch',
      input: 'path/to/openapi.json',
      output: {
        clean: false, // [!code ++]
        path: 'src/client',
      },
    };
  • #1362 3bf7169 Thanks @mrlubos! - feat: add typescript.enumsCase option

Patch Changes

@hey-api/[email protected]

25 Nov 09:15
47026d4
Compare
Choose a tag to compare

Patch Changes

@hey-api/[email protected]

25 Nov 09:15
47026d4
Compare
Choose a tag to compare

Minor Changes

  • #1333 734a62d Thanks @mrlubos! - feat: add buildUrl() method

    Build URL

    ::: warning
    To use this feature, you must opt in to the experimental parser.
    :::

    If you need to access the compiled URL, you can use the buildUrl() method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint.

    type FooData = {
      path: {
        fooId: number;
      };
      query?: {
        bar?: string;
      };
      url: '/foo/{fooId}';
    };
    
    const url = client.buildUrl<FooData>({
      path: {
        fooId: 1,
      },
      query: {
        bar: 'baz',
      },
      url: '/foo/{fooId}',
    });
    console.log(url); // prints '/foo/1?bar=baz'

Patch Changes

@hey-api/[email protected]

25 Nov 09:15
47026d4
Compare
Choose a tag to compare

Patch Changes

@hey-api/[email protected]

22 Nov 11:20
0ccd494
Compare
Choose a tag to compare

Minor Changes

  • #1324 4e62378 Thanks @mrlubos! - feat: rename Hey API plugins

    Renamed @hey-api/services plugin

    This plugin has been renamed to @hey-api/sdk.

    Changed sdk.output value

    To align with the updated name, the @hey-api/sdk plugin will generate an sdk.gen.ts file. This will result in a breaking change if you're importing from services.gen.ts. Please update your imports to reflect this change.

    import { client } from 'client/services.gen'; // [!code --]
    import { client } from 'client/sdk.gen'; // [!code ++]

    Renamed @hey-api/types plugin

    This plugin has been renamed to @hey-api/typescript.

  • #1327 62e37d5 Thanks @mrlubos! - feat: add typescript.exportInlineEnums option

    Added typescript.exportInlineEnums option

    By default, inline enums (enums not defined as reusable components in the input file) will be generated only as inlined union types. You can set exportInlineEnums to true to treat inline enums as reusable components. When true, the exported enums will follow the style defined in enums.

    This is a breaking change since in the previous versions, inline enums were always treated as reusable components. To preserve your current output, set exportInlineEnums to true. This feature works only with the experimental parser.

    export default {
      client: '@hey-api/client-fetch',
      experimentalParser: true,
      input: 'path/to/openapi.json',
      output: 'src/client',
      plugins: [
        // ...other plugins
        {
          exportInlineEnums: true, // [!code ++]
          name: '@hey-api/typescript',
        },
      ],
    };

Patch Changes

@hey-api/[email protected]

21 Nov 12:28
00417a7
Compare
Choose a tag to compare

Patch Changes