-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Integrate with qs library #716
Comments
I'm sorry but I don't understand those snippets. Could you include a complete example? |
So is this a bug in Swagger UI? |
It's not because swagger maybe use querystring to stringify, I want to use qs library instead. With fastify I can change to qs by using querystringParser option. |
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that. |
const qs = require("qs");
const fastify = require("fastify");
const fastifySwagger = require("@fastify/swagger");
const fastifySwaggerUi = require("@fastify/swagger-ui");
const test = async () => {
const app = fastify({ logger: true, querystringParser: qs.parse });
await app.register(fastifySwagger, {
openapi: {
info: {
title: "Test",
},
},
hideUntagged: true,
});
await app.register(fastifySwaggerUi, {});
app.get(
"/users",
{
schema: {
tags: ["User"],
querystring: {
type: "object",
properties: { filters: { type: "object" } },
},
},
},
async (request) => {
return request.query;
}
);
app.listen({ host: "127.0.0.1", port: 3000 });
};
test(); Here is it. |
How are you sending your input? Can you pass a curl string to send it or a Node script? |
I pass it to parameter like an example. schema -> quyerstring -> filters |
Are you using Swagger UI to generate the querystring? Is it generating a querystring that the server cannot interpret correctly? I asked the same question in #716 (comment). |
Yes but it's not a bug in Swagger UI. I use different library to parse |
Please read the part regarding query serialization in |
I read it before, I also try { type: 'object', style: 'deepObject', explode: true } but it's not working, unknown keyword 'style' |
Where is this error thrown? Typescript? Runtime at fastify start? When shown in the ui? |
It's strict mode schema throw error |
Prerequisites
🚀 Feature Proposal
Can we have a querystring parser for swagger?
I have a problem with array in params request url
Because swagger ui stringify params different than qs so I receive different object.
Expected:
Thank you!
Example
Query:
The text was updated successfully, but these errors were encountered: