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

feat(emx2): JSON api for reports #4410

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

harmbrugge
Copy link
Member

@harmbrugge harmbrugge commented Oct 29, 2024

Fixes: #4360

What are the main changes you did:

  • Added a JSON api mapping for reports
  • Added a json download button to the reports view

how to test:

  • Go to the pet store schema
  • Click on reports, and select the first one
  • Click on the download as json button
  • See the json

todo:

  • support special case where the query returns 1 json objects
  • updated docs to explain us of this json
  • add test for the single json blob

@harmbrugge harmbrugge self-assigned this Oct 29, 2024
Copy link
Member

@mswertz mswertz left a comment

Choose a reason for hiding this comment

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

very nice, puts a smile on my face, but one bonus request see comments

for (Row row : rows) {
result.add(row.getValueMap());
}
jsonResponse.put(name, result);
Copy link
Member

Choose a reason for hiding this comment

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

this is nice, but ... we could make SQL that produces JSON itself. So I would propose we adapt this such that if the row has only one value, and that value is of type JSONB that we return that value? Could you try to make testcase report that produces JSON to test this? Then we could amend the docs to make that clear

Copy link
Member Author

Choose a reason for hiding this comment

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

The reports indeed break if you use jsonb I added this.

Copy link

sonarcloud bot commented Oct 30, 2024

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.

feat: JSON API endpoint for reports
2 participants