title: How to Inject Interface as a parameter to function using flask-injector
body: <p>I am working on an API app using flask-injector and connexion. I have following setups - </p>
  
  <p>The Interface - </p>
  
  <pre><code>class RestaurantsProvider(Module):
  @inject
  def __init__(self, items: list=[]):
      self._items = items
  
  @provider
  def get(self, number_of_items: int=5) -&gt; list:
      if not self._items:
          return []
  
      if number_of_items &gt; len(self._items):
          number_of_items = len(self._items)
  
      return self._items
  </code></pre>
  
  <p>The binding - </p>
  
  <pre><code>from connexion.resolver import RestyResolver
  import connexion
  from injector import Binder, CallableProvider
  from flask_injector import FlaskInjector
  from services.provider import RestaurantsProvider
  
  def configure(binder: Binder) -&gt; Binder:
      binder.bind(
          interface=RestaurantsProvider.RestaurantsProvider,
          to=  RestaurantsProvider.RestaurantsProvider([{"Name":"Fgh"}])
      );
  
  
  if __name__ == '__main__':
     app = connexion.App(__name__, port=2508, 
             specification_dir='swagger/')
     app.add_api('restaurants.yaml', resolver=RestyResolver('api'))
     # app.run(ssl_context=('cert.pem','key.pem'))
     FlaskInjector(app=app.app, modules=[configure])
     app.run()
  </code></pre>
  
  <p>And Now I want to inject this interface in a function like this</p>
  
  <pre><code>@inject(data_provider = RestaurantsProvider)
  def search(data_provider) -&gt; list:
      return data_provider.get()
  </code></pre>
  
  <p>But the newer version of injector (0.13.0) doesn't allow parameterized injection and I went through the documentation and couldn't figure out how to inject the interface to this function.</p>
  
  <p>Note - This function is in api.restaurants.py and is getting called as expected. </p>