-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Currently to have fine-grained problem responses we have a lot of functions/methods with the suffix "-WritesProblem" and then returns true if they succeeded or false if they failed and wrote a problem to the gin context.
This would need us to add "NewProblem..." functions to the wharf-core/pkg/ginutil package, and a utility function that wrotes a returned problem response to the HTTP response, or converts a non-problem response to a problem response and then writes that instead to the HTTP response.
This way we could offload a lot of work from the endpoint methods by only using return values. Maybe we could wrap the functions as well so instead of being func(*gin.Context)
to be func(*gin.Context) error
where it uses that error->problem.Response that I mentioned in the above paragraph.
Just a thought. Could need an RFC to show both the wharf-core changes as well as the changes to the API repos as this would involve a lot of work and the specific implementation needs a good overview.