[go: up one dir, main page]

Skip to content

Add an endpoint for validating approval rules

Spawned by a discussion ending here.

I am proposing that we add an endpoint to the API to validate (but not submit) approval rules.

The endpoint could return a 409 Conflict error (or 200 OK, if no errors), with the data { "fields": [ "field1", "field2", ... ] } representing all of the errored values in the approval rule.

Right now, when the Approver Modification modal (add or edit) submits to the back end, it receives a 400 error with a list of strings that would be expected to be shown in the UI.

This doesn't really fit with more modern separations of data and UI concerns. Plus, this form may eventually avoid submitting to the API at all to determine if the name is a conflict. In that situation, the front end will need the complete validation experience without ever touching the back end.

The first step toward separating these concerns is for the API to provide an endpoint that returns a more specific error code and a more data-oriented list of issues. Having the 409 plus conflicting fields will allow the front end to define the text without being bound to a specific implementation on the back end.

Edited by Thomas Randolph