Skip to content

Commit

Permalink
[Enhancement] Re-introduce ability to send API requests from browser (#…
Browse files Browse the repository at this point in the history
…264)

* Use ClodeBlock to render response

* Add execute/send feature back

* Experiment with SEND feature

* Add oauth2 support

* Add authorization component back to demo panel

* Add xml highlighting support

* Make label optional

* Ensure unique keys in Authorization and SecuritySchemes

* Change execute button styles

* Wrap response in details and replace floating button

* Reorder demo panel

* Update demo panel styles

* Wrap security schemes in details

* Cleanup unused imports/code

* Remove IOT API

* Re-gen API docs

* Cleanup iot docs

* Create Request component and collapse when send button is clicked

* Include server description when available

* Re-gen API docs

* Add summary class to security schemes

* Re-gen API docs

* Artificial delay

* Conditional render send button

* Add required label support to demo panel

* Fix nested li

* Rename class to className

* Hard set sessionStorage

* Re-gen API docs

* Hard set sessionStorage

* Add timeout

* Add terms of use modal support as placeholder

* Replace non-escaped double quotes with single

* Add quotes around tag description
  • Loading branch information
sserrata authored Sep 16, 2022
1 parent 1fa237e commit 336f7d6
Show file tree
Hide file tree
Showing 77 changed files with 941 additions and 155 deletions.
2 changes: 1 addition & 1 deletion demo/docs/petstore/add-pet.api.mdx

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions demo/docs/petstore/create-user.api.mdx

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions demo/docs/petstore/create-users-with-array-input.api.mdx

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions demo/docs/petstore/create-users-with-list-input.api.mdx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/docs/petstore/delete-order.api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: "For valid response try integer IDs with value < 1000. Anything abo
sidebar_label: Delete purchase order by ID
hide_title: true
hide_table_of_contents: true
api: {"tags":["store"],"description":"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors","operationId":"deleteOrder","parameters":[{"name":"orderId","in":"path","description":"ID of the order that needs to be deleted","required":true,"schema":{"type":"string","minimum":1}}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Order not found"}},"method":"delete","path":"/store/order/{orderId}","servers":[{"url":"https://petstore.swagger.io/v2","description":"Default server"},{"url":"https://petstore.swagger.io/sandbox","description":"Sandbox server"}],"securitySchemes":{"petstore_auth":{"description":"Get access to data while protecting your account credentials.\nOAuth2 is also a safer and more secure way to give you access.\n","type":"oauth2","flows":{"implicit":{"authorizationUrl":"http://petstore.swagger.io/api/oauth/dialog","scopes":{"write:pets":"modify pets in your account","read:pets":"read your pets"}}}},"api_key":{"description":"For this sample, you can use the api key `special-key` to test the authorization filters.\n","type":"apiKey","name":"api_key","in":"header"}},"info":{"description":"This is a sample server Petstore server.\nYou can find out more about Swagger at\n[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n\n## Introduction\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n## OpenAPI Specification\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n## Cross-Origin Resource Sharing\nThis API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/).\nAnd that allows cross-domain communication from the browser.\nAll responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.\n\n## Authentication\n\nPetstore offers two forms of authentication:\n - API Key\n - OAuth2\nOAuth2 - an open protocol to allow secure authorization in a simple\nand standard method from web, mobile and desktop applications.\n","version":"2.0.0","title":"Swagger Petstore YAML","termsOfService":"http://swagger.io/terms/","contact":{"name":"API Support","email":"[email protected]","url":"https://github.com/Redocly/redoc"},"x-logo":{"url":"https://redocly.github.io/redoc/petstore-logo.png","altText":"Petstore logo"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"postman":{"name":"Delete purchase order by ID","description":{"content":"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors","type":"text/plain"},"url":{"path":["store","order",":orderId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"disabled":false,"description":{"content":"(Required) ID of the order that needs to be deleted","type":"text/plain"},"type":"any","value":"","key":"orderId"}]},"method":"DELETE"}}
api: {"tags":["store"],"description":"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors","operationId":"deleteOrder","parameters":[{"name":"orderId","in":"path","description":"ID of the order that needs to be deleted","required":true,"schema":{"type":"string","minimum":1}}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Order not found"}},"method":"delete","path":"/store/order/{orderId}","servers":[{"url":"https://petstore.swagger.io/v2","description":"Default server"},{"url":"https://petstore.swagger.io/sandbox","description":"Sandbox server"},{"url":"http://127.0.0.1:4010","description":"Prism Mock API (local)"}],"securitySchemes":{"petstore_auth":{"description":"Get access to data while protecting your account credentials.\nOAuth2 is also a safer and more secure way to give you access.\n","type":"oauth2","flows":{"implicit":{"authorizationUrl":"http://petstore.swagger.io/api/oauth/dialog","scopes":{"write:pets":"modify pets in your account","read:pets":"read your pets"}}}},"api_key":{"description":"For this sample, you can use the api key `special-key` to test the authorization filters.\n","type":"apiKey","name":"api_key","in":"header"}},"info":{"description":"This is a sample server Petstore server.\nYou can find out more about Swagger at\n[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n\n## Introduction\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n## OpenAPI Specification\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n## Cross-Origin Resource Sharing\nThis API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/).\nAnd that allows cross-domain communication from the browser.\nAll responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.\n\n## Authentication\n\nPetstore offers two forms of authentication:\n - API Key\n - OAuth2\nOAuth2 - an open protocol to allow secure authorization in a simple\nand standard method from web, mobile and desktop applications.\n","version":"2.0.0","title":"Swagger Petstore YAML","termsOfService":"http://swagger.io/terms/","contact":{"name":"API Support","email":"[email protected]","url":"https://github.com/Redocly/redoc"},"x-logo":{"url":"https://redocly.github.io/redoc/petstore-logo.png","altText":"Petstore logo"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"postman":{"name":"Delete purchase order by ID","description":{"content":"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors","type":"text/plain"},"url":{"path":["store","order",":orderId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"disabled":false,"description":{"content":"(Required) ID of the order that needs to be deleted","type":"text/plain"},"type":"any","value":"","key":"orderId"}]},"method":"DELETE"}}
sidebar_class_name: "delete api-method"
info_path: petstore/swagger-petstore-yaml
custom_edit_url: "https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/new?labels=documentation&template=documentation_problem.md&title=[Documentation] Requesting changes to 'Delete purchase order by ID' (delete-order)"
Expand Down
2 changes: 1 addition & 1 deletion demo/docs/petstore/delete-pet.api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: ""
sidebar_label: Deletes a pet
hide_title: true
hide_table_of_contents: true
api: {"tags":["pet"],"description":"","operationId":"deletePet","parameters":[{"name":"api_key","in":"header","required":false,"schema":{"type":"string"},"example":"Bearer <TOKEN>"},{"name":"petId","in":"path","description":"Pet id to delete","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"400":{"description":"Invalid pet value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}],"method":"delete","path":"/pet/{petId}","servers":[{"url":"https://petstore.swagger.io/v2","description":"Default server"},{"url":"https://petstore.swagger.io/sandbox","description":"Sandbox server"}],"securitySchemes":{"petstore_auth":{"description":"Get access to data while protecting your account credentials.\nOAuth2 is also a safer and more secure way to give you access.\n","type":"oauth2","flows":{"implicit":{"authorizationUrl":"http://petstore.swagger.io/api/oauth/dialog","scopes":{"write:pets":"modify pets in your account","read:pets":"read your pets"}}}},"api_key":{"description":"For this sample, you can use the api key `special-key` to test the authorization filters.\n","type":"apiKey","name":"api_key","in":"header"}},"info":{"description":"This is a sample server Petstore server.\nYou can find out more about Swagger at\n[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n\n## Introduction\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n## OpenAPI Specification\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n## Cross-Origin Resource Sharing\nThis API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/).\nAnd that allows cross-domain communication from the browser.\nAll responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.\n\n## Authentication\n\nPetstore offers two forms of authentication:\n - API Key\n - OAuth2\nOAuth2 - an open protocol to allow secure authorization in a simple\nand standard method from web, mobile and desktop applications.\n","version":"2.0.0","title":"Swagger Petstore YAML","termsOfService":"http://swagger.io/terms/","contact":{"name":"API Support","email":"[email protected]","url":"https://github.com/Redocly/redoc"},"x-logo":{"url":"https://redocly.github.io/redoc/petstore-logo.png","altText":"Petstore logo"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"postman":{"name":"Deletes a pet","description":{"content":"","type":"text/plain"},"url":{"path":["pet",":petId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"disabled":false,"description":{"content":"(Required) Pet id to delete","type":"text/plain"},"type":"any","value":"","key":"petId"}]},"header":[{"disabled":false,"description":{"content":"","type":"text/plain"},"key":"api_key","value":""}],"method":"DELETE","auth":{"type":"oauth2","oauth2":[]}}}
api: {"tags":["pet"],"description":"","operationId":"deletePet","parameters":[{"name":"api_key","in":"header","required":false,"schema":{"type":"string"},"example":"Bearer <TOKEN>"},{"name":"petId","in":"path","description":"Pet id to delete","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"400":{"description":"Invalid pet value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}],"method":"delete","path":"/pet/{petId}","servers":[{"url":"https://petstore.swagger.io/v2","description":"Default server"},{"url":"https://petstore.swagger.io/sandbox","description":"Sandbox server"},{"url":"http://127.0.0.1:4010","description":"Prism Mock API (local)"}],"securitySchemes":{"petstore_auth":{"description":"Get access to data while protecting your account credentials.\nOAuth2 is also a safer and more secure way to give you access.\n","type":"oauth2","flows":{"implicit":{"authorizationUrl":"http://petstore.swagger.io/api/oauth/dialog","scopes":{"write:pets":"modify pets in your account","read:pets":"read your pets"}}}},"api_key":{"description":"For this sample, you can use the api key `special-key` to test the authorization filters.\n","type":"apiKey","name":"api_key","in":"header"}},"info":{"description":"This is a sample server Petstore server.\nYou can find out more about Swagger at\n[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n\n## Introduction\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n## OpenAPI Specification\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).\n\n## Cross-Origin Resource Sharing\nThis API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/).\nAnd that allows cross-domain communication from the browser.\nAll responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.\n\n## Authentication\n\nPetstore offers two forms of authentication:\n - API Key\n - OAuth2\nOAuth2 - an open protocol to allow secure authorization in a simple\nand standard method from web, mobile and desktop applications.\n","version":"2.0.0","title":"Swagger Petstore YAML","termsOfService":"http://swagger.io/terms/","contact":{"name":"API Support","email":"[email protected]","url":"https://github.com/Redocly/redoc"},"x-logo":{"url":"https://redocly.github.io/redoc/petstore-logo.png","altText":"Petstore logo"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"postman":{"name":"Deletes a pet","description":{"content":"","type":"text/plain"},"url":{"path":["pet",":petId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"disabled":false,"description":{"content":"(Required) Pet id to delete","type":"text/plain"},"type":"any","value":"","key":"petId"}]},"header":[{"disabled":false,"description":{"content":"","type":"text/plain"},"key":"api_key","value":""}],"method":"DELETE","auth":{"type":"oauth2","oauth2":[]}}}
sidebar_class_name: "delete api-method"
info_path: petstore/swagger-petstore-yaml
custom_edit_url: "https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/new?labels=documentation&template=documentation_problem.md&title=[Documentation] Requesting changes to 'Deletes a pet' (delete-pet)"
Expand Down
Loading

0 comments on commit 336f7d6

Please sign in to comment.