github hey-api/openapi-ts @hey-api/openapi-ts@0.74.0

latest releases: @hey-api/openapi-ts@0.82.4, @hey-api/nuxt@0.2.1, @hey-api/openapi-ts@0.82.1...
2 months ago

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

Don't miss a new openapi-ts release

NewReleases is sending notifications on new releases.