Add custom HTTP error types to FastAPI routes
Is your feature request related to a specific problem?
There are a number of APIs that raise HTTPExceptions which are not included in our OpenAPI docs. Example: when AWS auth fails, the API will return 403 ConnectorAuthFailureException. Our API only lists the default FastAPI responses: 200 with the model schema, 400 with a detail string that has no schema, or 422 for param validation.
Describe the solution you'd like
FastAPI supports "Additional Responses" for this purpose. They are a bit verbose, but the benefit would be:
- Keeping clients in sync with OpenAPI type generation.
- Improved accuracy of the API docs.
- Encouraging standardizing error definitions in the python codebase.
Describe alternatives you've considered, if any
Both fidesops and fidesctl clients have custom typescript interfaces to narrowing down what the error contains, mainly to find an error string to present to the user. This is prone to getting out of sync with server.
Additional context
Originally posted by @ssangervasi in https://github.com/ethyca/fides/issues/892#issuecomment-1182131940