StefanTerdell / zod-to-json-schema

Converts Zod schemas to Json schemas
ISC License
857 stars 68 forks source link

Preserve the order of properties #83

Closed sp88011 closed 1 year ago

sp88011 commented 1 year ago

Is it possible to preserve the order of my properties?

Right now, the order changes:


const userSchema = z.object({
    name: z.string().optional(),
    age: z.number(),
    email: z.string().email(),
  });

  console.log(zodToJsonSchema(userSchema))
  // {... properties: {
   age...
   email ...
   name ...
   } ...
StefanTerdell commented 1 year ago

Can't recreate this. What version of node and the package are you using?

sp88011 commented 1 year ago

Sorry, my bad. It works fine.