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

54 lượt xem
Chuyển tới thư đầu tiên chưa đọc

captainf...@gmail.com

chưa đọc,
04:57:54 19 thg 3, 201419/3/14
đến 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

chưa đọc,
00:07:07 20 thg 3, 201420/3/14
đến 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

chưa đọc,
04:27:06 20 thg 3, 201420/3/14
đến 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. :-)
Trả lời tất cả
Trả lời tác giả
Chuyển tiếp
0 tin nhắn mới