github unnoq/orpc v1.5.1

latest releases: v1.8.6, v1.8.5, v1.8.4...
2 months ago

Common Schemas docs

Define reusable schema components that can be referenced across your OpenAPI specification (Only support zod 3 and 4 for now):

const UserSchema = z.object({
  id: z.string(),
  name: z.string(),
  email: z.string().email(),
})

const PetSchema = z.object({
  id: z.string().transform(id => Number(id)).pipe(z.number()),
})

const spec = await generator.generate(router, {
  commonSchemas: {
    User: {
      schema: UserSchema,
    },
    InputPet: {
      strategy: 'input',
      schema: PetSchema,
    },
    OutputPet: {
      strategy: 'output',
      schema: PetSchema,
    },
  },
})

   🚀 Features

  • openapi: Gen spec with common schemas - components.schemas  -  by @unnoq in #638 (bd95e)
  • server: Optimize encodeHibernationRPCEvent  -  by @unnoq (ec7d8)

   🐞 Bug Fixes

  • openapi: OpenAPIGenerator make response headers optional when headers object is optional  -  by @unnoq in #642 (5b223)
    View changes on GitHub

Don't miss a new orpc release

NewReleases is sending notifications on new releases.