neulab / explainaboard_web

MIT License
8 stars 2 forks source link

Add an optional API version header to every requests in openapi.yaml #498

Closed OscarWang114 closed 1 year ago

OscarWang114 commented 1 year ago

This PR adds an optional API version header to every request in openapi.yaml. This is required because the CLI's api client rejects any unknown parameters during validation, meaning we cannot pass in the API version header without defining it in openapi.yaml.

I tried to make it as easy to maintain as possible by defining a global APIVersionHeader object and referencing it at the top level of each API path.

OscarWang114 commented 1 year ago

Closing this PR as I figured out a better solution. This PR forcefully adds the x_api_version parameter to every request handler function in default_controllers_impl.py, which is not only an overkill and hard to maintain but also defeats the original purpose of checking the API version using @app.before_request in init.py.