Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In development Mode ajv.validate causes Error: unknown format "date-time" #307

Open
ishields opened this issue Jun 27, 2023 · 0 comments
Open

Comments

@ishields
Copy link

I am seeing an issue in the generated segment.ts in which I receive an error

Error: unknown format "date-time" ignored in schema at path "#/properties/...."

My fix right now is to do

import addFormats from 'ajv-formats'

Then change the generated method to

function validateAgainstSchema(message: Record<string, any>, schema: object) {
    const ajv = new Ajv({ allErrors: true, verbose: true })
    //@ts-ignore
    addFormats(ajv)
    if (!ajv.validate(schema, message) && ajv.errors) {
        onViolation(message, ajv.errors)
    }
}

This is obviously not ideal because this is a generated file that shouldn't be edited.

Is there a recommended solution to this?

I'm using these package versions:

    "ajv": "^8.12.0",
    "ajv-formats": "2.1.1",
    "typewriter": "9.0.0",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant