Jaymon / endpoints

Lightweight REST api backend framework that automatically maps urls to python modules and classes
MIT License
29 stars 10 forks source link

Allow @param(required=...) to take a callback #69

Open Jaymon opened 7 years ago

Jaymon commented 7 years ago

add conditional to param, if the conditional is true then the param is required, otherwise False, this can be as easy as just making required=callback and that will be called at runtime to decide

Not sure if this is really needed with the new routing and version stuff in v2.0.0 but I had it in a comment and wanted to make sure it got saved in case I do find a use case

one of the reasons an approach like this might be useful is when using the route decorator because it might go a bit crazy if you have multiple routes and versions and the amount of methods could explode exponentially as you try and version multiple endpoints with multiple routes.

Jaymon commented 6 years ago

another approach would be something like require_if="foo" where it would only be required if foo was present.