Skip to content

Releases: hey-api/openapi-ts

@hey-api/[email protected]

24 Jun 19:50
3a39e0d
Compare
Choose a tag to compare

Minor Changes

  • #2227 4ea6f24 Thanks @mrlubos! - refactor(plugin): add DefinePlugin utility types

    Updated Plugin API

    Please refer to the custom plugin tutorial for the latest guide.

  • #2227 4ea6f24 Thanks @mrlubos! - feat(sdk): update validator option

    Updated sdk.validator option

    Clients can now validate both request and response data. As a result, passing a boolean or string to validator will control both of these options. To preserve the previous behavior, set validator.request to false and validator.response to your previous configuration.

    export default {
      input: 'https://get.heyapi.dev/hey-api/backend',
      output: 'src/client',
      plugins: [
        // ...other plugins
        {
          name: '@hey-api/sdk',
          validator: {
            request: false,
            response: true,
          },
        },
      ],
    };

Patch Changes

@hey-api/[email protected]

22 Jun 21:02
acac297
Compare
Choose a tag to compare

Minor Changes

  • #2226 1c66d88 Thanks @mrlubos! - feat(valibot): generate a single schema for requests

    Single Valibot schema per request

    Previously, we generated a separate schema for each endpoint parameter and request body. In v0.76.0, a single request schema is generated for the whole endpoint. It may contain a request body, parameters, and headers.

    const vData = v.object({
      body: v.optional(
        v.object({
          foo: v.optional(v.string()),
          bar: v.optional(v.union([v.number(), v.null()])),
        }),
      ),
      headers: v.optional(v.never()),
      path: v.object({
        baz: v.string(),
      }),
      query: v.optional(v.never()),
    });

    If you need to access individual fields, you can do so using the .entries API. For example, we can get the request body schema with vData.entries.body.

Patch Changes

  • #2221 e335e1e Thanks @mrlubos! - fix(parser): prefer JSON media type

  • #2226 1c66d88 Thanks @mrlubos! - fix(valibot): add metadata option to generate additional metadata for documentation, code generation, AI structured outputs, form validation, and other purposes

@hey-api/[email protected]

21 Jun 19:35
5d85d29
Compare
Choose a tag to compare

Minor Changes

  • #2215 82e56e9 Thanks @mrlubos! - feat(parser): replace plugin.subscribe() with plugin.forEach()

    Added plugin.forEach() method

    This method replaces the .subscribe() method. Additionally, .forEach() is executed immediately, which means we don't need the before and after events – simply move your code before and after the .forEach() block.

    plugin.forEach('operation', 'schema', (event) => {
      // do something with event
    });
  • #2218 e5ff024 Thanks @mrlubos! - feat(tanstack-query): add name and case options

    Updated TanStack Query options

    The TanStack Query plugin options have been expanded to support more naming and casing patterns. As a result, the following options have been renamed.

    • queryOptionsNameBuilder renamed to queryOptions
    • infiniteQueryOptionsNameBuilder renamed to infiniteQueryOptions
    • mutationOptionsNameBuilder renamed to mutationOptions
    • queryKeyNameBuilder renamed to queryKeys
    • infiniteQueryKeyNameBuilder renamed to infiniteQueryKeys

Patch Changes

@hey-api/[email protected]

19 Jun 16:00
c778f69
Compare
Choose a tag to compare

Minor Changes

  • #2201 ab8cede Thanks @mrlubos! - feat(zod): generate a single schema for requests

    Single Zod schema per request

    Previously, we generated a separate schema for each endpoint parameter and request body. In v0.74.0, a single request schema is generated for the whole endpoint. It may contain a request body, parameters, and headers.

    const zData = z.object({
      body: z
        .object({
          foo: z.string().optional(),
          bar: z.union([z.number(), z.null()]).optional(),
        })
        .optional(),
      headers: z.never().optional(),
      path: z.object({
        baz: z.string(),
      }),
      query: z.never().optional(),
    });

    If you need to access individual fields, you can do so using the .shape API. For example, we can get the request body schema with zData.shape.body.

Patch Changes

  • #2192 7a740ed Thanks @Daschi1! - fix(valibot): use isoTimestamp instead of isoDateTime for date-time format

  • #2201 a889c3c Thanks @mrlubos! - fix(parser): do not mark schemas as duplicate if they have different format

@hey-api/[email protected]

14 Jun 08:44
ba29123
Compare
Choose a tag to compare

Minor Changes

  • #2172 29605a0 Thanks @mrlubos! - feat: bundle @hey-api/client-* plugins

    Bundle @hey-api/client-* plugins

    In previous releases, you had to install a separate client package to generate a fully working output, e.g. npm install @hey-api/client-fetch. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run @hey-api/openapi-ts.

    npm uninstall @hey-api/client-fetch

Patch Changes

@hey-api/[email protected]

14 Jun 09:17
95f1ae7
Compare
Choose a tag to compare

Minor Changes

@hey-api/[email protected]

12 Jun 12:15
7365e4a
Compare
Choose a tag to compare

Patch Changes

  • #2163 9769998 Thanks @mrlubos! - fix(zod): add metadata option to generate additional metadata for documentation, code generation, AI structured outputs, form validation, and other purposes

  • #2167 a46259e Thanks @mrlubos! - fix(tanstack-query): add name builder options for all generated artifacts

  • #2166 594f3a6 Thanks @mrlubos! - fix(parser): filter orphans only when there are some operations

  • #2166 594f3a6 Thanks @mrlubos! - fix(zod): support tuple types

  • #2167 a46259e Thanks @mrlubos! - fix(parser): set correct subscription context for plugins

@hey-api/[email protected]

12 Jun 12:15
7365e4a
Compare
Choose a tag to compare

Patch Changes

@hey-api/[email protected]

12 Jun 12:15
7365e4a
Compare
Choose a tag to compare

Patch Changes

@hey-api/[email protected]

12 Jun 12:15
7365e4a
Compare
Choose a tag to compare

Patch Changes