-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
good first issueGood for newcomersGood for newcomers
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.15.0
Plugin version
No response
Node.js version
any
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
10
Description
4.15 release have a backward compatibility issue (PR): it throws an error if schema for validation is undefined.
For example, we get a schemas and pass them to fastify.
const { headers, body } = getSchemas();
fastify.post('/', {
schema: {
headers,
body
}
}
Steps to Reproduce
const fastify = require("fastify")({ logger: true });
fastify.get(
"/",
{
schema: {
headers: undefined,
},
},
() => {
return "hello";
}
);
const start = async () => {
try {
await fastify.listen({ port: 3000 });
} catch (err) {
fastify.log.error(err);
process.exit(1);
}
};
start();
Server throws an error Failed building the validation schema for GET: /, due to error headers schema is undefined"
when started
Expected Behavior
I think that undefined
is acceptable value, which means that validation will be skipped.
arinashilyaeva
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers