salesforce-marketingcloud / SFDC-MC-REST-Style-Guide

REST style guidelines
31 stars 9 forks source link

Request Validation #28

Closed ncorn closed 9 years ago

ncorn commented 9 years ago

We have the ability to do aggregate errors and then individual detail about exceptions. In implementation people typically do one of two things:

  1. Inspect the payload and then fail on the first issue. Reporting only the first issue and then ignoring any other issues until the next request.
  2. Inspect the entire payload. Aggregate all failures contained int he payload and send back the aggregate.

I propose that we add some wording to require the second option.

ncorn commented 9 years ago

General agreement that we SHOULD to # 2.

If full aggregation is not happening developers should provide reasons on why not.

aroden-salesforce commented 9 years ago

I disagree that parsing errors are useful after the first to. If you are missing a comma or brace in JSON then attempting to continue parsing will likely generate nonsense. I've never seen agreement on this point nor a working implementations on the parsing errors.

Validation of data errors are different and I believe your point? Consider this language

Implementations SHOULD NOT attempt to aggregate errors that are about syntax of the request. i.e. Only one missing comma at a time.

Implementations SHOULD attempt to aggregate data validation errors within a valid request. i.e. Validate that all email address are a valid syntax or all numbers are within the predefined range.