Skip to content
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

Added tests for JSON array of arrays and array of objects #131

Merged
merged 1 commit into from
Jan 31, 2017

Conversation

selfcatering
Copy link

@selfcatering selfcatering commented Jan 31, 2017

It took me a while to figure out how to write proper descriptions for JSON nested arrays of arrays and arrays of objects. Current JsonResponse seems to cover that quite well, but documentation is lacking instructions on how to properly write descriptions. This PR covers both scenarios and comments explain all the mandatory description elements. Hope that helps someone in the future.

*/
public function testVisitsNestedArrayOfObjects()
{
$json = json_decode('{"scalar":"foo","nested":[{"bar":123,"baz":false},{"bar":345,"baz":true},{"bar":678,"baz":true}]}');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just copy the code from line 371. Its more clear and consistent.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain a bit more. Code from line 371 defines array of arrays. Line 469 with json_decode generates array of objects. Descriptions for both are a bit different but important enough to keep them separate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, nevermind.

@Konafets Konafets merged commit 05cb2c6 into guzzle:master Jan 31, 2017
@Konafets
Copy link
Contributor

@selfcatering, thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants