We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have a response with an array of objects, each objects contains a property with another array. It looks like this:
[ { "id" : 1, "name" : "Quick start", "type" : "radio", "musicChannels" : [ { "id" : 134, "name" : "Popular & Nostalgic", "musicChannelGroupId" : 1, "musicCollections" : "An array of MusicCollections" }, { "id" : 146, "name" : "Young & Alternative", "musicChannelGroupId" : 1, "musicCollections" : "An array of MusicCollections" } ] }, { "id" : 2, "name" : "Create mood", "type" : "radio", "musicChannels" : [ { "id" : 146, "name" : "Popular & Nostalgic", "musicChannelGroupId" : 2, "musicCollections" : "An array of MusicCollections" } ] }, { "id" : 3, "name" : "Discover more", "type" : "radio", "musicChannels" : [ { "id" : 146, "name" : "Young & Alternative", "musicChannelGroupId" : 3, "musicCollections" : "An array of MusicCollections" } ] } ]
I want to document the object in the second array, and to generate a code snippet with restDocs, I am trying this:
responseBody( beneathPath("[0].musicChannels.[0]").withSubsectionId("musicChannel2") )
But the output is:
[ { "id" : 134, "name" : "Popular & Nostalgic", "musicChannelGroupId" : 1, "musicCollections" : "An array of MusicCollections" }, { "id" : 146, "name" : "Young & Alternative", "musicChannelGroupId" : 1, "musicCollections" : "An array of MusicCollections" } ]
I want to have only the first object in the response body, but i fail with whatever I try to insert into 'beneathPath'.
So the question is: How to get the body for the first element in the array of a property in the first element in an array. I want this as a result:
{ "id" : 134, "name" : "Popular & Nostalgic", "musicChannelGroupId" : 1, "musicCollections" : "An array of MusicCollections" }
The text was updated successfully, but these errors were encountered:
Unfortunately, there's no support at the moment for specifying a specific index when drilling down into an array. #468 is tracking that enhancement.
Sorry, something went wrong.
No branches or pull requests
I have a response with an array of objects, each objects contains a property with another array. It looks like this:
I want to document the object in the second array, and to generate a code snippet with restDocs, I am trying this:
But the output is:
I want to have only the first object in the response body, but i fail with whatever I try to insert into 'beneathPath'.
So the question is: How to get the body for the first element in the array of a property in the first element in an array. I want this as a result:
The text was updated successfully, but these errors were encountered: