Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

Where are the path(req.params),query(req.query) parameters handles in generator-swaggerize? #108

Open
ghost opened this issue Apr 23, 2018 · 3 comments
Labels

Comments

@ghost
Copy link

ghost commented Apr 23, 2018

Hi @tlivings ,
I have hosted APIs from a swagger specification.
I am hitting an API from postman.
I am receiving the query and path parameters in the URL in the handler.js (generator-swaggerize) using
req.query for query parameters in the URL and req.params for path params of the URL of the API.

Where is the datatype of the query and path parameters decided in generator-swaggerize?
How can I manipulate it before receiving in req.query or req.params in handler.js?

@tlivings
Copy link
Contributor

Are you using express of hapi? The data type validation is specified in the swagger API document.

@ghost
Copy link
Author

ghost commented Apr 25, 2018

Hi @tlivings ,
I am using express.

Where is the dataype of the query and path params accesed from?
Which node module does it?
Please let me know .

Regards,
vaishnavi

@tlivings
Copy link
Contributor

I am not 100% sure what you are asking but let's see if this answers your question.

When a request comes in, after it has been parsed, the type validation runs. If a parameter isn't valid the client will receive a 400 status code.

In some cases there will be type coercion.

But after validation has run, there will not be a reference to the expected type. There will just be the value of the parameter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant