Skip to content

[JS] ajv schema validator is not configured with formats #206

@pavelgj

Description

@pavelgj

Describe the bug
Context: https://stackoverflow.com/questions/78496888/how-do-i-specify-a-date-property-using-zod-in-firebase-genkit

schema validator is missing configuration for formats: https://ajv.js.org/packages/ajv-formats.html

So any time a format is included in the schema (ex. date time) ajv throws an error:

name: 'Error', message: 'unknown format "date" ignored in schema at path "#/properties/date"',

To Reproduce

Use this schema anywhere in the path of schema validator

export const SearchCriteria = z.object({
  zip: z.string(),
  date: z.string().datetime({ offset: false }),
  timeOfDay: z.enum(["morning", "afternoon", "evening"]).optional(),
});

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingjs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions