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
Update v4 migration guide to use querystring instead of query #4237
Comments
Wait, on second thought, I was confused about two parts of the docs. Maybe it is still supposed to work with
Changing |
I do not use import Fastify from 'fastify'
const fastify = Fastify()
fastify.get('/', {
schema: {
query: { type: 'object', properties: { hello: { const: 'world' } } }
}
}, (request) => request.query)
const response = await fastify.inject('/?hello=world')
console.log(response.body) |
@climba03003 The problem arises when I use Yup. I just did a fresh install of Fastify ( 'use strict'
const Yup = require('yup');
module.exports = async function (fastify, opts) {
fastify.get('/', {
schema: {
query: Yup.object(),
},
validatorCompiler: () => () => true,
}, (request) => request.query)
} But if I swap out Would this be a bug with Fastify or with Yup? |
Yes, I can confirm it is the problem with custom The problem caused by we mutated the Lines 63 to 67 in 6f6f7aa
Then, when it comes to auto Would you like to send a PR to address the issue? |
@climba03003 I would make a PR, but I am really totally unfamiliar with the codebase. Even with your description I have no idea what would need to be changed. |
I think @climba03003 meant that you provide a PR not the other way round. |
Add
Oh, I click the wrong button. Sorry for the confusion. |
Prerequisites
Fastify version
4.5
Plugin version
No response
Node.js version
16
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 22.04
Description
In Fastify v3, you could use either
query
orquerystring
for route validations, but for fastify v4,query
has been removed. This is not mentioned in the Migration guide. I upgraded from 3.14.1 and I don't remember ever seeing any deprecation notices about this, and it is also not mentioned as being deprecated on the 3.29.x docs.Steps to Reproduce
n/a
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: