hugapi / hug

Embrace the APIs of the future. Hug aims to make developing APIs as simple as possible, but no simpler.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nested directives do not work

Spenhouet opened this issue · comments

We want to use directives in directives (nested directives).
We simply did expect this to work but seemingly it doesn't.

Is this not supported or are we doing something wrong?

Minimal working example:

import hug

@hug.directive()
def inner(*args, **kwargs):
    return 'inner'

@hug.directive()
def outer(inner: inner, *args, **kwargs):
    return 'outer with ' + str(inner)

@hug.get()
def test_route(outer: outer):
    return outer

This will fail with:

TypeError: outer() missing 1 required positional argument: 'inner'