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

[Enhancement] Re-introduce ability to send API requests from browser #264

Merged
merged 35 commits into from
Sep 16, 2022

Conversation

sserrata
Copy link
Member

@sserrata sserrata commented Sep 14, 2022

Description

Re-introduces option to send API requests from browser.

Deploy preview: https://docusaurus-openapi-36b86--pr264-gl3vi0at.web.app/

Additional changes:

  • Wrap API and info frontmatter description with double quotes and replace all non-escaped double quotes with single.
  • Fix various issues with nested li tags and renaming of class to className.
  • Add boilerplate for supporting a pop-up modal for requesting end-user agreement before sending requests from browser.
  • Extend security scheme support and fix [Bug] Console warning: Duplicate key for multiple Security Schemes #123.
  • Refactored the ApiDemoPanel to a more logical layout and moved API credential input inside panel.
  • Now grouping Authorization and Request under details components.
  • ApiDemoPanel Request input params now supports required label.

Motivation and Context

Despite the inherent security risk of exposing API keys to the browser the "try it" feature is a common feature in most interactive API docs tools. If the end-user is willing the accept the risk then we may allows maintainers to enable this feature.

How Has This Been Tested?

Tested with Petstore API using prism mock server.

@github-actions
Copy link

github-actions bot commented Sep 14, 2022

Size Change: +37.9 kB (+1%)

Total Size: 3.8 MB

Filename Size Change
demo/build/assets/css/styles.********.css 93.7 kB +788 B (+1%)
demo/build/assets/js/006e727e.********.js 13.9 kB +142 B (+1%)
demo/build/assets/js/0d832478.********.js 26.4 kB +135 B (+1%)
demo/build/assets/js/12693653.********.js 25.6 kB +135 B (+1%)
demo/build/assets/js/177e86db.********.js 11.3 kB +134 B (+1%)
demo/build/assets/js/19d75775.********.js 9.2 kB +134 B (+1%)
demo/build/assets/js/1a8cc2a6.********.js 12.1 kB +134 B (+1%)
demo/build/assets/js/1e6c5cae.********.js 34.8 kB +134 B (0%)
demo/build/assets/js/1e6ff21d.********.js 10.8 kB +134 B (+1%)
demo/build/assets/js/40a238b6.********.js 25.6 kB +135 B (+1%)
demo/build/assets/js/41cd56a1.********.js 10.2 kB +134 B (+1%)
demo/build/assets/js/4b891ed6.********.js 11.8 kB +134 B (+1%)
demo/build/assets/js/4c5e977b.********.js 38.5 kB +6.84 kB (+22%) 🚨
demo/build/assets/js/55a6d13f.********.js 14.4 kB +142 B (+1%)
demo/build/assets/js/57f1a671.********.js 11.3 kB +134 B (+1%)
demo/build/assets/js/6568.********.js 0 B -1.31 MB (removed) 🏆
demo/build/assets/js/66c76a57.********.js 35.4 kB +310 B (+1%)
demo/build/assets/js/68b61ac5.********.js 44.5 kB +136 B (0%)
demo/build/assets/js/73b594ee.********.js 35.2 kB +134 B (0%)
demo/build/assets/js/7ca3ae45.********.js 17.5 kB +134 B (+1%)
demo/build/assets/js/7ed7dafe.********.js 26.8 kB +135 B (+1%)
demo/build/assets/js/86b273b1.********.js 10.5 kB +134 B (+1%)
demo/build/assets/js/86c45737.********.js 24 kB +134 B (+1%)
demo/build/assets/js/8961c7a6.********.js 22.9 kB +134 B (+1%)
demo/build/assets/js/8ab9b16e.********.js 10.4 kB +134 B (+1%)
demo/build/assets/js/91696e06.********.js 35 kB +310 B (+1%)
demo/build/assets/js/94589c06.********.js 19.6 kB +134 B (+1%)
demo/build/assets/js/97810f3c.********.js 25.3 kB +135 B (+1%)
demo/build/assets/js/9b5caaf3.********.js 26.2 kB +135 B (+1%)
demo/build/assets/js/9c42c0f3.********.js 34.5 kB +134 B (0%)
demo/build/assets/js/a6cd895f.********.js 22 kB +134 B (+1%)
demo/build/assets/js/a728d93a.********.js 10 kB +134 B (+1%)
demo/build/assets/js/ab09fd5c.********.js 21.5 kB +134 B (+1%)
demo/build/assets/js/ae7f40a3.********.js 44.1 kB +136 B (0%)
demo/build/assets/js/b4ebd305.********.js 17.9 kB +134 B (+1%)
demo/build/assets/js/b5c059ef.********.js 34.1 kB +134 B (0%)
demo/build/assets/js/c7a5be9f.********.js 10.6 kB +134 B (+1%)
demo/build/assets/js/cf07762b.********.js 23.6 kB +134 B (+1%)
demo/build/assets/js/dd696920.********.js 25.7 kB +135 B (+1%)
demo/build/assets/js/e015ccf9.********.js 26.1 kB +135 B (+1%)
demo/build/assets/js/e01f8d18.********.js 8.64 kB +134 B (+2%)
demo/build/assets/js/eaf4471e.********.js 12.5 kB +134 B (+1%)
demo/build/assets/js/f212caf7.********.js 23.4 kB +134 B (+1%)
demo/build/assets/js/f65290a6.********.js 11 kB +134 B (+1%)
demo/build/assets/js/fe97f0d1.********.js 19.2 kB +134 B (+1%)
demo/build/assets/js/5773.********.js 1.34 MB +1.34 MB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
demo/.docusaurus/globalData.json 19.7 kB 0 B
demo/build/assets/js/05f64ae1.********.js 2.83 kB 0 B
demo/build/assets/js/06b64fc1.********.js 575 B 0 B
demo/build/assets/js/06e5f0f0.********.js 36.9 kB 0 B
demo/build/assets/js/081bfb0d.********.js 9.96 kB 0 B
demo/build/assets/js/09e07b87.********.js 3.01 kB 0 B
demo/build/assets/js/14eb3368.********.js 9.28 kB 0 B
demo/build/assets/js/1639936b.********.js 4.41 kB 0 B
demo/build/assets/js/16577668.********.js 387 B 0 B
demo/build/assets/js/18c41134.********.js 12.7 kB 0 B
demo/build/assets/js/1be78505.********.js 10.6 kB 0 B
demo/build/assets/js/1c54f54e.********.js 10.7 kB 0 B
demo/build/assets/js/1e4232ab.********.js 3.16 kB 0 B
demo/build/assets/js/1f818248.********.js 14.7 kB 0 B
demo/build/assets/js/2c860537.********.js 7.87 kB 0 B
demo/build/assets/js/3136173c.********.js 361 B 0 B
demo/build/assets/js/326c3861.********.js 15.7 kB 0 B
demo/build/assets/js/3893.********.js 1.07 kB 0 B
demo/build/assets/js/3946f914.********.js 34.6 kB 0 B
demo/build/assets/js/39d00f16.********.js 16.1 kB 0 B
demo/build/assets/js/3e0d14e9.********.js 22.8 kB 0 B
demo/build/assets/js/423cd203.********.js 13.8 kB +8 B (0%)
demo/build/assets/js/4261.********.js 480 B 0 B
demo/build/assets/js/466ac800.********.js 43.8 kB +2 B (0%)
demo/build/assets/js/46afcded.********.js 8.21 kB 0 B
demo/build/assets/js/46e5c6ac.********.js 6.86 kB 0 B
demo/build/assets/js/47abaca6.********.js 2.92 kB 0 B
demo/build/assets/js/4935.********.js 1.05 kB 0 B
demo/build/assets/js/4964e910.********.js 25.1 kB +1 B (0%)
demo/build/assets/js/49bd3d39.********.js 17.4 kB 0 B
demo/build/assets/js/533a09ca.********.js 2.49 kB 0 B
demo/build/assets/js/56717cba.********.js 2.98 kB 0 B
demo/build/assets/js/58ff8b1e.********.js 21.4 kB 0 B
demo/build/assets/js/597ddc40.********.js 10.5 kB 0 B
demo/build/assets/js/5c868d36.********.js 3.25 kB 0 B
demo/build/assets/js/5fb917be.********.js 2.6 kB 0 B
demo/build/assets/js/63fc267d.********.js 11.3 kB 0 B
demo/build/assets/js/69a61f78.********.js 25.4 kB +1 B (0%)
demo/build/assets/js/77264a1a.********.js 34.5 kB 0 B
demo/build/assets/js/8003.********.js 5.45 kB 0 B
demo/build/assets/js/822bd8ab.********.js 2.88 kB 0 B
demo/build/assets/js/85d3c400.********.js 2.91 kB 0 B
demo/build/assets/js/85ec4403.********.js 4.68 kB 0 B
demo/build/assets/js/86c346b0.********.js 538 B 0 B
demo/build/assets/js/881db345.********.js 394 B 0 B
demo/build/assets/js/8d4e78cd.********.js 2.85 kB 0 B
demo/build/assets/js/8f441c78.********.js 15.6 kB 0 B
demo/build/assets/js/93304a97.********.js 4.53 kB 0 B
demo/build/assets/js/935f2afb.********.js 43.6 kB 0 B
demo/build/assets/js/967247e2.********.js 8.71 kB 0 B
demo/build/assets/js/a40c6d71.********.js 8.56 kB 0 B
demo/build/assets/js/a5491aaa.********.js 400 B 0 B
demo/build/assets/js/aa2f1ec7.********.js 23.4 kB 0 B
demo/build/assets/js/ab6072f2.********.js 25.4 kB +1 B (0%)
demo/build/assets/js/bead4b8e.********.js 3.06 kB 0 B
demo/build/assets/js/bf271e74.********.js 401 B 0 B
demo/build/assets/js/c65697f5.********.js 26.3 kB +1 B (0%)
demo/build/assets/js/c7ded1cb.********.js 2.96 kB 0 B
demo/build/assets/js/cef3f2e2.********.js 5.8 kB 0 B
demo/build/assets/js/common.********.js 159 kB 0 B
demo/build/assets/js/d63c7029.********.js 2.94 kB 0 B
demo/build/assets/js/dff1c289.********.js 3.9 kB 0 B
demo/build/assets/js/e2ce9793.********.js 402 B 0 B
demo/build/assets/js/e44a2883.********.js 4.54 kB 0 B
demo/build/assets/js/e5e5340c.********.js 2.5 kB 0 B
demo/build/assets/js/e8b309fb.********.js 577 B 0 B
demo/build/assets/js/eae14b71.********.js 33.8 kB 0 B
demo/build/assets/js/ecc39b49.********.js 172 B 0 B
demo/build/assets/js/ee308fa3.********.js 10.2 kB 0 B
demo/build/assets/js/f4486b6b.********.js 12 kB 0 B
demo/build/assets/js/f55d3e7a.********.js 2.71 kB 0 B
demo/build/assets/js/f8409a7e.********.js 33.3 kB 0 B
demo/build/assets/js/f84e10c2.********.js 19.1 kB 0 B
demo/build/assets/js/main.********.js 394 kB 0 B
demo/build/assets/js/runtime~main.********.js 8.86 kB 0 B
demo/build/index.html 87.3 kB 0 B

compressed-size-action

@github-actions
Copy link

github-actions bot commented Sep 14, 2022

Visit the preview URL for this PR (updated for commit be2149e):

https://docusaurus-openapi-36b86--pr264-gl3vi0at.web.app

(expires Sun, 16 Oct 2022 13:44:14 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@sserrata sserrata changed the title [Experimental] Re-introduce ability to send API requests from browser [Enhancement] Re-introduce ability to send API requests from browser Sep 16, 2022
@sserrata sserrata added the enhancement New feature or request label Sep 16, 2022
@sserrata sserrata merged commit 336f7d6 into main Sep 16, 2022
@sserrata sserrata deleted the send-request branch September 16, 2022 14:27
@ketansevekari
Copy link

@sserrata I have deployed the Docusaurus plugin for OpenAPI docs. But I don't see the "Send API Request" button. Also, I have verified that the "hideSendButton" is not present in my Docusaurus config file. Can you help me understand why the "Send API Request" button is not visible?

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

Successfully merging this pull request may close these issues.

[Bug] Console warning: Duplicate key for multiple Security Schemes
2 participants