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

Group requests by parent endpoint #498

Open
GitVitor opened this issue Aug 18, 2021 · 5 comments
Open

Group requests by parent endpoint #498

GitVitor opened this issue Aug 18, 2021 · 5 comments
Assignees
Labels
Report Template Changes associated to the report template HTML & CSS Reporter Related with the API doc generated by ScanAPI

Comments

@GitVitor
Copy link
Contributor

Feature request

Description the feature

I thought that the report HTML could group requests by endpoint;

Using httpbin example.
There we find multiples endpoints, http-methods and images;
image

Maybe the report HTML could toggle each endpoint request inside a Collapse element;
Bootstrap collapse example

Content to be inside Collapse element;
image

Is your feature request related to a problem?

Not necessarily a technical problem, but we could see it as an usability problem.

Do you have any suggestions on how to add this feature in scanapi ?

For each request, attach an prop that refer parent endpoint name, with that prop we could build a collapse, following bellow structure.

{
  "httpbin::http-methods": [
     SOME_POST_REQUEST,
     SOME_GET_REQUEST,
     SOME_PUT_REQUEST
   ],
  "httpbin::images": [
     SOME_POST_REQUEST,
     SOME_GET_REQUEST,
     SOME_PUT_REQUEST
   ]
}

And for UI development we could follow Bootstrap collapse example:
Bootstrap collapse example

@GitVitor GitVitor added Reporter Related with the API doc generated by ScanAPI Needs Triage Needs triage from the maintainer or core devs. Report Template Changes associated to the report template HTML & CSS labels Aug 18, 2021
@GitVitor GitVitor self-assigned this Aug 18, 2021
@camilamaia camilamaia removed the Needs Triage Needs triage from the maintainer or core devs. label Aug 19, 2021
@camilamaia
Copy link
Member

Hey @GitVitor I love the idea and I think it is extremely useful! Specially when the API has lots of requests and endpoints.

Some points that crossed my mind:

  • What happens when the spec has a nested endpoint? Are we going to have one collapse inside another?
  • Do you think an option to have a "flat" report is needed. I mean, a flat report would be a report without the endpoint groups?

Thanks!!

@GitVitor
Copy link
Contributor Author

GitVitor commented Aug 21, 2021

@camilamaia thanks to answer.

What happens when the spec has a nested endpoint? Are we going to have one collapse inside another?

I thought that is not a good experience collapse one inside another; Maybe all collapse could be at the same level.

Do you think an option to have a "flat" report is needed. I mean, a flat report would be a report without the endpoint groups?

I'm not sure if a really understand what do you mean with that. Basically it's an option in .yaml file? Then if it's true, the Reporter provide a flat report without any collapse option?
Maybe we could provide this option in HTML, where the user choose which visualization to see.

This last option that i mention require an upgrade in report, build the report using something like preact No build tool + Jinja2.

@camilamaia
Copy link
Member

@GitVitor

About point 1:

I thought that is not a good experience collapse one inside another; Maybe all collapse could be at the same level.

I agree 100% with you. So let's leave the max of 1 level of collapse. If there is any nested endpoint, we can leave everything at the same parent level.

For example, let's say that contact in a nested endpoint of account, the groups in the report should render like this (we will not have a new group contact inside the account group):

ACCOUNT

    GET /account
    POST /account
    PUT /account/id
    PATCH /account/id
    DELETE /account/id
    GET /account/contact/
    POST /account/contact/
    PUT /account/contact/id
    PATCH /account/contact/id
    DELETE /account/contact/id

BOOKS

    GET /book
    POST /book
    PUT /book/id
    PATCH /book/id
    DELETE /book/id

About point 2:

Yes, I was suggesting having an option in the CLI / configuration file to render the report in a flat format. For example:

$ scanapi run --flat-report

But I don't really think this is necessary, I was more brainstorming haha let's skip it for now, what do you think?

@GitVitor
Copy link
Contributor Author

GitVitor commented Aug 26, 2021

@camilamaia
About point 1:

I thought report could present in following format:

ACCOUNT

    GET /account
    POST /account
    PUT /account/id
    PATCH /account/id
    DELETE /account/id

ACCOUNT/CONTACT

    GET /account/contact/
    POST /account/contact/
    PUT /account/contact/id
    PATCH /account/contact/id
    DELETE /account/contact/id

I like two suggestion, this last that i reffer and yours.

About point 2:
Let's skip for now 😄

@camilamaia
Copy link
Member

@GitVitor +1 for your suggestion. Even better! Let's go with it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Report Template Changes associated to the report template HTML & CSS Reporter Related with the API doc generated by ScanAPI
Projects
None yet
Development

No branches or pull requests

2 participants