diff --git a/flask_restplus/namespace.py b/flask_restplus/namespace.py index 6fbe7be5..83a3bb38 100644 --- a/flask_restplus/namespace.py +++ b/flask_restplus/namespace.py @@ -53,6 +53,7 @@ def __init__(self, name, description=None, path=None, decorators=None, validate= self.apis = [] if 'api' in kwargs: self.apis.append(kwargs['api']) + kwargs['api'].add_namespace(self) @property def path(self): diff --git a/tests/test_namespace.py b/tests/test_namespace.py index fbb26778..3c58819b 100644 --- a/tests/test_namespace.py +++ b/tests/test_namespace.py @@ -133,3 +133,9 @@ def post(self): client.post_json('/apples/validation/', data) assert Payload.payload == data + + def test_api_namespaces(self, app): + api = restplus.Api(app, validate=True) + ns1 = Namespace('ns1', api=api) + + assert ns1 in api.namespaces