Closed csavage-mdsol closed 10 years ago
Looks good to me. I'll mere in 20 unless there are other comments.
Suprisingly, I have a comment.
In this example:
{
"_meta": {
"data": {
"options": [
0,
1,
2
],
"value": 0
},
"data1": {
"_ref": [
"data"
],
"value": 1
},
"something": {
"max": 1,
"value": 2
},
"something_else": {
"_ref": [
"data1",
"something"
]
},
"_embedded": {
"item": {
"_meta": {
"embedded_something": {
"_ref": [
"something_else"
]
}
}
}
}
}
}
"_embedded" is a property of "_meta", is that actually valid?
@csavage-mdsol Editing JSON is such a joy. It is not correct. _embedded
is a top-level reserved property. Good eye.
Heh. Just to be clear @fosdev, a hale instead of "_embedded" however should be valid, so:
{ "_meta": {
...
"item": { <hale_doc> }
}
}
good
{ "_meta": {
...
"_embedded": {<blah>}
}
}
bad ?
Good
{
"_meta" : {
<blah>
},
"_embedded": {
<blah>
}
}
Am I understanding?
err, perhaps Im confusing myself, but what Im trying to say is that we should be able to plop a valid hale doc in "_meta"
so this:
{
"_meta": {
"item": {
"_meta": {...},
"_embedded": {...}
}
},
"_embedded": { ... }
}
Trying to ask, not say.
I think what you're going for specifically is:
{
"_meta": {
"item": {
"_meta": {...},
"_embedded": {...}
}
},
"_embedded": {"item": {"_ref": "item"}}
}
is interpreted as
{
"_meta": {
"item": {
"_meta": {...},
"_embedded": {...}
}
},
"_embedded": {"item": {
"_meta": {...},
"_embedded": {...}
}}
}
@csavage-mdsol Interesting question. I think that you could, but not necessarily rely on it being recognized as a hale document per say. The _meta tag just affords json objects with no interpretation of what they are. However, there is nothing preventing you from doing that and then using a meta reference to put that somewhere else where it needs to be a hale document. Make any sense?
@csavage-mdsol @sheavalentine-mdsol's last comment is basically saying what I was.
@fosdev yeah, makes sense. @sheavalentine-mdsol's example is the use case I had in mind. I'll be making an update to this PR shortly.
@sheavalentine-mdsol @fosdev any further comments?
Previously, under "_embedded", the reserved key "_meta" was used instead of property names and values that are either a Resource Object or an array of Resource Objects.
Also made a develop branch.
ping @sheavalentine-mdsol