dataclass-rest icon indicating copy to clipboard operation
dataclass-rest copied to clipboard

Support functions for URL generation

Open Tishka17 opened this issue 6 months ago • 0 comments

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

Tishka17 avatar Dec 21 '23 11:12 Tishka17