-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Description
When a payload is deserialized, a set of json pointers for the deserialized fields is generated, which can then be used when serializing errors.
Example
# Incoming payload
{
data: {
id: "1",
type: "users",
attributes: {
name: "Lucas",
email: "lucas@jsonapi-rb.org"
},
relationships: {
posts: {
data: [{ type: "posts", id: "2" }, { type: "posts", id: "3" }]
}
}
}
}
# Deserialized params (via `deserializable_resource :user`)
{
id: "1",
type: "users",
name: "Lucas",
email: "lucas@jsonapi-rb.org",
post_ids: ["2", "3"],
post_types: ["posts", "posts"]
}
# Reverse mapping / json pointers
{
id: "/data/id",
type: "/data/type",
name: "/data/attributes/name",
email: "/data/attributes/email",
post_ids: "/data/relationships/posts/data",
post_types: "/data/relationships/posts/data"
}Possible interface
- An
ActionControllerinstance method, possibly namedjsonapi_pointers - Other suggestions?
Metadata
Metadata
Assignees
Labels
No labels