dataclass-rest
dataclass-rest copied to clipboard
Support functions for URL generation
Sometimes URL is constructed in more complicated way than just string interpolation. We can support it by allowing user to pass function as URL generator.
E.g
def url_generator(xxx: str):
if not xxx:
return "/me"
return f"/users/{xxx}"
@get(url_generator)
def foo(self, xxx: str) ->Result:
pass