-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Error "must match format 'time'" after upgrading to fastify v5 #267
Comments
I can reproduce the problem, tho I'm not able to find yet what is exactly the change. Will try to spend more time to see what might be missing |
Fastify v5 updated AJV compiler which also updated AJV formats which enforces the use of timezone in This should be mentioned in the migration guide as it broke a lot for us too. There is a workaround to add backwards comptability using Maybe @mcollina or @epoberezkin can provide some guidance on how to navigate this? |
@alexcroox that seems incorrect. We use version of ajv-format 3.0.1, which should include all the fixed in the prerelease version you linked. @jasoniangreen maybe can you help here? I don't think we were really aware of any breaking changes in those area. Would you like to send a PR to improve the migration guide? |
@mcollina sorry I missed out a key piece of info, the startup error comes from https://github.com/fastify/fluent-json-schema/blob/main/types/FluentJSONSchema.d.ts#L38-L53 |
I think the culprit has been already found:
While the GH Release is in draft, the npm versions tell us another story the v3.0.1 is a thing: We should definetly mention this change in the migration guide |
would you like to send a PR to add it? |
Related to #254 |
Prerequisites
Fastify version
5.x.x
Plugin version
No response
Node.js version
22.9.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
22.04
Description
I have an endpoint in my Fastify API where in the body I request a field with the type "string" and format "time", in Fastify v4.x.x I passed the format "HH:MM:SS" and it is accepted but after upgrading to v5 running the same test and without modifying anything else I got the error:
{ statusCode: 400, error: 'Bad Request', message: 'body/check_in_time must match format "time"' }
I already checked and when I have the ajv dependency in the last version in Fastify v4 works but in Fastify v5, it doesn't, so it's no problem of ajv.
I have created a simple repository with the example, you just need to change the fastify version and make a request like in the test.http file.
Link to code that reproduces the bug
https://github.com/AlexisMunozC/fastify_error
Expected Behavior
I would expect the format "time" has not changed, or at least describe it to know which is the new format expected.
The text was updated successfully, but these errors were encountered: