redoc 2.0.0-rc.9 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/CHANGELOG.md +920 -10
  2. package/README.md +244 -187
  3. package/bundles/756674defce81e90acea.worker.js.LICENSE.txt +68 -0
  4. package/bundles/756674defce81e90acea.worker.js.map +1 -0
  5. package/bundles/redoc.browser.lib.js +1820 -0
  6. package/bundles/redoc.browser.lib.js.LICENSE.txt +6 -0
  7. package/bundles/redoc.browser.lib.js.map +1 -0
  8. package/bundles/redoc.lib.js +1744 -13438
  9. package/bundles/redoc.lib.js.LICENSE.txt +6 -0
  10. package/bundles/redoc.lib.js.map +1 -1
  11. package/bundles/redoc.standalone.js +1819 -122
  12. package/bundles/redoc.standalone.js.LICENSE.txt +95 -0
  13. package/bundles/redoc.standalone.js.map +1 -1
  14. package/package.json +131 -112
  15. package/typings/common-elements/CopyButtonWrapper.d.ts +4 -10
  16. package/typings/common-elements/Dropdown/Dropdown.d.ts +3 -0
  17. package/typings/common-elements/Dropdown/index.d.ts +2 -0
  18. package/typings/common-elements/Dropdown/styled.d.ts +8 -0
  19. package/typings/common-elements/Dropdown/types.d.ts +24 -0
  20. package/typings/common-elements/fields.d.ts +7 -2
  21. package/typings/common-elements/headers.d.ts +1 -1
  22. package/typings/common-elements/index.d.ts +1 -1
  23. package/typings/common-elements/linkify.d.ts +4 -8
  24. package/typings/common-elements/mixins.d.ts +1 -1
  25. package/typings/common-elements/panels.d.ts +4 -3
  26. package/typings/common-elements/samples.d.ts +3 -1
  27. package/typings/common-elements/schema.d.ts +3 -2
  28. package/typings/common-elements/shelfs.d.ts +2 -6
  29. package/typings/components/ApiInfo/styled.elements.d.ts +3 -1
  30. package/typings/components/ApiLogo/styled.elements.d.ts +1 -0
  31. package/typings/components/CallbackSamples/CallbackReqSamples.d.ts +11 -0
  32. package/typings/components/CallbackSamples/CallbackSamples.d.ts +13 -0
  33. package/typings/components/Callbacks/CallbackDetails.d.ts +8 -0
  34. package/typings/components/Callbacks/CallbackOperation.d.ts +8 -0
  35. package/typings/components/Callbacks/CallbackTitle.d.ts +10 -0
  36. package/typings/components/Callbacks/CallbacksList.d.ts +8 -0
  37. package/typings/components/Callbacks/index.d.ts +3 -0
  38. package/typings/components/Callbacks/styled.elements.d.ts +3 -0
  39. package/typings/components/ContentItems/ContentItems.d.ts +2 -2
  40. package/typings/components/DropdownOrLabel/DropdownOrLabel.d.ts +6 -3
  41. package/typings/components/Endpoint/Endpoint.d.ts +1 -0
  42. package/typings/components/Endpoint/styled.elements.d.ts +3 -2
  43. package/typings/components/ErrorBoundary.d.ts +2 -2
  44. package/typings/components/Fields/ArrayItemDetails.d.ts +5 -0
  45. package/typings/components/Fields/EnumValues.d.ts +8 -2
  46. package/typings/components/Fields/Examples.d.ts +5 -0
  47. package/typings/components/Fields/Field.d.ts +4 -2
  48. package/typings/components/Fields/FieldDetail.d.ts +1 -3
  49. package/typings/components/Fields/FieldDetails.d.ts +2 -3
  50. package/typings/components/Fields/Pattern.d.ts +5 -0
  51. package/typings/components/GenericChildrenSwitcher/GenericChildrenSwitcher.d.ts +22 -0
  52. package/typings/components/JsonViewer/JsonViewer.d.ts +2 -15
  53. package/typings/components/JsonViewer/style.d.ts +1 -1
  54. package/typings/components/Loading/Spinner.svg.d.ts +2 -1
  55. package/typings/components/Markdown/AdvancedMarkdown.d.ts +1 -0
  56. package/typings/components/Markdown/Markdown.d.ts +2 -1
  57. package/typings/components/Markdown/SanitizedMdBlock.d.ts +2 -0
  58. package/typings/components/Markdown/styled.elements.d.ts +1 -1
  59. package/typings/components/MediaTypeSwitch/MediaTypesSwitch.d.ts +3 -4
  60. package/typings/components/Operation/Operation.d.ts +4 -6
  61. package/typings/components/OptionsProvider.d.ts +2 -2
  62. package/typings/components/Parameters/Parameters.d.ts +7 -1
  63. package/typings/components/PayloadSamples/Example.d.ts +1 -0
  64. package/typings/components/PayloadSamples/ExampleValue.d.ts +1 -0
  65. package/typings/components/PayloadSamples/MediaTypeSamples.d.ts +11 -1
  66. package/typings/components/PayloadSamples/styled.elements.d.ts +6 -2
  67. package/typings/components/RedocStandalone.d.ts +2 -11
  68. package/typings/components/Responses/Response.d.ts +3 -5
  69. package/typings/components/Responses/ResponseTitle.d.ts +1 -3
  70. package/typings/components/Responses/ResponsesList.d.ts +1 -0
  71. package/typings/components/Responses/styled.elements.d.ts +6 -3
  72. package/typings/components/Schema/DiscriminatorDropdown.d.ts +2 -4
  73. package/typings/components/Schema/ObjectSchema.d.ts +2 -5
  74. package/typings/components/Schema/RecursiveSchema.d.ts +3 -0
  75. package/typings/components/Schema/Schema.d.ts +2 -1
  76. package/typings/components/SchemaDefinition/SchemaDefinition.d.ts +18 -0
  77. package/typings/components/SearchBox/SearchBox.d.ts +6 -4
  78. package/typings/components/SearchBox/styled.elements.d.ts +2 -1
  79. package/typings/components/SecurityRequirement/OAuthFlow.d.ts +9 -0
  80. package/typings/components/SecurityRequirement/RequiredScopesRow.d.ts +4 -0
  81. package/typings/components/SecurityRequirement/SecurityDetails.d.ts +8 -0
  82. package/typings/components/SecurityRequirement/SecurityHeader.d.ts +8 -0
  83. package/typings/components/SecurityRequirement/SecurityRequirement.d.ts +2 -10
  84. package/typings/components/SecurityRequirement/styled.elements.d.ts +17 -0
  85. package/typings/components/SecuritySchemes/SecuritySchemes.d.ts +7 -9
  86. package/typings/components/SeeMore/SeeMore.d.ts +7 -0
  87. package/typings/components/SelectOnClick/SelectOnClick.d.ts +1 -1
  88. package/typings/components/SideMenu/Logo.d.ts +2 -0
  89. package/typings/components/SideMenu/MenuItem.d.ts +7 -4
  90. package/typings/components/SideMenu/MenuItems.d.ts +1 -1
  91. package/typings/components/SideMenu/SideMenu.d.ts +3 -1
  92. package/typings/components/SideMenu/styled.elements.d.ts +12 -13
  93. package/typings/components/SourceCode/SourceCode.d.ts +3 -7
  94. package/typings/components/StickySidebar/ChevronSvg.d.ts +1 -0
  95. package/typings/components/StickySidebar/StickyResponsiveSidebar.d.ts +10 -3
  96. package/typings/components/StoreBuilder.d.ts +7 -18
  97. package/typings/components/index.d.ts +6 -0
  98. package/typings/index.d.ts +3 -1
  99. package/typings/services/AppStore.d.ts +4 -13
  100. package/typings/services/HistoryService.d.ts +1 -1
  101. package/typings/services/Labels.d.ts +1 -12
  102. package/typings/services/MarkdownRenderer.d.ts +7 -16
  103. package/typings/services/MenuBuilder.d.ts +16 -21
  104. package/typings/services/MenuStore.d.ts +10 -23
  105. package/typings/services/OpenAPIParser.d.ts +21 -23
  106. package/typings/services/RedocNormalizedOptions.d.ts +61 -6
  107. package/typings/services/ScrollService.d.ts +1 -1
  108. package/typings/services/SearchStore.d.ts +5 -3
  109. package/typings/services/SearchWorker.worker.d.ts +5 -9
  110. package/typings/services/SpecStore.d.ts +6 -4
  111. package/typings/services/index.d.ts +1 -0
  112. package/typings/services/models/ApiInfo.d.ts +6 -3
  113. package/typings/services/models/Callback.d.ts +11 -0
  114. package/typings/services/models/Example.d.ts +2 -2
  115. package/typings/services/models/Field.d.ts +12 -6
  116. package/typings/services/models/Group.model.d.ts +3 -4
  117. package/typings/services/models/MediaContent.d.ts +6 -7
  118. package/typings/services/models/MediaType.d.ts +4 -3
  119. package/typings/services/models/Operation.d.ts +29 -11
  120. package/typings/services/models/RequestBody.d.ts +12 -5
  121. package/typings/services/models/Response.d.ts +14 -4
  122. package/typings/services/models/Schema.d.ts +16 -7
  123. package/typings/services/models/SecurityRequirement.d.ts +3 -2
  124. package/typings/services/models/SecuritySchemes.d.ts +3 -2
  125. package/typings/services/models/Webhook.d.ts +9 -0
  126. package/typings/services/models/index.d.ts +1 -0
  127. package/typings/services/types.d.ts +107 -0
  128. package/typings/styled-components.d.ts +6 -9
  129. package/typings/styled-patch.d.ts +0 -10
  130. package/typings/theme.d.ts +32 -6
  131. package/typings/types/index.d.ts +0 -6
  132. package/typings/types/index.ts +3 -0
  133. package/typings/types/open-api.d.ts +251 -213
  134. package/typings/types/open-api.ts +297 -0
  135. package/typings/utils/dom.d.ts +1 -0
  136. package/typings/utils/helpers.d.ts +10 -5
  137. package/typings/utils/highlight.d.ts +6 -2
  138. package/typings/utils/index.d.ts +1 -0
  139. package/typings/utils/jsonToHtml.d.ts +1 -1
  140. package/typings/utils/openapi.d.ts +23 -14
  141. package/typings/utils/sort.d.ts +6 -0
  142. package/bundles/63bafba847dac11ff66b.worker.js.map +0 -1
  143. package/bundles/ad47ff28a70e23aac7c4.worker.js.map +0 -1
  144. package/typings/common-elements/dropdown.d.ts +0 -13
  145. package/typings/types/components.d.ts +0 -5
  146. /package/typings/components/Fields/{FieldContstraints.d.ts → FieldConstraints.d.ts} +0 -0
package/README.md CHANGED
@@ -1,93 +1,161 @@
1
1
  <div align="center">
2
- <img alt="ReDoc logo" src="https://raw.githubusercontent.com/Redocly/redoc/master/docs/images/redoc-logo.png" width="400px" />
2
+ <img alt="Redoc logo" src="https://raw.githubusercontent.com/Redocly/redoc/main//docs/images/redoc.png" width="400px" />
3
3
 
4
- **OpenAPI/Swagger-generated API Reference Documentation**
5
-
6
- [![Build Status](https://travis-ci.org/Redocly/redoc.svg?branch=master)](https://travis-ci.org/Redocly/redoc) [![Coverage Status](https://coveralls.io/repos/Redocly/redoc/badge.svg?branch=master&service=github)](https://coveralls.io/github/Redocly/redoc?branch=master) [![dependencies Status](https://david-dm.org/Redocly/redoc/status.svg)](https://david-dm.org/Redocly/redoc) [![devDependencies Status](https://david-dm.org/Redocly/redoc/dev-status.svg)](https://david-dm.org/Redocly/redoc#info=devDependencies) [![npm](http://img.shields.io/npm/v/redoc.svg)](https://www.npmjs.com/package/redoc) [![License](https://img.shields.io/npm/l/redoc.svg)](https://github.com/Redocly/redoc/blob/master/LICENSE)
7
-
8
- [![bundle size](http://img.badgesize.io/https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js?compression=gzip&max=300000)](https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js) [![npm](https://img.shields.io/npm/dm/redoc.svg)](https://www.npmjs.com/package/redoc) [![](https://data.jsdelivr.com/v1/package/npm/redoc/badge)](https://www.jsdelivr.com/package/npm/redoc) [![Docker Build Status](https://img.shields.io/docker/build/redocly/redoc.svg)](https://hub.docker.com/r/redocly/redoc/)
4
+ # Generate interactive API documentation from OpenAPI definitions
9
5
 
6
+ [![Coverage Status](https://coveralls.io/repos/Redocly/redoc/badge.svg?branch=main&service=github)](https://coveralls.io/github/Redocly/redoc?branch=main) [![npm](http://img.shields.io/npm/v/redoc.svg)](https://www.npmjs.com/package/redoc) [![License](https://img.shields.io/npm/l/redoc.svg)](https://github.com/Redocly/redoc/blob/main/LICENSE)
10
7
 
8
+ [![bundle size](http://img.badgesize.io/https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js?compression=gzip&max=300000)](https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js) [![npm](https://img.shields.io/npm/dm/redoc.svg)](https://www.npmjs.com/package/redoc) [![](https://data.jsdelivr.com/v1/package/npm/redoc/badge)](https://www.jsdelivr.com/package/npm/redoc) [![Docker Build Status](https://img.shields.io/docker/build/redocly/redoc.svg)](https://hub.docker.com/r/redocly/redoc/)
11
9
  </div>
12
10
 
13
- **This is README for `2.0` version of ReDoc (React based). README for `1.x` version is on the branch [v1.x](https://github.com/Redocly/redoc/tree/v1.x)**
14
-
15
-
16
- ![ReDoc demo](https://raw.githubusercontent.com/Redocly/redoc/master/demo/redoc-demo.png)
17
-
18
- ## [Live demo](http://redocly.github.io/redoc/)
19
-
20
- [<img alt="Deploy to Github" src="http://i.imgur.com/YZmaqk3.png" height="60px">](https://github.com/Rebilly/generator-openapi-repo#generator-openapi-repo--) [<img alt="ReDoc as a service" src="http://i.imgur.com/edqdCv6.png" height="60px">](https://redoc.ly) [<img alt="Customization services" src="http://i.imgur.com/c4sUF7M.png" height="60px">](https://redoc.ly/#services)
11
+ **This is the README for the `2.x` version of Redoc (React-based).**
12
+ **The README for the `1.x` version is on the [v1.x](https://github.com/Redocly/redoc/tree/v1.x) branch.**
13
+
14
+ ## About Redoc
15
+
16
+ Redoc is an open-source tool for generating documentation from OpenAPI (fka Swagger) definitions.
17
+
18
+ By default Redoc offers a three-panel, responsive layout:
19
+
20
+ - The left panel contains a search bar and navigation menu.
21
+ - The central panel contains the documentation.
22
+ - The right panel contains request and response examples.
23
+
24
+ ![Redoc demo](https://raw.githubusercontent.com/Redocly/redoc/main/demo/redoc-demo.png)
25
+
26
+ ## Live demo
27
+
28
+ If you want to see how Redoc renders your OpenAPI definition,
29
+ you can try it out online at https://redocly.github.io/redoc/.
30
+
31
+ A version of the Swagger Petstore API is displayed by default.
32
+ To test it with your own OpenAPI definition,
33
+ enter the URL for your definition and select **TRY IT**.
34
+
35
+ ## Redoc vs. Reference vs. Portals
36
+
37
+ Redoc is Redocly's community-edition product. Looking for something more?
38
+ Checkout the following feature comparison of Redocly's premium products versus Redoc:
39
+
40
+ | Features | Redoc | Reference | Portals |
41
+ |------------------------------|:---------:|:---------:|:-----------:|
42
+ | **Specs** | | | |
43
+ | Swagger 2.0 | √ | √ | √ |
44
+ | OpenAPI 3.0 | √ | √ | √ |
45
+ | OpenAPI 3.1 | √ (basic) | √ | √ |
46
+ | | | | |
47
+ | **Theming** | | | |
48
+ | Fonts/colors | √ | √ | √ |
49
+ | Extra theme options | | √ | √ |
50
+ | | | | |
51
+ | **Performance** | | | |
52
+ | Pagination | | √ | √ |
53
+ | Search (enhanced) | | √ | √ |
54
+ | Search (server-side) | | | √ |
55
+ | | | | |
56
+ | **Multiple APIs** | | | |
57
+ | Multiple versions | | √ | √ |
58
+ | Multiple APIs | | | √ |
59
+ | API catalog | | | √ |
60
+ | | | | |
61
+ | **Additional features** | | | |
62
+ | Try-it console | | √ | √ |
63
+ | Automated code samples | | √ | √ |
64
+ | Deep links | | √ | √ |
65
+ | More SEO control | | | √ |
66
+ | Contextual docs | | | √ |
67
+ | Landing pages | | | √ |
68
+ | React hooks for more control | | | √ |
69
+ | Personalization | | | √ |
70
+ | Analytics integrations | | | √ |
71
+ | Feedback | | | Coming Soon |
72
+
73
+ Refer to the Redocly's documentation for more information on these products:
74
+
75
+ - [Portals](https://redocly.com/docs/developer-portal/introduction/)
76
+ - [Reference](https://redocly.com/docs/api-reference-docs/getting-started/)
77
+ - [Redoc](https://redocly.com/docs/redoc/quickstart/intro/)
21
78
 
22
79
  ## Features
23
- - Extremely easy deployment
24
- - [redoc-cli](https://github.com/Redocly/redoc/blob/master/cli/README.md) with ability to bundle your docs into **zero-dependency** HTML file
25
- - Server Side Rendering ready
26
- - The widest OpenAPI v2.0 features support (yes, it supports even `discriminator`) <br>
27
- ![](docs/images/discriminator-demo.gif)
28
- - OpenAPI 3.0 support
80
+ - Responsive three-panel design with menu/scrolling synchronization
81
+ - [Multiple deployment options](https://redocly.com/docs/redoc/quickstart/intro/)
82
+ - [Server-side rendering (SSR) ready](https://redocly.com/docs/redoc/quickstart/cli/#redoc-cli-commands)
83
+ - Ability to integrate your API introduction into the side menu
84
+ - [Simple integration with `create-react-app`](https://redocly.com/docs/redoc/quickstart/react/)
85
+
86
+ [Example repo](https://github.com/APIs-guru/create-react-app-redoc)
87
+ - [Command-line interface to bundle your docs into a **zero-dependency** HTML file](https://redocly.com/docs/cli/commands/build-docs/)
29
88
  - Neat **interactive** documentation for nested objects <br>
30
- ![](docs/images/nested-demo.gif)
89
+ ![](docs/images/nested-demo.gif)
90
+
91
+ ## Customization options
92
+ [<img alt="Customization services" src="http://i.imgur.com/c4sUF7M.png" height="60px">](https://redocly.com/#services)
93
+ - High-level grouping in side-menu with the [`x-tagGroups`](https://redocly.com/docs/api-reference-docs/specification-extensions/x-tag-groups/) specification extension
94
+ - Branding/customizations using the [`theme` option](https://redocly.com/docs/api-reference-docs/configuration/theming/)
95
+
96
+ ## Support
97
+ - OpenAPI v3.0 support
98
+ - Basic OpenAPI v3.1 support
99
+ - Broad OpenAPI v2.0 feature support (yes, it supports even `discriminator`) <br>
100
+ ![](docs/images/discriminator-demo.gif)
31
101
  - Code samples support (via vendor extension) <br>
32
- ![](docs/images/code-samples-demo.gif)
33
- - Responsive three-panel design with menu/scrolling synchronization
34
- - Integrate API Introduction into side menu - ReDoc takes advantage of markdown headings from OpenAPI description field. It pulls them into side menu and also supports deep linking.
35
- - High-level grouping in side-menu via [`x-tagGroups`](docs/redoc-vendor-extensions.md#x-tagGroups) vendor extension
36
- - Simple integration with `create-react-app` ([sample](https://github.com/APIs-guru/create-react-app-redoc))
37
- - Branding/customizations via [`theme` option](#redoc-options-object)
38
-
39
- ## Roadmap
40
- - [x] ~~[OpenAPI v3.0 support](https://github.com/Redocly/redoc/issues/312)~~
41
- - [x] ~~performance optimizations~~
42
- - [x] ~~better navigation (menu improvements + search)~~
43
- - [x] ~~React rewrite~~
44
- - [x] ~~docs pre-rendering (performance and SEO)~~
45
- - [ ] ability to simple branding/styling
46
- - [ ] built-in API Console
102
+ ![](docs/images/code-samples-demo.gif)
47
103
 
48
104
  ## Releases
49
- **Important:** all the 2.x releases are deployed to npm and can be used via jsdeliver:
50
- - particular release, e.g. `v2.0.0-alpha.15`: https://cdn.jsdelivr.net/npm/redoc@2.0.0-alpha.17/bundles/redoc.standalone.js
51
- - `next` release: https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js
105
+ **Important:** all the 2.x releases are deployed to npm and can be used with Redocly-cdn:
106
+ - particular release, for example, `v2.0.0`: https://cdn.redoc.ly/redoc/v2.0.0/bundles/redoc.standalone.js
107
+ - `latest` release: https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js
52
108
 
53
109
  Additionally, all the 1.x releases are hosted on our GitHub Pages-based CDN **(deprecated)**:
54
- - particular release, e.g. `v1.2.0`: https://rebilly.github.io/ReDoc/releases/v1.2.0/redoc.min.js
110
+ - particular release, for example `v1.2.0`: https://rebilly.github.io/ReDoc/releases/v1.2.0/redoc.min.js
55
111
  - `v1.x.x` release: https://rebilly.github.io/ReDoc/releases/v1.x.x/redoc.min.js
56
- - `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js - it will point to latest 1.x.x release since 2.x releases are not hosted on this CDN but on unpkg.
112
+ - `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js - points to latest 1.x.x release since 2.x releases are not hosted on this CDN but on unpkg.
57
113
 
58
114
  ## Version Guidance
59
- | ReDoc Release | OpenAPI Specification |
115
+ | Redoc Release | OpenAPI Specification |
60
116
  |:--------------|:----------------------|
117
+ | 2.0.0-alpha.54| 3.1, 3.0.x, 2.0 |
61
118
  | 2.0.0-alpha.x | 3.0, 2.0 |
62
119
  | 1.19.x | 2.0 |
63
120
  | 1.18.x | 2.0 |
64
121
  | 1.17.x | 2.0 |
65
122
 
66
- ## Some Real-life usages
67
- - [Rebilly](https://rebilly.github.io/RebillyAPI)
123
+ ## Showcase
124
+ - [Rebilly](https://api-reference.rebilly.com/)
68
125
  - [Docker Engine](https://docs.docker.com/engine/api/v1.25/)
69
126
  - [Zuora](https://www.zuora.com/developer/api-reference/)
70
- - [Shopify Draft Orders](https://help.shopify.com/api/draft-orders)
71
127
  - [Discourse](http://docs.discourse.org)
128
+ - [Commbox](https://www.commbox.io/api/)
72
129
  - [APIs.guru](https://apis.guru/api-doc/)
73
- - [FastAPI](https://github.com/tiangolo/fastapi)
130
+ - [BoxKnight](https://www.docs.boxknight.com/)
131
+
132
+ ## Lint OpenAPI definitions
133
+
134
+ Redocly CLI is an [open source command-line tool](https://github.com/Redocly/redocly-cli) that you can use to lint
135
+ your OpenAPI definition. Linting helps you to catch errors and inconsistencies in your
136
+ OpenAPI definition before publishing.
137
+
138
+ Learn more about [API standards and linting](https://redocly.com/docs/cli/api-standards/) in the main Redocly documentation.
74
139
 
75
140
  ## Deployment
76
141
 
77
- ### TL;DR
142
+ ### TL;DR final code example
143
+
144
+ To render your OpenAPI definition using Redoc, use the following HTML code sample and
145
+ replace the `spec-url` attribute with the url or local file address to your definition.
78
146
 
79
147
  ```html
80
148
  <!DOCTYPE html>
81
149
  <html>
82
150
  <head>
83
- <title>ReDoc</title>
151
+ <title>Redoc</title>
84
152
  <!-- needed for adaptive design -->
85
153
  <meta charset="utf-8"/>
86
154
  <meta name="viewport" content="width=device-width, initial-scale=1">
87
155
  <link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
88
156
 
89
157
  <!--
90
- ReDoc doesn't change outer page styles
158
+ Redoc doesn't change outer page styles
91
159
  -->
92
160
  <style>
93
161
  body {
@@ -98,169 +166,158 @@ Additionally, all the 1.x releases are hosted on our GitHub Pages-based CDN **(d
98
166
  </head>
99
167
  <body>
100
168
  <redoc spec-url='http://petstore.swagger.io/v2/swagger.json'></redoc>
101
- <script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
169
+ <script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
102
170
  </body>
103
171
  </html>
104
- ```
105
- That's all folks!
106
-
107
- **IMPORTANT NOTE:** if you work with untrusted user spec, use `untrusted-spec` [option](#redoc-options-object) to prevent XSS security risks.
108
-
109
- ### 1. Install ReDoc (skip this step for CDN)
110
- Install using [yarn](https://yarnpkg.com):
111
-
112
- yarn add redoc
113
-
114
- or using [npm](https://docs.npmjs.com/getting-started/what-is-npm):
115
-
116
- npm install redoc --save
117
-
118
- ### 2. Reference redoc script in HTML
119
- For **CDN**:
120
- ```html
121
- <script src="https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js"> </script>
122
- ```
123
-
124
- For npm:
125
- ```html
126
- <script src="node_modules/redoc/bundles/redoc.standalone.js"> </script>
127
- ```
128
-
129
- ### 3. Add `<redoc>` element to your page
130
- ```html
131
- <redoc spec-url="url/to/your/spec"></redoc>
132
- ```
133
-
134
- ### 4. Enjoy :smile:
135
-
136
-
137
- ## Usage as a React component
138
-
139
- Install peer dependencies required by ReDoc if you don't have them installed already:
140
-
141
- npm i react react-dom mobx@^4.2.0 styled-components
142
-
143
- Import `RedocStandalone` component from 'redoc' module:
144
172
 
145
- ```js
146
- import { RedocStandalone } from 'redoc';
147
173
  ```
148
174
 
149
- and use it somewhere in your component:
175
+ For step-by-step instructions for how to get started using Redoc
176
+ to render your OpenAPI definition, refer to the
177
+ [**Redoc quickstart guide**](https://redocly.com/docs/redoc/quickstart/) and [**How to use the HTML element**](https://redocly.com/docs/redoc/deployment/html/).
150
178
 
151
- ```js
152
- <RedocStandalone specUrl="url/to/your/spec"/>
153
- ```
154
-
155
- or
156
-
157
- ```js
158
- <RedocStandalone spec={/* spec as an object */}/>
159
- ```
160
-
161
- Also you can pass options:
162
-
163
- ```js
164
- <RedocStandalone
165
- specUrl="http://rebilly.github.io/RebillyAPI/openapi.json"
166
- options={{
167
- nativeScrollbars: true,
168
- theme: { colors: { primary: { main: '#dd5522' } } },
169
- }}
170
- />
171
- ```
172
-
173
- Here are detailed [options docs](#redoc-options-object).
174
-
175
- You can also specify `onLoaded` callback which will be called each time Redoc has been fully rendered or when error occurs (with an error as the first argument). *NOTE*: It may be called multiply times if you change component properties
176
-
177
- ```js
178
- <RedocStandalone
179
- specUrl="http://rebilly.github.io/RebillyAPI/openapi.json"
180
- onLoaded={error => {
181
- if (!error) {
182
- console.log('Yay!');
183
- }
184
- }}
185
- />
186
- ```
187
-
188
- [**IE11 Support Notes**](docs/usage-with-ie11.md)
189
-
190
- ## The Docker way
191
-
192
- ReDoc is available as pre-built Docker image in official [Docker Hub repository](https://hub.docker.com/r/redocly/redoc/). You may simply pull & run it:
193
-
194
- docker pull redocly/redoc
195
- docker run -p 8080:80 redocly/redoc
196
-
197
- Also you may rewrite some predefined environment variables defined in [Dockerfile](./config/docker/Dockerfile). By default ReDoc starts with demo Petstore spec located at `http://petstore.swagger.io/v2/swagger.json`, but you may change this URL using environment variable `SPEC_URL`:
198
-
199
- docker run -p 8080:80 -e SPEC_URL=https://api.example.com/openapi.json redocly/redoc
200
-
201
- ## ReDoc CLI
202
-
203
- [See here](https://github.com/Redocly/redoc/blob/master/cli/README.md)
204
179
 
205
180
  ## Configuration
206
181
 
207
182
  ### Security Definition location
208
- You can inject Security Definitions widget into any place of your specification `description`. Check out details [here](docs/security-definitions-injection.md).
183
+ You can inject the Security Definitions widget into any place in your definition `description`.
184
+ For more information, refer to [Security definitions injection](docs/security-definitions-injection.md).
209
185
 
210
- ### Swagger vendor extensions
211
- ReDoc makes use of the following [vendor extensions](https://swagger.io/specification/#specificationExtensions):
186
+ ### OpenAPI specification extensions
187
+ Redoc uses the following [specification extensions](https://redocly.com/docs/api-reference-docs/spec-extensions/):
212
188
  * [`x-logo`](docs/redoc-vendor-extensions.md#x-logo) - is used to specify API logo
213
189
  * [`x-traitTag`](docs/redoc-vendor-extensions.md#x-traitTag) - useful for handling out common things like Pagination, Rate-Limits, etc
214
- * [`x-code-samples`](docs/redoc-vendor-extensions.md#x-code-samples) - specify operation code samples
190
+ * [`x-codeSamples`](docs/redoc-vendor-extensions.md#x-codeSamples) - specify operation code samples
215
191
  * [`x-examples`](docs/redoc-vendor-extensions.md#x-examples) - specify JSON example for requests
216
- * [`x-nullable`](docs/redoc-vendor-extensions.md#nullable) - mark schema param as a nullable
192
+ * [`x-nullable`](docs/redoc-vendor-extensions.md#x-nullable) - mark schema param as a nullable
217
193
  * [`x-displayName`](docs/redoc-vendor-extensions.md#x-displayname) - specify human-friendly names for the menu categories
218
194
  * [`x-tagGroups`](docs/redoc-vendor-extensions.md#x-tagGroups) - group tags by categories in the side menu
219
195
  * [`x-servers`](docs/redoc-vendor-extensions.md#x-servers) - ability to specify different servers for API (backported from OpenAPI 3.0)
220
196
  * [`x-ignoredHeaderParameters`](docs/redoc-vendor-extensions.md#x-ignoredHeaderParameters) - ability to specify header parameter names to ignore
221
197
  * [`x-additionalPropertiesName`](docs/redoc-vendor-extensions.md#x-additionalPropertiesName) - ability to supply a descriptive name for the additional property keys
198
+ * [`x-summary`](docs/redoc-vendor-extensions.md#x-summary) - For Response object, use as the response button text, with description rendered under the button
199
+ * [`x-extendedDiscriminator`](docs/redoc-vendor-extensions.md#x-extendedDiscriminator) - In Schemas, uses this to solve name-clash issues with the standard discriminator
200
+ * [`x-explicitMappingOnly`](docs/redoc-vendor-extensions.md#x-explicitMappingOnly) - In Schemas, display a more descriptive property name in objects with additionalProperties when viewing the property list with an object
222
201
 
223
202
  ### `<redoc>` options object
224
- You can use all of the following options with standalone version on <redoc> tag by kebab-casing them, e.g. `scrollYOffset` becomes `scroll-y-offset` and `expandResponses` becomes `expand-responses`.
203
+ You can use all of the following options with the standalone version of the <redoc> tag by kebab-casing them. For example, `scrollYOffset` becomes `scroll-y-offset`, and `expandResponses` becomes `expand-responses`.
225
204
 
226
- * `untrustedSpec` - if set, the spec is considered untrusted and all HTML/markdown is sanitized to prevent XSS. **Disabled by default** for performance reasons. **Enable this option if you work with untrusted user data!**
227
- * `scrollYOffset` - If set, specifies a vertical scroll-offset. This is often useful when there are fixed positioned elements at the top of the page, such as navbars, headers etc;
228
- `scrollYOffset` can be specified in various ways:
229
- * **number**: A fixed number of pixels to be used as offset;
230
- * **selector**: selector of the element to be used for specifying the offset. The distance from the top of the page to the element's bottom will be used as offset;
231
- * **function**: A getter function. Must return a number representing the offset (in pixels);
232
- * `suppressWarnings` - if set, warnings are not rendered at the top of documentation (they still are logged to the console).
233
- * `lazyRendering` - _Not implemented yet_ ~~if set, enables lazy rendering mode in ReDoc. This mode is useful for APIs with big number of operations (e.g. > 50). In this mode ReDoc shows initial screen ASAP and then renders the rest operations asynchronously while showing progress bar on the top. Check out the [demo](\\redocly.github.io/redoc) for the example.~~
234
- * `hideHostname` - if set, the protocol and hostname is not shown in the operation definition.
205
+ * `disableSearch` - disable search indexing and search box.
206
+ * `minCharacterLengthToInitSearch` - set minimal characters length to init search, default `3`, minimal `1`.
207
+ * `expandDefaultServerVariables` - enable expanding default server variables, default `false`.
235
208
  * `expandResponses` - specify which responses to expand by default by response codes. Values should be passed as comma-separated list without spaces e.g. `expandResponses="200,201"`. Special value `"all"` expands all responses by default. Be careful: this option can slow-down documentation rendering time.
236
- * `requiredPropsFirst` - show required properties first ordered in the same order as in `required` array.
237
- * `sortPropsAlphabetically` - sort properties alphabetically
238
- * `showExtensions` - show vendor extensions ("x-" fields). Extensions used by ReDoc are ignored. Can be boolean or an array of `string` with names of extensions to display
239
- * `noAutoAuth` - do not inject Authentication section automatically
240
- * `pathInMiddlePanel` - show path link and HTTP verb in the middle panel instead of the right one
241
- * `hideLoading` - do not show loading animation. Useful for small docs
242
- * `nativeScrollbars` - use native scrollbar for sidemenu instead of perfect-scroll (scrolling performance optimization for big specs)
209
+ * `generatedPayloadSamplesMaxDepth` - set the maximum render depth for JSON payload samples (responses and request body). The default value is `10`.
210
+ * `maxDisplayedEnumValues` - display only specified number of enum values. hide rest values under spoiler.
243
211
  * `hideDownloadButton` - do not show "Download" spec button. **THIS DOESN'T MAKE YOUR SPEC PRIVATE**, it just hides the button.
244
- * `disableSearch` - disable search indexing and search box
212
+ * `downloadFileName` - set a custom file name for the downloaded API definition file.
213
+ * `downloadDefinitionUrl` - If the 'Download' button is visible in the API reference documentation (hideDownloadButton=false), the URL configured here opens when that button is selected. Provide it as an absolute URL with the full URI scheme.
214
+ * `hideHostname` - if set, the protocol and hostname is not shown in the operation definition.
215
+ * `hideLoading` - do not show loading animation. Useful for small docs.
216
+ * `hideFab` - do not show FAB in mobile view. Useful for implementing a custom floating action button.
217
+ * `hideSchemaPattern` - if set, the pattern is not shown in the schema.
218
+ * `hideSingleRequestSampleTab` - do not show the request sample tab for requests with only one sample.
219
+ * `showObjectSchemaExamples` - show object schema example in the properties, default `false`.
220
+ * `expandSingleSchemaField` - automatically expand single field in a schema
221
+ * `schemaExpansionLevel` - specifies whether to automatically expand schemas. Special value `"all"` expands all levels. The default value is `0`.
222
+ * `jsonSampleExpandLevel` - set the default expand level for JSON payload samples (responses and request body). Special value `"all"` expands all levels. The default value is `2`.
223
+ * `hideSchemaTitles` - do not display schema `title` next to to the type
224
+ * `simpleOneOfTypeLabel` - show only unique oneOf types in the label without titles
225
+ * `sortEnumValuesAlphabetically` - set to true, sorts all enum values in all schemas alphabetically
226
+ * `sortOperationsAlphabetically` - set to true, sorts operations in the navigation sidebar and in the middle panel alphabetically
227
+ * `sortTagsAlphabetically` - set to true, sorts tags in the navigation sidebar and in the middle panel alphabetically
228
+ * `menuToggle` - if true, clicking second time on expanded menu item collapses it, default `true`.
229
+ * `nativeScrollbars` - use native scrollbar for sidemenu instead of perfect-scroll (scrolling performance optimization for big specs).
245
230
  * `onlyRequiredInSamples` - shows only required fields in request samples.
246
- * `theme` - ReDoc theme. Not documented yet. For details check source code: [theme.ts](https://github.com/Redocly/redoc/blob/master/src/theme.ts)
247
-
248
- ## Advanced usage of standalone version
249
- Instead of adding `spec-url` attribute to the `<redoc>` element you can initialize ReDoc via globally exposed `Redoc` object:
250
- ```js
251
- Redoc.init(specOrSpecUrl, options, element, callback?)
252
- ```
253
-
254
- - `specOrSpecUrl` is either JSON object with specification or an URL to the spec in `JSON` or `YAML` format
255
- - `options` [options object](#redoc-options-object)
256
- - `element` DOM element to put ReDoc into
257
- - `callback` (optional) - callback to be called after Redoc has been fully rendered. It is also called also on errors with error as the first argument
258
-
259
- ```js
260
- Redoc.init('http://petstore.swagger.io/v2/swagger.json', {
261
- scrollYOffset: 50
262
- }, document.getElementById('redoc-container'))
263
- ```
231
+ * `pathInMiddlePanel` - show path link and HTTP verb in the middle panel instead of the right one.
232
+ * `requiredPropsFirst` - show required properties first ordered in the same order as in `required` array.
233
+ * `scrollYOffset` - If set, specifies a vertical scroll-offset. This is often useful when there are fixed positioned elements at the top of the page, such as navbars, headers etc;
234
+ `scrollYOffset` can be specified in various ways:
235
+ * **number**: A fixed number of pixels to be used as offset.
236
+ * **selector**: selector of the element to be used for specifying the offset. The distance from the top of the page to the element's bottom is used as offset.
237
+ * **function**: A getter function. Must return a number representing the offset (in pixels).
238
+ * `showExtensions` - show vendor extensions ("x-" fields). Extensions used by Redoc are ignored. Can be boolean or an array of `string` with names of extensions to display.
239
+ * `sortPropsAlphabetically` - sort properties alphabetically.
240
+ * `payloadSampleIdx` - if set, payload sample is inserted at this index or last. Indexes start from 0.
241
+ * `theme` - Redoc theme. For details check [theme docs](#redoc-theme-object).
242
+ * `untrustedSpec` - if set, the spec is considered untrusted and all HTML/markdown is sanitized to prevent XSS. **Disabled by default** for performance reasons. **Enable this option if you work with untrusted user data!**
243
+ * `nonce` - if set, the provided value is injected in every injected HTML element in the `nonce` attribute. Useful when using CSP, see https://webpack.js.org/guides/csp/.
244
+ * `sideNavStyle` - can be specified in various ways:
245
+ * **summary-only**: displays a summary in the sidebar navigation item. (**default**)
246
+ * **path-only**: displays a path in the sidebar navigation item.
247
+ * **id-only**: displays the operation id with a fallback to the path in the sidebar navigation item.
248
+ * `showWebhookVerb` - when set to `true`, shows the HTTP request method for webhooks in operations and in the sidebar.
249
+
250
+ ### `<redoc>` theme object
251
+ * `spacing`
252
+ * `unit`: 5 # main spacing unit used in autocomputed theme values later
253
+ * `sectionHorizontal`: 40 # Horizontal section padding. COMPUTED: spacing.unit * 8
254
+ * `sectionVertical`: 40 # Horizontal section padding. COMPUTED: spacing.unit * 8
255
+ * `breakpoints` # breakpoints for switching three/two and mobile view layouts
256
+ * `small`: '50rem'
257
+ * `medium`: '85rem'
258
+ * `large`: '105rem'
259
+ * `colors`
260
+ * `tonalOffset`: 0.3 # default tonal offset used in computations
261
+ * `typography`
262
+ * `fontSize`: '14px'
263
+ * `lineHeight`: '1.5em'
264
+ * `fontWeightRegular`: '400'
265
+ * `fontWeightBold`: '600'
266
+ * `fontWeightLight`: '300'
267
+ * `fontFamily`: 'Roboto, sans-serif'
268
+ * `smoothing`: 'antialiased'
269
+ * `optimizeSpeed`: true
270
+ * `headings`
271
+ * `fontFamily`: 'Montserrat, sans-serif'
272
+ * `fontWeight`: '400'
273
+ * `lineHeight`: '1.6em'
274
+ * `code` # inline code styling
275
+ * `fontSize`: '13px'
276
+ * `fontFamily`: 'Courier, monospace'
277
+ * `lineHeight`: # COMPUTED: typography.lineHeight
278
+ * `fontWeight`: # COMPUTED: typography.fontWeightRegular
279
+ * `color`: '#e53935'
280
+ * `backgroundColor`: 'rgba(38, 50, 56, 0.05)'
281
+ * `wrap`: false # whether to break word for inline blocks (otherwise they can overflow)
282
+ * `links`
283
+ * `color`: # COMPUTED: colors.primary.main
284
+ * `visited`: # COMPUTED: typography.links.color
285
+ * `hover`: # COMPUTED: lighten(0.2 typography.links.color)
286
+ * `textDecoration`: 'auto'
287
+ * `hoverTextDecoration`: 'auto'
288
+ * `sidebar`
289
+ * `width`: '260px'
290
+ * `backgroundColor`: '#fafafa'
291
+ * `textColor`: '#333333'
292
+ * `activeTextColor`: # COMPUTED: theme.sidebar.textColor (if set by user) or theme.colors.primary.main
293
+ * `groupItems` # Group headings
294
+ * `activeBackgroundColor`: # COMPUTED: theme.sidebar.backgroundColor
295
+ * `activeTextColor`: # COMPUTED: theme.sidebar.activeTextColor
296
+ * `textTransform`: 'uppercase'
297
+ * `level1Items` # Level 1 items like tags or section 1st level items
298
+ * `activeBackgroundColor`: # COMPUTED: theme.sidebar.backgroundColor
299
+ * `activeTextColor`: # COMPUTED: theme.sidebar.activeTextColor
300
+ * `textTransform`: 'none'
301
+ * `arrow` # sidebar arrow
302
+ * `size`: '1.5em'
303
+ * `color`: # COMPUTED: theme.sidebar.textColor
304
+ * `logo`
305
+ * `maxHeight`: # COMPUTED: sidebar.width
306
+ * `maxWidth`: # COMPUTED: sidebar.width
307
+ * `gutter`: '2px' # logo image padding
308
+ * `rightPanel`
309
+ * `backgroundColor`: '#263238'
310
+ * `width`: '40%'
311
+ * `textColor`: '#ffffff'
312
+ * `servers`
313
+ * `overlay`
314
+ * `backgroundColor`: '#fafafa'
315
+ * `textColor`: '#263238'
316
+ * `url`
317
+ * `backgroundColor`: '#fff'
318
+ * `fab`
319
+ * `backgroundColor`: '#263238'
320
+ * `color`: '#ffffff'
264
321
 
265
322
  -----------
266
323
  ## Development
@@ -0,0 +1,68 @@
1
+ /*!
2
+ * ReDoc - OpenAPI/Swagger-generated API Reference Documentation
3
+ * -------------------------------------------------------------
4
+ * Version: "2.1.0"
5
+ * Repo: https://github.com/Redocly/redoc
6
+ */
7
+
8
+ /*!
9
+ * lunr.Builder
10
+ * Copyright (C) 2020 Oliver Nightingale
11
+ */
12
+
13
+ /*!
14
+ * lunr.Index
15
+ * Copyright (C) 2020 Oliver Nightingale
16
+ */
17
+
18
+ /*!
19
+ * lunr.Pipeline
20
+ * Copyright (C) 2020 Oliver Nightingale
21
+ */
22
+
23
+ /*!
24
+ * lunr.Set
25
+ * Copyright (C) 2020 Oliver Nightingale
26
+ */
27
+
28
+ /*!
29
+ * lunr.TokenSet
30
+ * Copyright (C) 2020 Oliver Nightingale
31
+ */
32
+
33
+ /*!
34
+ * lunr.Vector
35
+ * Copyright (C) 2020 Oliver Nightingale
36
+ */
37
+
38
+ /*!
39
+ * lunr.stemmer
40
+ * Copyright (C) 2020 Oliver Nightingale
41
+ * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
42
+ */
43
+
44
+ /*!
45
+ * lunr.stopWordFilter
46
+ * Copyright (C) 2020 Oliver Nightingale
47
+ */
48
+
49
+ /*!
50
+ * lunr.tokenizer
51
+ * Copyright (C) 2020 Oliver Nightingale
52
+ */
53
+
54
+ /*!
55
+ * lunr.trimmer
56
+ * Copyright (C) 2020 Oliver Nightingale
57
+ */
58
+
59
+ /*!
60
+ * lunr.utils
61
+ * Copyright (C) 2020 Oliver Nightingale
62
+ */
63
+
64
+ /**
65
+ * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9
66
+ * Copyright (C) 2020 Oliver Nightingale
67
+ * @license MIT
68
+ */