This issue is a (choose one):
Checklist before submitting:
Description
I have a model with an attribute named status_is_active. In the API we want this to render as active so do the following in the resource:
attribute :active, delegate: :status_is_active
If there is an API error related to this attribute, the error reports the name from the model rather than the name from the resource. For example:
{
"errors": [
{
"title": "is not included in the list",
"detail": "status_is_active - is not included in the list",
"code": "100",
"source": {
"pointer": "/data/attributes/status_is_active"
},
"status": "422"
}
]
}
Expected: the error uses the name of the attribute in the resource rather than the name used in the model. For example:
{
"errors": [
{
"title": "is not included in the list",
"detail": "active - is not included in the list",
"code": "100",
"source": {
"pointer": "/data/attributes/active"
},
"status": "422"
}
]
}
Rationale: users of the API only know about what's in the API - returning a value from the model that is aliased in the API is confusing/wrong.
Thanks!
This issue is a (choose one):
Checklist before submitting:
Description
I have a model with an attribute named
status_is_active. In the API we want this to render asactiveso do the following in the resource:If there is an API error related to this attribute, the error reports the name from the model rather than the name from the resource. For example:
Expected: the error uses the name of the attribute in the resource rather than the name used in the model. For example:
Rationale: users of the API only know about what's in the API - returning a value from the model that is aliased in the API is confusing/wrong.
Thanks!