chanfana icon indicating copy to clipboard operation
chanfana copied to clipboard

lacking type safety in the openapi route object

Open moodysalem opened this issue 1 year ago • 2 comments

the static schema does not match the the request type, and does not have typing on the handle parameters

makes this library really hard to use

it's also not clear how to describe the parameters!

and there are multiple places where params can be defined! image

need to make better use of typescript for this to be nice to use

i would also recommend the schema not being static so you don't have to compute the schema and construct everything until the route is hit

moodysalem avatar Dec 20 '23 20:12 moodysalem

This lib would be 100x better if those were typed. Happy to make PR if interested @G4brym

patjakubik avatar Feb 22 '24 20:02 patjakubik

This is a known issue, i just didn't got any time yet to get to it The issue with migrating from the static schema, is that we want to keep backwards compatibility with people using the static version

i would also recommend the schema not being static so you don't have to compute the schema and construct everything until the route is hit

I still need to think about this because, if we move the schema compute to only when the route is hit, we still need a way to compute all route schemas when someone hits openapi.json path

@patryk-smc feel free to open a PR 😄 if you decide to tackle both issues, please split into 2 pr's

G4brym avatar Feb 23 '24 10:02 G4brym