Hi! Any plans on warning on received, non-valid at...
# sst
p
Hi! Any plans on warning on received, non-valid attributes? I just had a case where I defined my routes like this:
Copy code
'GET /myroute': { authorizationType: sst.ApiAuthorizationType.NONE, function: `services/${id}/timer.opt2`, timeout: 15 }
Of course, that's (mostly) wrong and will ignore the timeout. Now it's defined like this and all is well:
Copy code
'GET /myroute': { authorizationType: sst.ApiAuthorizationType.NONE, function: { handler: `services/${id}/timer.opt2`, timeout: 15 } }
f
That is annoying and pretty hard to track down.
btw.. you are not using Typescript right?
p
No, but I know I should... 🙂
This would have solved that problem, right? Perhaps starting by just writing my stacks with TS would be a good start!
f
yeah that would solve it. But I think it’s worth doing some basic validation for JS too… i think the majority still uses JS?
This seems like a common problem.. I’m curious if there are standard ways ppl do attribute validation..
m
We just use typescript and let the linter tell us what’s up
in webstorm it will even auto-generate the required properties for attributes