Skip to content

Releases: samchungy/zod-openapi

v2.7.2

15 Jul 06:35
57c0eba
Compare
Choose a tag to compare

What's Changed

Other Changes

Full Changelog: v2.7.1...v2.7.2

v2.7.1

14 Jul 06:09
0622b8d
Compare
Choose a tag to compare

What's Changed

Other Changes

Full Changelog: v2.7.0...v2.7.1

v2.7.0

14 Jul 03:20
c5f2857
Compare
Choose a tag to compare

What's Changed

New Features 🎉

Full Changelog: v2.6.3...v2.7.0

v2.6.3

10 Jul 00:53
e20a9ad
Compare
Choose a tag to compare

What's Changed

Other Changes

Full Changelog: v2.6.2...v2.6.3

v2.6.2

03 Jul 10:58
0f96866
Compare
Choose a tag to compare

What's Changed

Other Changes

Full Changelog: v2.6.1...v2.6.2

v2.6.1

03 Jul 09:30
684daad
Compare
Choose a tag to compare

What's Changed

Other Changes

Full Changelog: v2.6.0...v2.6.1

v2.6.0

14 Jun 05:52
1ee4a08
Compare
Choose a tag to compare

What's Changed

New Features 🎉

Full Changelog: v2.5.1...v2.6.0

v2.5.1

27 May 00:29
4c525e5
Compare
Choose a tag to compare

What's Changed

Other Changes

Full Changelog: v2.5.0...v2.5.1

v2.5.0

26 May 08:29
7f48097
Compare
Choose a tag to compare

What's Changed

  • Optimise ZodLazy recursive error messaging by @jedwards1211 in #103

  • Enhance error messaging by @samchungy in #112

    When you encounter an error with the library, there will now be an associated path with the error which will make debugging easier. For example:

    `The schema at lazy schema > array items > property: foo needs to be registered because it's circularly referenced`,
    

    Big thanks to @jedwards1211 for making this possible.

Other Changes

Full Changelog: v2.4.0...v2.4.1

v2.4.0

25 May 10:49
2173f30
Compare
Choose a tag to compare

What's Changed

New Features 🎉

  • Enhance ZodLazy support by @samchungy in #102

    This should allow you to write recursive ZodSchema like this:

     const BasePost = z.object({
        id: z.string(),
        userId: z.string(),
      });
    
      type Post = z.infer<typeof BasePost> & {
        user?: User;
      };
    
      const BaseUser = z.object({
        id: z.string(),
      });
    
      type User = z.infer<typeof BaseUser> & {
        posts?: Post[];
      };
    
      const PostSchema: ZodType<Post> = BasePost.extend({
        user: z.lazy(() => UserSchema).optional(),
      }).openapi({ ref: 'post' });
    
      const UserSchema: ZodType<User> = BaseUser.extend({
        posts: z.array(z.lazy(() => PostSchema)).optional(),
      }).openapi({ ref: 'user' });

Other Changes

  • Fix type exports by @samchungy in #106

    This change fixes an issue introduced in v2.3.1 and should resolve the following Typescript compilation error for any versions < 5.0.

     TS1383: Only named exports may use 'export type'.
    

    Please note: there may be a breaking change in the future to require Typescript 5.0.

Full Changelog: v2.3.3...v2.4.0