docusaurus-theme-openapi-docs 0.0.0-1000

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 (312) hide show
  1. package/LICENSE +21 -0
  2. package/babel.config.js +35 -0
  3. package/lib/index.d.ts +2 -0
  4. package/lib/index.js +81 -0
  5. package/lib/markdown/createDescription.d.ts +1 -0
  6. package/lib/markdown/createDescription.js +15 -0
  7. package/lib/markdown/schema.d.ts +3 -0
  8. package/lib/markdown/schema.js +149 -0
  9. package/lib/markdown/utils.d.ts +10 -0
  10. package/lib/markdown/utils.js +49 -0
  11. package/lib/markdown/utils.test.d.ts +1 -0
  12. package/lib/markdown/utils.test.js +43 -0
  13. package/lib/theme/ApiExplorer/Accept/index.d.ts +3 -0
  14. package/lib/theme/ApiExplorer/Accept/index.js +38 -0
  15. package/lib/theme/ApiExplorer/Accept/slice.d.ts +11 -0
  16. package/lib/theme/ApiExplorer/Accept/slice.js +22 -0
  17. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
  18. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
  19. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +35 -0
  20. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +3 -0
  21. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +41 -0
  22. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +3 -0
  23. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +153 -0
  24. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
  25. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
  26. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +3 -0
  27. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +147 -0
  28. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
  29. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
  30. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +58 -0
  31. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
  32. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
  33. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +248 -0
  34. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
  35. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
  36. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +59 -0
  37. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
  38. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
  39. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +51 -0
  40. package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
  41. package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +110 -0
  42. package/lib/theme/ApiExplorer/Authorization/auth-types.d.ts +3 -0
  43. package/lib/theme/ApiExplorer/Authorization/auth-types.js +28 -0
  44. package/lib/theme/ApiExplorer/Authorization/index.d.ts +3 -0
  45. package/lib/theme/ApiExplorer/Authorization/index.js +160 -0
  46. package/lib/theme/ApiExplorer/Authorization/slice.d.ts +40 -0
  47. package/lib/theme/ApiExplorer/Authorization/slice.js +102 -0
  48. package/lib/theme/ApiExplorer/Body/index.d.ts +10 -0
  49. package/lib/theme/ApiExplorer/Body/index.js +381 -0
  50. package/lib/theme/ApiExplorer/Body/json2xml.js +43 -0
  51. package/lib/theme/ApiExplorer/Body/slice.d.ts +82 -0
  52. package/lib/theme/ApiExplorer/Body/slice.js +97 -0
  53. package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +21 -0
  54. package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.js +8 -0
  55. package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +10 -0
  56. package/lib/theme/ApiExplorer/CodeSnippets/index.js +389 -0
  57. package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +5 -0
  58. package/lib/theme/ApiExplorer/CodeSnippets/languages.js +95 -0
  59. package/lib/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
  60. package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +501 -0
  61. package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
  62. package/lib/theme/ApiExplorer/CodeTabs/index.js +271 -0
  63. package/lib/theme/ApiExplorer/ContentType/index.d.ts +3 -0
  64. package/lib/theme/ApiExplorer/ContentType/index.js +40 -0
  65. package/lib/theme/ApiExplorer/ContentType/slice.d.ts +11 -0
  66. package/lib/theme/ApiExplorer/ContentType/slice.js +22 -0
  67. package/lib/theme/ApiExplorer/Export/index.d.ts +3 -0
  68. package/lib/theme/ApiExplorer/Export/index.js +57 -0
  69. package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
  70. package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +8 -0
  71. package/lib/theme/ApiExplorer/FloatingButton/index.js +28 -0
  72. package/lib/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
  73. package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +7 -0
  74. package/lib/theme/ApiExplorer/FormFileUpload/index.js +173 -0
  75. package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
  76. package/lib/theme/ApiExplorer/FormItem/index.d.ts +10 -0
  77. package/lib/theme/ApiExplorer/FormItem/index.js +44 -0
  78. package/lib/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
  79. package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +9 -0
  80. package/lib/theme/ApiExplorer/FormMultiSelect/index.js +51 -0
  81. package/lib/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
  82. package/lib/theme/ApiExplorer/FormSelect/index.d.ts +8 -0
  83. package/lib/theme/ApiExplorer/FormSelect/index.js +35 -0
  84. package/lib/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
  85. package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +9 -0
  86. package/lib/theme/ApiExplorer/FormTextInput/index.js +73 -0
  87. package/lib/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
  88. package/lib/theme/ApiExplorer/LiveEditor/index.d.ts +6 -0
  89. package/lib/theme/ApiExplorer/LiveEditor/index.js +168 -0
  90. package/lib/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
  91. package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +8 -0
  92. package/lib/theme/ApiExplorer/MethodEndpoint/index.js +86 -0
  93. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +6 -0
  94. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +220 -0
  95. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +6 -0
  96. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +63 -0
  97. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +6 -0
  98. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +89 -0
  99. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +6 -0
  100. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +63 -0
  101. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +6 -0
  102. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +38 -0
  103. package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
  104. package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +7 -0
  105. package/lib/theme/ApiExplorer/ParamOptions/index.js +223 -0
  106. package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +17 -0
  107. package/lib/theme/ApiExplorer/ParamOptions/slice.js +25 -0
  108. package/lib/theme/ApiExplorer/Request/_Request.scss +129 -0
  109. package/lib/theme/ApiExplorer/Request/index.d.ts +6 -0
  110. package/lib/theme/ApiExplorer/Request/index.js +396 -0
  111. package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +4 -0
  112. package/lib/theme/ApiExplorer/Request/makeRequest.js +222 -0
  113. package/lib/theme/ApiExplorer/Response/_Response.scss +121 -0
  114. package/lib/theme/ApiExplorer/Response/index.d.ts +6 -0
  115. package/lib/theme/ApiExplorer/Response/index.js +193 -0
  116. package/lib/theme/ApiExplorer/Response/slice.d.ts +17 -0
  117. package/lib/theme/ApiExplorer/Response/slice.js +51 -0
  118. package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +3 -0
  119. package/lib/theme/ApiExplorer/SecuritySchemes/index.js +380 -0
  120. package/lib/theme/ApiExplorer/Server/_Server.scss +26 -0
  121. package/lib/theme/ApiExplorer/Server/index.d.ts +3 -0
  122. package/lib/theme/ApiExplorer/Server/index.js +199 -0
  123. package/lib/theme/ApiExplorer/Server/slice.d.ts +13 -0
  124. package/lib/theme/ApiExplorer/Server/slice.js +33 -0
  125. package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +20 -0
  126. package/lib/theme/ApiExplorer/buildPostmanRequest.js +465 -0
  127. package/lib/theme/ApiExplorer/index.d.ts +7 -0
  128. package/lib/theme/ApiExplorer/index.js +41 -0
  129. package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +3 -0
  130. package/lib/theme/ApiExplorer/persistanceMiddleware.js +54 -0
  131. package/lib/theme/ApiExplorer/storage-utils.d.ts +4 -0
  132. package/lib/theme/ApiExplorer/storage-utils.js +41 -0
  133. package/lib/theme/ApiItem/Layout/index.d.ts +3 -0
  134. package/lib/theme/ApiItem/Layout/index.js +121 -0
  135. package/lib/theme/ApiItem/Layout/styles.module.css +17 -0
  136. package/lib/theme/ApiItem/hooks.d.ts +12 -0
  137. package/lib/theme/ApiItem/hooks.js +13 -0
  138. package/lib/theme/ApiItem/index.d.ts +2 -0
  139. package/lib/theme/ApiItem/index.js +238 -0
  140. package/lib/theme/ApiItem/store.d.ts +46 -0
  141. package/lib/theme/ApiItem/store.js +53 -0
  142. package/lib/theme/ApiLogo/index.d.ts +2 -0
  143. package/lib/theme/ApiLogo/index.js +51 -0
  144. package/lib/theme/ApiTabs/_ApiTabs.scss +142 -0
  145. package/lib/theme/ApiTabs/index.d.ts +7 -0
  146. package/lib/theme/ApiTabs/index.js +270 -0
  147. package/lib/theme/ArrayBrackets/index.d.ts +3 -0
  148. package/lib/theme/ArrayBrackets/index.js +50 -0
  149. package/lib/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
  150. package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
  151. package/lib/theme/DiscriminatorTabs/index.js +258 -0
  152. package/lib/theme/Markdown/Details/_Details.scss +122 -0
  153. package/lib/theme/Markdown/index.js +179 -0
  154. package/lib/theme/MimeTabs/_MimeTabs.scss +70 -0
  155. package/lib/theme/MimeTabs/index.d.ts +6 -0
  156. package/lib/theme/MimeTabs/index.js +286 -0
  157. package/lib/theme/OperationTabs/_OperationTabs.scss +72 -0
  158. package/lib/theme/OperationTabs/index.d.ts +3 -0
  159. package/lib/theme/OperationTabs/index.js +248 -0
  160. package/lib/theme/ParamsDetails/index.d.ts +6 -0
  161. package/lib/theme/ParamsDetails/index.js +85 -0
  162. package/lib/theme/ParamsItem/_ParamsItem.scss +54 -0
  163. package/lib/theme/ParamsItem/index.d.ts +25 -0
  164. package/lib/theme/ParamsItem/index.js +218 -0
  165. package/lib/theme/RequestSchema/index.d.ts +15 -0
  166. package/lib/theme/RequestSchema/index.js +194 -0
  167. package/lib/theme/ResponseExamples/index.d.ts +18 -0
  168. package/lib/theme/ResponseExamples/index.js +193 -0
  169. package/lib/theme/ResponseHeaders/index.d.ts +13 -0
  170. package/lib/theme/ResponseHeaders/index.js +39 -0
  171. package/lib/theme/ResponseSamples/_ResponseSamples.scss +3 -0
  172. package/lib/theme/ResponseSamples/index.d.ts +8 -0
  173. package/lib/theme/ResponseSamples/index.js +27 -0
  174. package/lib/theme/ResponseSchema/index.d.ts +15 -0
  175. package/lib/theme/ResponseSchema/index.js +159 -0
  176. package/lib/theme/Schema/index.d.ts +8 -0
  177. package/lib/theme/Schema/index.js +885 -0
  178. package/lib/theme/SchemaItem/_SchemaItem.scss +89 -0
  179. package/lib/theme/SchemaItem/index.d.ts +12 -0
  180. package/lib/theme/SchemaItem/index.js +213 -0
  181. package/lib/theme/SchemaTabs/_SchemaTabs.scss +61 -0
  182. package/lib/theme/SchemaTabs/index.d.ts +3 -0
  183. package/lib/theme/SchemaTabs/index.js +255 -0
  184. package/lib/theme/SkeletonLoader/index.d.ts +6 -0
  185. package/lib/theme/SkeletonLoader/index.js +20 -0
  186. package/lib/theme/StatusCodes/index.d.ts +9 -0
  187. package/lib/theme/StatusCodes/index.js +81 -0
  188. package/lib/theme/styles.scss +212 -0
  189. package/lib/types.d.ts +157 -0
  190. package/lib/types.js +8 -0
  191. package/package.json +83 -0
  192. package/src/index.ts +85 -0
  193. package/src/markdown/createDescription.ts +13 -0
  194. package/src/markdown/schema.ts +181 -0
  195. package/src/markdown/utils.test.ts +49 -0
  196. package/src/markdown/utils.ts +59 -0
  197. package/src/plugin-content-docs.d.ts +20 -0
  198. package/src/postman-code-generators.d.ts +9 -0
  199. package/src/react-magic-dropzone.d.ts +9 -0
  200. package/src/theme/ApiExplorer/Accept/index.tsx +36 -0
  201. package/src/theme/ApiExplorer/Accept/slice.ts +29 -0
  202. package/src/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
  203. package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx +32 -0
  204. package/src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx +34 -0
  205. package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +134 -0
  206. package/src/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
  207. package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
  208. package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx +79 -0
  209. package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
  210. package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx +55 -0
  211. package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
  212. package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx +166 -0
  213. package/src/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
  214. package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx +48 -0
  215. package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
  216. package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx +54 -0
  217. package/src/theme/ApiExplorer/ApiCodeBlock/index.tsx +45 -0
  218. package/src/theme/ApiExplorer/Authorization/auth-types.ts +30 -0
  219. package/src/theme/ApiExplorer/Authorization/index.tsx +158 -0
  220. package/src/theme/ApiExplorer/Authorization/slice.ts +146 -0
  221. package/src/theme/ApiExplorer/Body/index.tsx +376 -0
  222. package/src/theme/ApiExplorer/Body/json2xml.js +43 -0
  223. package/src/theme/ApiExplorer/Body/slice.ts +133 -0
  224. package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +57 -0
  225. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +338 -0
  226. package/src/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
  227. package/src/theme/ApiExplorer/CodeSnippets/languages.ts +96 -0
  228. package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +501 -0
  229. package/src/theme/ApiExplorer/CodeTabs/index.tsx +248 -0
  230. package/src/theme/ApiExplorer/ContentType/index.tsx +38 -0
  231. package/src/theme/ApiExplorer/ContentType/slice.ts +29 -0
  232. package/src/theme/ApiExplorer/Export/index.tsx +47 -0
  233. package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
  234. package/src/theme/ApiExplorer/FloatingButton/index.tsx +29 -0
  235. package/src/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
  236. package/src/theme/ApiExplorer/FormFileUpload/index.tsx +119 -0
  237. package/src/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
  238. package/src/theme/ApiExplorer/FormItem/index.tsx +33 -0
  239. package/src/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
  240. package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +57 -0
  241. package/src/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
  242. package/src/theme/ApiExplorer/FormSelect/index.tsx +38 -0
  243. package/src/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
  244. package/src/theme/ApiExplorer/FormTextInput/index.tsx +80 -0
  245. package/src/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
  246. package/src/theme/ApiExplorer/LiveEditor/index.tsx +114 -0
  247. package/src/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
  248. package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +91 -0
  249. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +175 -0
  250. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +64 -0
  251. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +86 -0
  252. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +65 -0
  253. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +38 -0
  254. package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
  255. package/src/theme/ApiExplorer/ParamOptions/index.tsx +146 -0
  256. package/src/theme/ApiExplorer/ParamOptions/slice.ts +37 -0
  257. package/src/theme/ApiExplorer/Request/_Request.scss +129 -0
  258. package/src/theme/ApiExplorer/Request/index.tsx +309 -0
  259. package/src/theme/ApiExplorer/Request/makeRequest.ts +254 -0
  260. package/src/theme/ApiExplorer/Response/_Response.scss +121 -0
  261. package/src/theme/ApiExplorer/Response/index.tsx +157 -0
  262. package/src/theme/ApiExplorer/Response/slice.ts +52 -0
  263. package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +287 -0
  264. package/src/theme/ApiExplorer/Server/_Server.scss +26 -0
  265. package/src/theme/ApiExplorer/Server/index.tsx +130 -0
  266. package/src/theme/ApiExplorer/Server/slice.ts +39 -0
  267. package/src/theme/ApiExplorer/buildPostmanRequest.ts +526 -0
  268. package/src/theme/ApiExplorer/index.tsx +41 -0
  269. package/src/theme/ApiExplorer/persistanceMiddleware.ts +71 -0
  270. package/src/theme/ApiExplorer/postman-collection.d.ts +10 -0
  271. package/src/theme/ApiExplorer/react-modal.d.ts +8 -0
  272. package/src/theme/ApiExplorer/storage-utils.ts +39 -0
  273. package/src/theme/ApiItem/Layout/index.tsx +85 -0
  274. package/src/theme/ApiItem/Layout/styles.module.css +17 -0
  275. package/src/theme/ApiItem/hooks.ts +13 -0
  276. package/src/theme/ApiItem/index.tsx +222 -0
  277. package/src/theme/ApiItem/store.ts +51 -0
  278. package/src/theme/ApiLogo/index.tsx +52 -0
  279. package/src/theme/ApiTabs/_ApiTabs.scss +142 -0
  280. package/src/theme/ApiTabs/index.tsx +238 -0
  281. package/src/theme/ArrayBrackets/index.tsx +37 -0
  282. package/src/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
  283. package/src/theme/DiscriminatorTabs/index.tsx +229 -0
  284. package/src/theme/Markdown/Details/_Details.scss +122 -0
  285. package/src/theme/Markdown/index.js +179 -0
  286. package/src/theme/MimeTabs/_MimeTabs.scss +70 -0
  287. package/src/theme/MimeTabs/index.tsx +257 -0
  288. package/src/theme/OperationTabs/_OperationTabs.scss +72 -0
  289. package/src/theme/OperationTabs/index.tsx +220 -0
  290. package/src/theme/ParamsDetails/index.tsx +81 -0
  291. package/src/theme/ParamsItem/_ParamsItem.scss +54 -0
  292. package/src/theme/ParamsItem/index.tsx +205 -0
  293. package/src/theme/RequestSchema/index.tsx +157 -0
  294. package/src/theme/ResponseExamples/index.tsx +192 -0
  295. package/src/theme/ResponseHeaders/index.tsx +49 -0
  296. package/src/theme/ResponseSamples/_ResponseSamples.scss +3 -0
  297. package/src/theme/ResponseSamples/index.tsx +31 -0
  298. package/src/theme/ResponseSchema/index.tsx +144 -0
  299. package/src/theme/Schema/index.tsx +939 -0
  300. package/src/theme/SchemaItem/_SchemaItem.scss +89 -0
  301. package/src/theme/SchemaItem/index.tsx +198 -0
  302. package/src/theme/SchemaTabs/_SchemaTabs.scss +61 -0
  303. package/src/theme/SchemaTabs/index.tsx +224 -0
  304. package/src/theme/SkeletonLoader/index.tsx +18 -0
  305. package/src/theme/StatusCodes/index.tsx +72 -0
  306. package/src/theme/styles.scss +212 -0
  307. package/src/theme-classic.d.ts +80 -0
  308. package/src/theme-openapi.d.ts +288 -0
  309. package/src/theme-translations.d.ts +9 -0
  310. package/src/types.ts +182 -0
  311. package/tsconfig.json +16 -0
  312. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,376 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import React from "react";
9
+
10
+ import json2xml from "@theme/ApiExplorer/Body/json2xml";
11
+ import FormFileUpload from "@theme/ApiExplorer/FormFileUpload";
12
+ import FormItem from "@theme/ApiExplorer/FormItem";
13
+ import FormSelect from "@theme/ApiExplorer/FormSelect";
14
+ import FormTextInput from "@theme/ApiExplorer/FormTextInput";
15
+ import LiveApp from "@theme/ApiExplorer/LiveEditor";
16
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
17
+ import Markdown from "@theme/Markdown";
18
+ import SchemaTabs from "@theme/SchemaTabs";
19
+ import TabItem from "@theme/TabItem";
20
+ import { RequestBodyObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
21
+ import format from "xml-formatter";
22
+
23
+ import {
24
+ clearFormBodyKey,
25
+ clearRawBody,
26
+ setFileFormBody,
27
+ setFileRawBody,
28
+ setStringFormBody,
29
+ } from "./slice";
30
+
31
+ export interface Props {
32
+ jsonRequestBodyExample: string;
33
+ requestBodyMetadata?: RequestBodyObject;
34
+ methods?: any;
35
+ required?: boolean;
36
+ }
37
+
38
+ function BodyWrap({
39
+ requestBodyMetadata,
40
+ jsonRequestBodyExample,
41
+ methods,
42
+ required,
43
+ }: Props) {
44
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
45
+
46
+ // NOTE: We used to check if body was required, but opted to always show the request body
47
+ // to reduce confusion, see: https://github.com/cloud-annotations/docusaurus-openapi/issues/145
48
+
49
+ // No body
50
+ if (contentType === undefined) {
51
+ return null;
52
+ }
53
+
54
+ return (
55
+ <Body
56
+ requestBodyMetadata={requestBodyMetadata}
57
+ jsonRequestBodyExample={jsonRequestBodyExample}
58
+ required={required}
59
+ />
60
+ );
61
+ }
62
+
63
+ function Body({
64
+ requestBodyMetadata,
65
+ jsonRequestBodyExample,
66
+ methods,
67
+ required,
68
+ }: Props) {
69
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
70
+ const dispatch = useTypedDispatch();
71
+
72
+ // Lot's of possible content-types:
73
+ // - application/json
74
+ // - application/xml
75
+ // - text/plain
76
+ // - text/css
77
+ // - text/html
78
+ // - text/javascript
79
+ // - application/javascript
80
+ // - multipart/form-data
81
+ // - application/x-www-form-urlencoded
82
+ // - image/svg+xml;charset=US-ASCII
83
+
84
+ // Show editor:
85
+ // - application/json
86
+ // - application/xml
87
+ // - */*
88
+
89
+ // Show form:
90
+ // - multipart/form-data
91
+ // - application/x-www-form-urlencoded
92
+
93
+ const schema = requestBodyMetadata?.content?.[contentType]?.schema;
94
+ const example = requestBodyMetadata?.content?.[contentType]?.example;
95
+ const examples = requestBodyMetadata?.content?.[contentType]?.examples;
96
+
97
+ if (schema?.format === "binary") {
98
+ return (
99
+ <FormItem>
100
+ <FormFileUpload
101
+ placeholder={schema.description || "Body"}
102
+ onChange={(file: any) => {
103
+ if (file === undefined) {
104
+ dispatch(clearRawBody());
105
+ return;
106
+ }
107
+ dispatch(
108
+ setFileRawBody({
109
+ src: `/path/to/${file.name}`,
110
+ content: file,
111
+ })
112
+ );
113
+ }}
114
+ />
115
+ </FormItem>
116
+ );
117
+ }
118
+ if (
119
+ (contentType === "multipart/form-data" ||
120
+ contentType === "application/x-www-form-urlencoded") &&
121
+ schema?.type === "object"
122
+ ) {
123
+ return (
124
+ <FormItem className="openapi-explorer__form-item-body-container">
125
+ <div>
126
+ {Object.entries(schema.properties ?? {}).map(([key, val]: any) => {
127
+ if (val.format === "binary") {
128
+ return (
129
+ <FormItem
130
+ key={key}
131
+ label={key}
132
+ required={
133
+ Array.isArray(schema.required) &&
134
+ schema.required.includes(key)
135
+ }
136
+ >
137
+ <FormFileUpload
138
+ placeholder={val.description || key}
139
+ onChange={(file: any) => {
140
+ if (file === undefined) {
141
+ dispatch(clearFormBodyKey(key));
142
+ return;
143
+ }
144
+ dispatch(
145
+ setFileFormBody({
146
+ key: key,
147
+ value: {
148
+ src: `/path/to/${file.name}`,
149
+ content: file,
150
+ },
151
+ })
152
+ );
153
+ }}
154
+ />
155
+ </FormItem>
156
+ );
157
+ }
158
+
159
+ if (val.enum) {
160
+ return (
161
+ <FormItem
162
+ key={key}
163
+ label={key}
164
+ required={
165
+ Array.isArray(schema.required) &&
166
+ schema.required.includes(key)
167
+ }
168
+ >
169
+ <FormSelect
170
+ options={["---", ...val.enum]}
171
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
172
+ const val = e.target.value;
173
+ if (val === "---") {
174
+ dispatch(clearFormBodyKey(key));
175
+ } else {
176
+ dispatch(
177
+ setStringFormBody({
178
+ key: key,
179
+ value: val,
180
+ })
181
+ );
182
+ }
183
+ }}
184
+ />
185
+ </FormItem>
186
+ );
187
+ }
188
+ // TODO: support all the other types.
189
+ return (
190
+ <FormItem
191
+ key={key}
192
+ label={key}
193
+ required={
194
+ Array.isArray(schema.required) &&
195
+ schema.required.includes(key)
196
+ }
197
+ >
198
+ <FormTextInput
199
+ paramName={key}
200
+ isRequired={
201
+ Array.isArray(schema.required) &&
202
+ schema.required.includes(key)
203
+ }
204
+ placeholder={val.description || key}
205
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
206
+ dispatch(
207
+ setStringFormBody({ key: key, value: e.target.value })
208
+ );
209
+ }}
210
+ />
211
+ </FormItem>
212
+ );
213
+ })}
214
+ </div>
215
+ </FormItem>
216
+ );
217
+ }
218
+
219
+ let language = "plaintext";
220
+ let defaultBody = ""; //"body content";
221
+ let exampleBody;
222
+ let examplesBodies = [] as any;
223
+
224
+ if (
225
+ contentType.includes("application/json") ||
226
+ contentType.endsWith("+json")
227
+ ) {
228
+ if (jsonRequestBodyExample) {
229
+ defaultBody = JSON.stringify(jsonRequestBodyExample, null, 2);
230
+ }
231
+ if (example) {
232
+ exampleBody = JSON.stringify(example, null, 2);
233
+ }
234
+ if (examples) {
235
+ for (const [key, example] of Object.entries(examples)) {
236
+ let body = example.value;
237
+ try {
238
+ // If the value is already valid JSON we shouldn't double encode the value
239
+ JSON.parse(example.value);
240
+ } catch (e) {
241
+ body = JSON.stringify(example.value, null, 2);
242
+ }
243
+
244
+ examplesBodies.push({
245
+ label: key,
246
+ body,
247
+ summary: example.summary,
248
+ });
249
+ }
250
+ }
251
+ language = "json";
252
+ }
253
+
254
+ if (contentType === "application/xml" || contentType.endsWith("+xml")) {
255
+ if (jsonRequestBodyExample) {
256
+ try {
257
+ defaultBody = format(json2xml(jsonRequestBodyExample, ""), {
258
+ indentation: " ",
259
+ lineSeparator: "\n",
260
+ collapseContent: true,
261
+ });
262
+ } catch {
263
+ defaultBody = json2xml(jsonRequestBodyExample);
264
+ }
265
+ }
266
+ if (example) {
267
+ try {
268
+ exampleBody = format(json2xml(example, ""), {
269
+ indentation: " ",
270
+ lineSeparator: "\n",
271
+ collapseContent: true,
272
+ });
273
+ } catch {
274
+ exampleBody = json2xml(example);
275
+ }
276
+ }
277
+ if (examples) {
278
+ for (const [key, example] of Object.entries(examples)) {
279
+ let formattedXmlBody;
280
+ try {
281
+ formattedXmlBody = format(example.value, {
282
+ indentation: " ",
283
+ lineSeparator: "\n",
284
+ collapseContent: true,
285
+ });
286
+ } catch {
287
+ formattedXmlBody = example.value;
288
+ }
289
+ examplesBodies.push({
290
+ label: key,
291
+ body: formattedXmlBody,
292
+ summary: example.summary,
293
+ });
294
+ }
295
+ }
296
+ language = "xml";
297
+ }
298
+
299
+ if (exampleBody) {
300
+ return (
301
+ <FormItem>
302
+ <SchemaTabs className="openapi-tabs__schema" lazy>
303
+ {/* @ts-ignore */}
304
+ <TabItem
305
+ label="Example (from schema)"
306
+ value="Example (from schema)"
307
+ default
308
+ >
309
+ <LiveApp action={dispatch} language={language} required={required}>
310
+ {defaultBody}
311
+ </LiveApp>
312
+ </TabItem>
313
+ {/* @ts-ignore */}
314
+ <TabItem label="Example" value="example">
315
+ {example.summary && <Markdown>{example.summary}</Markdown>}
316
+ {exampleBody && (
317
+ <LiveApp
318
+ action={dispatch}
319
+ language={language}
320
+ required={required}
321
+ >
322
+ {exampleBody}
323
+ </LiveApp>
324
+ )}
325
+ </TabItem>
326
+ </SchemaTabs>
327
+ </FormItem>
328
+ );
329
+ }
330
+
331
+ if (examplesBodies && examplesBodies.length > 0) {
332
+ return (
333
+ <FormItem className="openapi-explorer__form-item-body-container">
334
+ <SchemaTabs className="openapi-tabs__schema" lazy>
335
+ {/* @ts-ignore */}
336
+ <TabItem
337
+ label="Example (from schema)"
338
+ value="Example (from schema)"
339
+ default
340
+ >
341
+ <LiveApp action={dispatch} language={language} required={required}>
342
+ {defaultBody}
343
+ </LiveApp>
344
+ </TabItem>
345
+ {examplesBodies.map((example: any) => {
346
+ return (
347
+ // @ts-ignore
348
+ <TabItem
349
+ label={example.label}
350
+ value={example.label}
351
+ key={example.label}
352
+ >
353
+ {example.summary && <Markdown>{example.summary}</Markdown>}
354
+ {example.body && (
355
+ <LiveApp action={dispatch} language={language}>
356
+ {example.body}
357
+ </LiveApp>
358
+ )}
359
+ </TabItem>
360
+ );
361
+ })}
362
+ </SchemaTabs>
363
+ </FormItem>
364
+ );
365
+ }
366
+
367
+ return (
368
+ <FormItem>
369
+ <LiveApp action={dispatch} language={language} required={required}>
370
+ {defaultBody}
371
+ </LiveApp>
372
+ </FormItem>
373
+ );
374
+ }
375
+
376
+ export default BodyWrap;
@@ -0,0 +1,43 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ export default function json2xml(o, tab) {
9
+ var toXml = function (v, name, ind) {
10
+ var xml = "";
11
+ if (v instanceof Array) {
12
+ for (var i = 0, n = v.length; i < n; i++)
13
+ xml += ind + toXml(v[i], name, ind + "\t") + "\n";
14
+ } else if (typeof v == "object") {
15
+ var hasChild = false;
16
+ xml += ind + "<" + name;
17
+ for (var m in v) {
18
+ if (m.charAt(0) === "@")
19
+ xml += " " + m.substr(1) + '="' + v[m].toString() + '"';
20
+ else hasChild = true;
21
+ }
22
+ xml += hasChild ? ">" : "/>";
23
+ if (hasChild) {
24
+ for (var m2 in v) {
25
+ if (m2 === "#text") xml += v[m2];
26
+ else if (m2 === "#cdata") xml += "<![CDATA[" + v[m2] + "]]>";
27
+ else if (m2.charAt(0) !== "@") xml += toXml(v[m2], m2, ind + "\t");
28
+ }
29
+ xml +=
30
+ (xml.charAt(xml.length - 1) === "\n" ? ind : "") +
31
+ "</" +
32
+ name +
33
+ ">";
34
+ }
35
+ } else {
36
+ xml += ind + "<" + name + ">" + v.toString() + "</" + name + ">";
37
+ }
38
+ return xml;
39
+ },
40
+ xml = "";
41
+ for (var m3 in o) xml += toXml(o[m3], m3, "");
42
+ return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, "");
43
+ }
@@ -0,0 +1,133 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import { createSlice, PayloadAction } from "@reduxjs/toolkit";
9
+
10
+ export interface FileContent {
11
+ type: "file";
12
+ value: {
13
+ src: string;
14
+ content: Blob;
15
+ };
16
+ }
17
+
18
+ export interface StringContent {
19
+ type: "string";
20
+ value?: string;
21
+ }
22
+
23
+ export type Content = FileContent | StringContent | undefined;
24
+
25
+ export interface FormBody {
26
+ type: "form";
27
+ content: {
28
+ [key: string]: Content;
29
+ };
30
+ }
31
+
32
+ export interface RawBody {
33
+ type: "raw";
34
+ content: Content;
35
+ }
36
+
37
+ export interface EmptyBody {
38
+ type: "empty";
39
+ }
40
+
41
+ export type Body = EmptyBody | FormBody | RawBody;
42
+
43
+ export type State = Body;
44
+
45
+ const initialState: State = {} as any;
46
+
47
+ export const slice = createSlice({
48
+ name: "body",
49
+ initialState,
50
+ reducers: {
51
+ clearRawBody: (_state) => {
52
+ return {
53
+ type: "empty",
54
+ };
55
+ },
56
+ setStringRawBody: (_state, action: PayloadAction<string>) => {
57
+ return {
58
+ type: "raw",
59
+ content: {
60
+ type: "string",
61
+ value: action.payload,
62
+ },
63
+ };
64
+ },
65
+ setFileRawBody: (_state, action: PayloadAction<FileContent["value"]>) => {
66
+ return {
67
+ type: "raw",
68
+ content: {
69
+ type: "file",
70
+ value: action.payload,
71
+ },
72
+ };
73
+ },
74
+ clearFormBodyKey: (state, action: PayloadAction<string>) => {
75
+ if (state?.type === "form") {
76
+ delete state.content[action.payload];
77
+ }
78
+ },
79
+ setStringFormBody: (
80
+ state,
81
+ action: PayloadAction<{ key: string; value: string }>
82
+ ) => {
83
+ if (state?.type !== "form") {
84
+ return {
85
+ type: "form",
86
+ content: {
87
+ [action.payload.key]: {
88
+ type: "string",
89
+ value: action.payload.value,
90
+ },
91
+ },
92
+ };
93
+ }
94
+ state.content[action.payload.key] = {
95
+ type: "string",
96
+ value: action.payload.value,
97
+ };
98
+ return state;
99
+ },
100
+ setFileFormBody: (
101
+ state,
102
+ action: PayloadAction<{ key: string; value: FileContent["value"] }>
103
+ ) => {
104
+ if (state?.type !== "form") {
105
+ return {
106
+ type: "form",
107
+ content: {
108
+ [action.payload.key]: {
109
+ type: "file",
110
+ value: action.payload.value,
111
+ },
112
+ },
113
+ };
114
+ }
115
+ state.content[action.payload.key] = {
116
+ type: "file",
117
+ value: action.payload.value,
118
+ };
119
+ return state;
120
+ },
121
+ },
122
+ });
123
+
124
+ export const {
125
+ clearRawBody,
126
+ setStringRawBody,
127
+ setFileRawBody,
128
+ clearFormBodyKey,
129
+ setStringFormBody,
130
+ setFileFormBody,
131
+ } = slice.actions;
132
+
133
+ export default slice.reducer;
@@ -0,0 +1,57 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ // https://github.com/github-linguist/linguist/blob/master/lib/linguist/popular.yml
9
+ export type CodeSampleLanguage =
10
+ | "C"
11
+ | "C#"
12
+ | "C++"
13
+ | "CoffeeScript"
14
+ | "CSS"
15
+ | "Dart"
16
+ | "DM"
17
+ | "Elixir"
18
+ | "Go"
19
+ | "Groovy"
20
+ | "HTML"
21
+ | "Java"
22
+ | "JavaScript"
23
+ | "Kotlin"
24
+ | "Objective-C"
25
+ | "OCaml"
26
+ | "Perl"
27
+ | "PHP"
28
+ | "PowerShell"
29
+ | "Python"
30
+ | "R"
31
+ | "Ruby"
32
+ | "Rust"
33
+ | "Scala"
34
+ | "Shell"
35
+ | "Swift"
36
+ | "TypeScript";
37
+
38
+ export interface Language {
39
+ highlight: string;
40
+ language: string;
41
+ codeSampleLanguage: CodeSampleLanguage;
42
+ logoClass: string;
43
+ variant: string;
44
+ variants: string[];
45
+ options?: { [key: string]: boolean };
46
+ sample?: string;
47
+ samples?: string[];
48
+ samplesSources?: string[];
49
+ samplesLabels?: string[];
50
+ }
51
+
52
+ // https://redocly.com/docs/api-reference-docs/specification-extensions/x-code-samples
53
+ export interface CodeSample {
54
+ source: string;
55
+ lang: CodeSampleLanguage;
56
+ label?: string;
57
+ }