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: Add Swagger UI to playground #1979

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

nasdf
Copy link
Member

@nasdf nasdf commented Oct 18, 2023

Relevant issue(s)

Resolves #1978

Description

This PR updates the playground with a Swagger UI tab that allows users to view and interact with the DefraDB API. The UI is auto generated from the OpenAPI specification served from the /openapi.json endpoint.

Screenshot 2023-10-17 at 11 02 12 AM

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

Manually

Specify the platform(s) on which this was tested:

  • MacOS

@nasdf nasdf added the feature New feature or request label Oct 18, 2023
@nasdf nasdf added this to the DefraDB v0.8 milestone Oct 18, 2023
@nasdf nasdf self-assigned this Oct 18, 2023
@nasdf nasdf changed the title add swagger ui to playground feat: Add Swagger UI to playground Oct 18, 2023
@nasdf nasdf requested a review from a team October 18, 2023 18:08
@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (28f207d) 74.76% compared to head (8b92b0a) 74.78%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1979      +/-   ##
===========================================
+ Coverage    74.76%   74.78%   +0.01%     
===========================================
  Files          246      246              
  Lines        24298    24298              
===========================================
+ Hits         18166    18169       +3     
+ Misses        4918     4916       -2     
+ Partials      1214     1213       -1     
Flag Coverage Δ
all-tests 74.78% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28f207d...8b92b0a. Read the comment docs.

display: flex;
flex-direction: column;
gap: 16px;
.swagger-ui .opblock .opblock-summary {
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Is any of this css hand crafted, or is it some default stuff copy-pasted from somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

I went through and manually updated the styles for dark mode. They don't have css variable support in Swagger UI so this was the next best option.

Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

LGTM - everything looks to be shaping up nicely :)

Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

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

LGTM! I love the fact that the UI is auto generated for the openapi endpoint response.

@nasdf nasdf merged commit 9cfd33f into sourcenetwork:develop Oct 18, 2023
29 checks passed
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
## Relevant issue(s)

Resolves sourcenetwork#1978 

## Description

This PR updates the playground with a [Swagger
UI](https://swagger.io/tools/swagger-ui/) tab that allows users to view
and interact with the DefraDB API. The UI is auto generated from the
OpenAPI specification served from the `/openapi.json` endpoint.

<img width="1608" alt="Screenshot 2023-10-17 at 11 02 12 AM"
src="https://github.com/sourcenetwork/defradb/assets/1862560/54f9d6c4-82ef-4580-b021-d0e3e36d7534">

## Tasks

- [x] I made sure the code is well commented, particularly
hard-to-understand areas.
- [x] I made sure the repository-held documentation is changed
accordingly.
- [x] I made sure the pull request title adheres to the conventional
commit style (the subset used in the project can be found in
[tools/configs/chglog/config.yml](tools/configs/chglog/config.yml)).
- [x] I made sure to discuss its limitations such as threats to
validity, vulnerability to mistake and misuse, robustness to
invalidation of assumptions, resource requirements, ...

## How has this been tested?

Manually

Specify the platform(s) on which this was tested:
- MacOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support full API in playground
3 participants