restyped-express-async icon indicating copy to clipboard operation
restyped-express-async copied to clipboard

type conversion

Open tmueller opened this issue 6 years ago • 2 comments

Hi,

I am doing some small tests using restyped. I noticed that params and query can be typed with different types than strings. In a handler both query and params will be strings at runtime. The problem is, that according to the API definition they are number for instance. Is this intended behaviour?

Thanks, Thomas

tmueller avatar Mar 25 '18 22:03 tmueller

Hi there, thanks for the issue. You are right, the query and params implementation should force types to be strings on the server side. Although we still want to allow them to be other types like numbers and booleans on the client, they will always come through as strings in req.query and req.params in express route handlers. Therefore, this change would apply to this package only and not the RESTyped spec itself.

I'll make a note to update the typings in this package in the next release.

rawrmaan avatar Apr 06 '18 02:04 rawrmaan

Did you finish this @rawrmaan ?

henrikra avatar Aug 06 '18 06:08 henrikra