Mapping array structure at service description json in response "models"

54 views
Skip to first unread message

captainf...@gmail.com

unread,
Mar 19, 2014, 4:57:54 AM3/19/14
to guz...@googlegroups.com
Hi folks,

I have got a question about the use of the "models" in the json service description.

A count value has to be extracted from an multi level array. With php the syntax is clear and simple:
 $apiResponse[0]['result']['metadata']['globalCounts']['count'];

How can I do this inside the service description json file for this webservice, without just using another php class as "responseClass"?

I tried the following, but I am not sure about the syntax:
...
"models": {
        "Count": {
            "type": "object",
            "items": {
                "properties": {
                    "result": {
                        "properties": {
                            "metadata": {
                                "properties": {
                                    "globalCounts": {
                                        "properties": {
                                            "count": {
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
...

Would be great to get some reply.
Thx.



Michael

unread,
Mar 20, 2014, 12:07:07 AM3/20/14
to guz...@googlegroups.com
So it sounds like you want to pull a nested value up as a top-level model property. There's no path support in the JSON parsing currently, but I plan on adding some kind of support for this through a custom JMESPath response location.

captainf...@gmail.com

unread,
Mar 20, 2014, 4:27:06 AM3/20/14
to guz...@googlegroups.com
Hi Michael,

thanks for your reply. That's exactly what I mean. Now I will solve it with the responseClass.
I am looking forword to the path support in guzzle. :-)
Reply all
Reply to author
Forward
0 new messages