Skip to content

Render JSON content with indentation#213

Merged
camilamaia merged 8 commits intomasterfrom
render_json_response
Jul 29, 2020
Merged

Render JSON content with indentation#213
camilamaia merged 8 commits intomasterfrom
render_json_response

Conversation

@abreumatheus
Copy link
Copy Markdown
Member

Refers to: [#205 ]

Added

  • JSON response is now properly rendered, instead of plain text;

@abreumatheus
Copy link
Copy Markdown
Member Author

Just as observation: I used a javascript library to render the json in a "interactive" way, but if the user disables javascript on the browser (or for some reason the browser or device doesn't support javascript) it won't break the report, it will just fall back to plain text.

@barbosa
Copy link
Copy Markdown
Member

barbosa commented Jul 23, 2020

Nice! Do you have a screenshot of how that's being rendered, @abreumatheus ?

@abreumatheus
Copy link
Copy Markdown
Member Author

Nice! Do you have a screenshot of how that's being rendered, @abreumatheus ?

Sure do!

json_render

@barbosa barbosa requested a review from camilamaia July 24, 2020 19:41
@camilamaia
Copy link
Copy Markdown
Member

@abreumatheus hi! I tested it here for the PokèAPI and it worked perfectly, beautiful! ⭐ Super cool feature collapsing indeed, I love it. It worked for firefox, chrome and safari 👏

But when I tested for the demo-api, it did not work quite well. Would you mind to try it with demo-api too?

https://github.com/scanapi/scanapi/blob/master/CONTRIBUTING.md#clone-scanapi-examples

$ source ../examples/demo-api/.env
$ poetry run scanapi ../examples/demo-api/api.yaml -c ../examples/demo-api/.scanapi.yaml -o ../examples/demo-api/scanapi-report.html

image


image


image

I don't know if it is a problem with our demo-api... 🤷‍♀️

@abreumatheus
Copy link
Copy Markdown
Member Author

@camilamaia I will check it here and see if there is anything wrong with both :)

@abreumatheus abreumatheus requested review from a team as code owners July 27, 2020 22:13
@github-actions
Copy link
Copy Markdown

@abreumatheus your pull request is missing a changelog!

@abreumatheus
Copy link
Copy Markdown
Member Author

@camilamaia The problem is actually with the demo api not outputing valid JSON in some endpoints, like the first one where the response is OK! in plain text instead of something like {"msg": "OK!"}. And if one of them is broken, the rest won't render.

@abreumatheus
Copy link
Copy Markdown
Member Author

@camilamaia @barbosa Hi guys! Just updated the script, and now it's non blocking. If it encounters non valid JSON it just goes to the next response. Could you test it again with the demo api?

@camilamaia
Copy link
Copy Markdown
Member

@abreumatheus it worked perfectly! Ty very much!. This is feature is really important

@camilamaia camilamaia merged commit 790b2ba into master Jul 29, 2020
@camilamaia camilamaia deleted the render_json_response branch July 29, 2020 18:09
@camilamaia camilamaia mentioned this pull request Aug 25, 2020
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.

4 participants