-
Notifications
You must be signed in to change notification settings - Fork 21
message/messages response field inconsistency #168
Comments
In lines 266 to 268 middleware.js has Is this meant to be |
Questions from email:
That is the perfect use of the issue.
True. The existing tests are "functional" tests which exercise the API server as a whole from the outside. These tests are written in Python. It would be helpful to also have lower level unit tests to check finer details but we don't have those yet. Tests like this would be best implemented in JavaScript.
You could try to create a test which triggers an error with the Alternatively, it might be easier to test this change using a JavaScript based unit test. Doing this will require you doing a lot of extra work because we don't currently have any unit tests so there's lots of infrastructure to set up. How about you try and trigger one of the problematic errors using our existing test infrastructure and see how you go. Writing this test in a new Python test file is fine. If that doesn't work out, let me know and we can figure out an alternative approach.
The process is:
Does that make sense? |
Almost certainly! That looks like a bug. You could fix that and propose it as an initial pull request in order to get familiar with the Github process if you like. |
Validation error responses (see customErrors.js) have a
message
field while other responses have amessages
field. This is confusing and annoying. We should settle on a single way of returning messages. An array (i.e.messages
) is a better choice as it gives the client more flexibility in terms of presenting multiple errors to the user.To aid the transition period as we update client code the API server should probably return both
message
andmessages
for a while for validation errors. Once all client code has been updated themessage
field can go.The text was updated successfully, but these errors were encountered: