-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Using named schema in items field breaks schema validation #1491
Comments
@mcollina I don't know exactly where exactly this should be. Probably even in PS: Important update. Only fastify v2 affected. On 1.X.X it works fine. |
I will check this evening 👍 |
This bug occurs only if you don't use a shared schema. If you add the shared schema in a body, for example, all works. // workaround
fastify.get('/', {
schema: {
body: `${name}List#`,
response: {
200: `${name}#`
}
}
}, The "replace-way" shared schemas are objects that are modified: the But, if you have a shared schema that references a not used shared schema, it will be not evaluated but it will be pass to serializer here: Line 53 in c24b14a
@SkeLLLa , for what I tested it seems that the bug is also in v1, could you share your test? PR with the fix is coming 👍 |
@Eomm I've tested it with code from the first post. And it worked in v1. |
Fix released in v2.0.1 |
🐛 Bug Report
Using some named schema as
items
in other schema cause exception when using first schemaTo Reproduce
Steps to reproduce the behavior:
Add schema with simple item. Then add schema for items array and use first schema
$id
initems
.Then use the first schema in some route.
Paste your code here:
Expected behavior
No exception thrown.
Your Environment
The text was updated successfully, but these errors were encountered: