Skip to content

Releases: hey-api/openapi-ts

@hey-api/[email protected]

06 Nov 10:15
4a4f582
Compare
Choose a tag to compare

Patch Changes

  • #1237 63ccc07 Thanks @mrlubos! - fix: forbid any body, path, or query parameters if not defined in spec

  • #1235 7a1a419 Thanks @mrlubos! - fix: handle additionalProperties: boolean in experimental parser

  • #1233 08baa77 Thanks @mrlubos! - fix: update schemas plugin to handle experimental 3.0.x parser

    This release adds an experimental parser for OpenAPI versions 3.0.x. In the future, this will become the default parser. If you're using OpenAPI 3.0 or newer, we encourage you to try it out today.

    You can enable the experimental parser by setting the experimentalParser boolean flag to true in your configuration file or CLI.

    export default {
      client: '@hey-api/client-fetch',
      input: 'path/to/openapi.json',
      output: 'src/client',
      experimentalParser: true,
    };
    npx @hey-api/openapi-ts -i path/to/openapi.json -o src/client -c @hey-api/client-fetch -e

    The generated output should not structurally change, despite few things being generated in a different order. In fact, the output should be cleaner! That's the immediate side effect you should notice. If that's not true, please leave feedback in GitHub issues.

    Hey API parser marks an important milestone towards v1 of @hey-api/openapi-ts. More features will be added to the parser in the future and the original parser from openapi-typescript-codegen will be deprecated and used only for generating legacy clients.

    If you'd like to work with the parser more closely (e.g. to generate code not natively supported by this package), feel free to reach out with any feedback or suggestions. Happy parsing! 🎉

@hey-api/[email protected]

05 Nov 18:36
448910b
Compare
Choose a tag to compare

Patch Changes

  • #1230 3e65ae0 Thanks @mrlubos! - feat: add OpenAPI 3.0.x experimental parser

    This release adds an experimental parser for OpenAPI versions 3.0.x. In the future, this will become the default parser. If you're using OpenAPI 3.0 or newer, we encourage you to try it out today.

    You can enable the experimental parser by setting the experimentalParser boolean flag to true in your configuration file or CLI.

    export default {
      client: '@hey-api/client-fetch',
      input: 'path/to/openapi.json',
      output: 'src/client',
      experimentalParser: true,
    };
    npx @hey-api/openapi-ts -i path/to/openapi.json -o src/client -c @hey-api/client-fetch -e

    The generated output should not structurally change, despite few things being generated in a different order. In fact, the output should be cleaner! That's the immediate side effect you should notice. If that's not true, please leave feedback in GitHub issues.

    Hey API parser marks an important milestone towards v1 of @hey-api/openapi-ts. More features will be added to the parser in the future and the original parser from openapi-typescript-codegen will be deprecated and used only for generating legacy clients.

    If you'd like to work with the parser more closely (e.g. to generate code not natively supported by this package), feel free to reach out with any feedback or suggestions. Happy parsing! 🎉

@hey-api/[email protected]

01 Nov 17:26
2d52fd0
Compare
Choose a tag to compare

Patch Changes

  • #1222 ceb4363 Thanks @mrlubos! - feat: add support for @tanstack/angular-query-experimental package

@hey-api/[email protected]

29 Oct 12:56
13e0065
Compare
Choose a tag to compare

Patch Changes

  • #1211 c8a3e3d Thanks @mrlubos! - fix: ignore name option when not used with legacy clients to avoid producing broken output

  • #1209 3a80b9f Thanks @mrlubos! - fix: add support for OpenAPI 3.1.1 to experimental parser

@hey-api/[email protected]

28 Oct 13:20
fad7803
Compare
Choose a tag to compare

Minor Changes

  • #1201 972a93a Thanks @mrlubos! - feat: make plugins first-class citizens

    This release makes plugins first-class citizens. In order to achieve that, the following breaking changes were introduced.

    Removed CLI options

    The --types, --schemas, and --services CLI options have been removed. You can list which plugins you'd like to use explicitly by passing a list of plugins as --plugins <plugin1> <plugin2>

    Removed *.export option

    Previously, you could explicitly disable export of certain artifacts using the *.export option or its shorthand variant. These were both removed. You can now disable export of specific artifacts by manually defining an array of plugins and excluding the unwanted plugin.

    ::: code-group

    export default {
      client: '@hey-api/client-fetch',
      input: 'path/to/openapi.json',
      output: 'src/client',
      schemas: false, // [!code --]
      plugins: ['@hey-api/types', '@hey-api/services'], // [!code ++]
    };
    export default {
      client: '@hey-api/client-fetch',
      input: 'path/to/openapi.json',
      output: 'src/client',
      schemas: {
        export: false, // [!code --]
      },
      plugins: ['@hey-api/types', '@hey-api/services'], // [!code ++]
    };

    :::

    Renamed schemas.name option

    Each plugin definition contains a name field. This was conflicting with the schemas.name option. As a result, it has been renamed to nameBuilder.

    export default {
      client: '@hey-api/client-fetch',
      input: 'path/to/openapi.json',
      output: 'src/client',
      schemas: {
        name: (name) => `${name}Schema`, // [!code --]
      },
      plugins: [
        // ...other plugins
        {
          nameBuilder: (name) => `${name}Schema`, // [!code ++]
          name: '@hey-api/schemas',
        },
      ],
    };

    Removed services.include shorthand option

    Previously, you could use a string value as a shorthand for the services.include configuration option. You can now achieve the same result using the include option.

    export default {
      client: '@hey-api/client-fetch',
      input: 'path/to/openapi.json',
      output: 'src/client',
      services: '^MySchema', // [!code --]
      plugins: [
        // ...other plugins
        {
          include: '^MySchema', // [!code ++]
          name: '@hey-api/services',
        },
      ],
    };

    Renamed services.name option

    Each plugin definition contains a name field. This was conflicting with the services.name option. As a result, it has been renamed to serviceNameBuilder.

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

    Renamed types.dates option

    Previously, you could set types.dates to a boolean or a string value, depending on whether you wanted to transform only type strings into dates, or runtime code too. Many people found these options confusing, so they have been simplified to a boolean and extracted into a separate @hey-api/transformers plugin.

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

    Removed types.include shorthand option

    Previously, you could use a string value as a shorthand for the types.include configuration option. You can now achieve the same result using the include option.

    export default {
      client: '@hey-api/client-fetch',
      input: 'path/to/openapi.json',
      output: 'src/client',
      types: '^MySchema', // [!code --]
      plugins: [
        // ...other plugins
        {
          include: '^MySchema', // [!code ++]
          name: '@hey-api/types',
        },
      ],
    };

    Renamed types.name option

    Each plugin definition contains a name field. This was conflicting with the types.name option. As a result, it has been renamed to style.

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

@hey-api/[email protected]

25 Oct 12:10
245c37a
Compare
Choose a tag to compare

Patch Changes

@hey-api/[email protected]

13 Oct 18:58
e123eb4
Compare
Choose a tag to compare

Patch Changes

@hey-api/[email protected]

13 Oct 18:58
e123eb4
Compare
Choose a tag to compare

Patch Changes

@hey-api/[email protected]

13 Oct 18:58
e123eb4
Compare
Choose a tag to compare

Patch Changes

@hey-api/[email protected]

11 Oct 17:43
50cf1d8
Compare
Choose a tag to compare

Patch Changes

  • #1145 a0a5551 Thanks @mrlubos! - fix: update license field in package.json to match the license, revert client packages license to MIT