You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @frankkilcommins
Is there a duplicate definition of the request types: business-rule-violation, validation-error, and invalid-body-property-value?
Assume there is an API endpoint that requires the value of the type field to be either a or b. If the request contains an invalid value (e.g., c), which of the following would be appropriate for the server to return? It seems any of the above could be used.
Each of the problem types serves a purpose. In the situation you described, it would be best suited to invalid-body-property-value with a problem details response looking something like:
{
"type":"https://problems-registry.smartbear.com/invalid-body-property-value",
"title":"Invalid Body Property Value",
"detail":"The request body contains an invalid body property value.",
"status":400,
"errors":[
{
"detail":"`c` is an invalid value. Please provide `a` or `b`",
"pointer":"#/type"
}
]
}
validation-error is also applicable but in this context is not as clear as invalid-body-property-value which is the explicit problem being faced by the client. Think of validation-error as an affordance that gives the ability to return multiple validations errors in one go which may be of slightly mixed type.
business-rule-violation is generally for situations where the client sends a semantically valid request but the server is not able to process the request as it fails to meet business rule expectations.
Hi @frankkilcommins
Is there a duplicate definition of the request types: business-rule-violation, validation-error, and invalid-body-property-value?
Assume there is an API endpoint that requires the value of the type field to be either a or b. If the request contains an invalid value (e.g., c), which of the following would be appropriate for the server to return? It seems any of the above could be used.
The text was updated successfully, but these errors were encountered: