-
Notifications
You must be signed in to change notification settings - Fork 4
Add Validation to Path Parameters #13
Comments
Stop torturing him @ParentJA :-) - question, why use this framework instead of Serverless https://www.serverless.com ? Up https://up.docs.apex.sh ? Architect https://arc.codes/guides/offline? You might want to add yourself to https://github.com/anaibol/awesome-serverless |
@incognos great resources indeed! however, using a The main purpose of this project was to create a minimal serverless framework. This means it will not have full feature parity with django or flask, but it will be functional and lightweight. |
Using metadata annotations seems to be a really natural fit for this type of feature. After a few iterations, this is how the route definition looks like: @sample_app.route('/articles/{year}/{month}/', methods=['GET'])
def get_articles_view(year: int, month: int):
# match /articles/2015/10/
# match /articles/2020/5234 which is not ideal.
# does not match /articles/2020/ten
assert isinstance(year, int) and isinstance(month, int)
return {'year': year, 'month': month} Note that in order to implement the @sample_app.route('/product/{product_id}/', methods=['GET'])
def get_product(product_id: uuid.UUID):
assert isinstance(product_id, uuid.UUID)
return {'id': str(product_id)} Thoughts? |
Django lets you add validation to path parameters in its URL config.
I'd like something similar in Minik.
The text was updated successfully, but these errors were encountered: