-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to render when named types are nested in array #117
Comments
@pksunkara I'll start looking into this now. |
@pksunkara do you have a sample JSON output of what this should look like? I have a rough idea but I want to be sure I'm on the right track. |
I'd expect it would be rendered as: {
"username": "pksunkara"
} |
@kylef so from what I see the overall structure is fine, however their is no JSON body, and you provided what that should look like. I'll get started on this now. |
@pksunkara @kylef I'm still looking into this however I'm not making much progress. I'm feeling that this is related to the serialization of the MSON however wouldn't most of that be handled within snowcrash itself? |
I'm going to step aside from this for a little while incase somebody else wants to take a stab at it. |
When the above blueprint is parsed using the master branch, this is the output. {
"element": "category",
"meta": {
"classes": [
"api"
],
"title": ""
},
"content": [
{
"element": "category",
"meta": {
"classes": [
"resourceGroup"
],
"title": ""
},
"content": [
{
"element": "resource",
"meta": {
"title": ""
},
"attributes": {
"href": "/"
},
"content": [
{
"element": "transition",
"meta": {
"title": ""
},
"content": [
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "200",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
}
]
}
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "array"
}
]
},
{
"element": "asset",
"meta": {
"classes": "messageBody"
},
"attributes": {
"contentType": "application/json"
},
"content": "[]"
}
]
}
]
}
]
}
]
}
]
},
{
"element": "category",
"meta": {
"classes": [
"dataStructures"
]
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "object",
"meta": {
"id": "User"
},
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "username"
},
"value": {
"element": "string",
"content": "pksunkara"
}
}
}
]
}
]
}
]
}
] As you can see, the |
@pksunkara Thanks for this. So do you think exists in |
Prior to that. I have even said that the issue is when converting the data structures to refract which happens in |
@pksunkara thanks, I'll dive into that and see if I can come up with something. |
I've had a look into this one. From what I understand is the issue is from converting the MSON data structure to a refract element (from within ElementData<T> data;
std::for_each(ds.sections.begin(), ds.sections.end(), ExtractTypeSection<T>(data, ds));
TransformElementData<T>(element, data); Perhaps the issue is in snowcrash and the section shouldn't be empty, but I don't know much about these details and if that's correct. You can see the MSON attribute structure as follows: Where you can see that the nested type for This results in an element as which doesn't have any information about the |
That is incorrect. Sections should be empty in this case. It's just when we are doing |
@pksunkara I commented earlier today with a false assumption that we never hitting I believe now that the issue is prior to this function though, and the reason is that when we loop through the data structures not only does the specific element have no value, it's base name is I'm going to look into some of the code prior to this and not 100% rule out snowcrash. |
After spending a lot of time today walking through the debugger I'm starting to see now the issue is not with snowcrash, and it is in drafter as @pksunkara originally stated. Ignore my previous comments. |
It seems that in |
One thing I'm seeing, and this could be a misunderstanding on my part, is in the snowcrash element, their are two content elements, one for the request and another for the data structures. The data structures looks fine however the request itself though it shows an element that should be the array of users, is empty. Their seems to be no connection at all between the request and the data structure. Perhaps that is the issue, and if so I'm not sure where to look next. |
@pksunkara is it correct to say that in |
Given the below blueprint,
The
payload.body
is not getting rendering because there is a problem with expanding MSON.The text was updated successfully, but these errors were encountered: