JSON API specifies that multiple errors on an attribute/parameter should be listed separately. What is the best way to handle a single error that involves several parameters at once?
For example, let's say an endpoint accepts either bid or fold parameters, but not both (they are mutually exclusive). What should be the error response if both of parameters are submitted (GET /endpoint?bid=100.00&fold=muck)?
List the error twice, once for each attribute?
{
"errors": [
{
"status": "400",
"source": { "parameter": "bid" },
"detail": "Cannot accept both 'bid' and 'fold' parameters."
},
{
"status": "400",
"source": { "parameter": "fold" },
"detail": "Cannot accept both 'bid' and 'fold' parameters."
}
]
}
Combine the attributes?
{
"errors": [
{
"status": "400",
"source": { "parameter": ["bid", "fold"] },
"detail": "Cannot accept both 'bid' and 'fold' parameters."
}
]
}
Make one higher-level error for the entire request?
{
"errors": [
{
"status": "400",
"source": { "pointer": "/data" },
"detail": "Cannot accept both 'bid' and 'fold' parameters."
}
]
}
Some other way?