@camunda8/docusaurus-theme-openapi-docs 4.5.1

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/babel.config.js +35 -0
  2. package/lib/index.d.ts +2 -0
  3. package/lib/index.js +81 -0
  4. package/lib/markdown/createDescription.d.ts +1 -0
  5. package/lib/markdown/createDescription.js +15 -0
  6. package/lib/markdown/schema.d.ts +3 -0
  7. package/lib/markdown/schema.js +154 -0
  8. package/lib/markdown/utils.d.ts +10 -0
  9. package/lib/markdown/utils.js +49 -0
  10. package/lib/markdown/utils.test.d.ts +1 -0
  11. package/lib/markdown/utils.test.js +43 -0
  12. package/lib/theme/ApiExplorer/Accept/index.d.ts +3 -0
  13. package/lib/theme/ApiExplorer/Accept/index.js +38 -0
  14. package/lib/theme/ApiExplorer/Accept/slice.d.ts +11 -0
  15. package/lib/theme/ApiExplorer/Accept/slice.js +22 -0
  16. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
  17. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
  18. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +35 -0
  19. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +3 -0
  20. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +41 -0
  21. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +3 -0
  22. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +153 -0
  23. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
  24. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
  25. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +7 -0
  26. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +147 -0
  27. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
  28. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
  29. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +58 -0
  30. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
  31. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
  32. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +248 -0
  33. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
  34. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
  35. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +59 -0
  36. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
  37. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
  38. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +51 -0
  39. package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
  40. package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +110 -0
  41. package/lib/theme/ApiExplorer/Authorization/auth-types.d.ts +3 -0
  42. package/lib/theme/ApiExplorer/Authorization/auth-types.js +28 -0
  43. package/lib/theme/ApiExplorer/Authorization/index.d.ts +3 -0
  44. package/lib/theme/ApiExplorer/Authorization/index.js +201 -0
  45. package/lib/theme/ApiExplorer/Authorization/slice.d.ts +40 -0
  46. package/lib/theme/ApiExplorer/Authorization/slice.js +102 -0
  47. package/lib/theme/ApiExplorer/Body/index.d.ts +10 -0
  48. package/lib/theme/ApiExplorer/Body/index.js +394 -0
  49. package/lib/theme/ApiExplorer/Body/json2xml.js +43 -0
  50. package/lib/theme/ApiExplorer/Body/slice.d.ts +82 -0
  51. package/lib/theme/ApiExplorer/Body/slice.js +97 -0
  52. package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +21 -0
  53. package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.js +8 -0
  54. package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +11 -0
  55. package/lib/theme/ApiExplorer/CodeSnippets/index.js +435 -0
  56. package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +5 -0
  57. package/lib/theme/ApiExplorer/CodeSnippets/languages.js +133 -0
  58. package/lib/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
  59. package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +505 -0
  60. package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
  61. package/lib/theme/ApiExplorer/CodeTabs/index.js +283 -0
  62. package/lib/theme/ApiExplorer/ContentType/index.d.ts +3 -0
  63. package/lib/theme/ApiExplorer/ContentType/index.js +40 -0
  64. package/lib/theme/ApiExplorer/ContentType/slice.d.ts +11 -0
  65. package/lib/theme/ApiExplorer/ContentType/slice.js +22 -0
  66. package/lib/theme/ApiExplorer/Export/index.d.ts +3 -0
  67. package/lib/theme/ApiExplorer/Export/index.js +57 -0
  68. package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
  69. package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +8 -0
  70. package/lib/theme/ApiExplorer/FloatingButton/index.js +28 -0
  71. package/lib/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
  72. package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +7 -0
  73. package/lib/theme/ApiExplorer/FormFileUpload/index.js +178 -0
  74. package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
  75. package/lib/theme/ApiExplorer/FormItem/index.d.ts +10 -0
  76. package/lib/theme/ApiExplorer/FormItem/index.js +49 -0
  77. package/lib/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
  78. package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +9 -0
  79. package/lib/theme/ApiExplorer/FormMultiSelect/index.js +51 -0
  80. package/lib/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
  81. package/lib/theme/ApiExplorer/FormSelect/index.d.ts +8 -0
  82. package/lib/theme/ApiExplorer/FormSelect/index.js +35 -0
  83. package/lib/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
  84. package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +11 -0
  85. package/lib/theme/ApiExplorer/FormTextInput/index.js +80 -0
  86. package/lib/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
  87. package/lib/theme/ApiExplorer/LiveEditor/index.d.ts +6 -0
  88. package/lib/theme/ApiExplorer/LiveEditor/index.js +176 -0
  89. package/lib/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
  90. package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +8 -0
  91. package/lib/theme/ApiExplorer/MethodEndpoint/index.js +86 -0
  92. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +6 -0
  93. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +230 -0
  94. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +6 -0
  95. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +71 -0
  96. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +6 -0
  97. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +97 -0
  98. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +6 -0
  99. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +72 -0
  100. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +6 -0
  101. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +38 -0
  102. package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
  103. package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +7 -0
  104. package/lib/theme/ApiExplorer/ParamOptions/index.js +233 -0
  105. package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +17 -0
  106. package/lib/theme/ApiExplorer/ParamOptions/slice.js +25 -0
  107. package/lib/theme/ApiExplorer/Request/_Request.scss +129 -0
  108. package/lib/theme/ApiExplorer/Request/index.d.ts +6 -0
  109. package/lib/theme/ApiExplorer/Request/index.js +443 -0
  110. package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +4 -0
  111. package/lib/theme/ApiExplorer/Request/makeRequest.js +223 -0
  112. package/lib/theme/ApiExplorer/Response/_Response.scss +121 -0
  113. package/lib/theme/ApiExplorer/Response/index.d.ts +6 -0
  114. package/lib/theme/ApiExplorer/Response/index.js +207 -0
  115. package/lib/theme/ApiExplorer/Response/slice.d.ts +17 -0
  116. package/lib/theme/ApiExplorer/Response/slice.js +51 -0
  117. package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +3 -0
  118. package/lib/theme/ApiExplorer/SecuritySchemes/index.js +519 -0
  119. package/lib/theme/ApiExplorer/Server/_Server.scss +26 -0
  120. package/lib/theme/ApiExplorer/Server/index.d.ts +3 -0
  121. package/lib/theme/ApiExplorer/Server/index.js +213 -0
  122. package/lib/theme/ApiExplorer/Server/slice.d.ts +13 -0
  123. package/lib/theme/ApiExplorer/Server/slice.js +33 -0
  124. package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +20 -0
  125. package/lib/theme/ApiExplorer/buildPostmanRequest.js +511 -0
  126. package/lib/theme/ApiExplorer/index.d.ts +7 -0
  127. package/lib/theme/ApiExplorer/index.js +107 -0
  128. package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +19 -0
  129. package/lib/theme/ApiExplorer/persistanceMiddleware.js +54 -0
  130. package/lib/theme/ApiExplorer/storage-utils.d.ts +4 -0
  131. package/lib/theme/ApiExplorer/storage-utils.js +41 -0
  132. package/lib/theme/ApiItem/Layout/index.d.ts +3 -0
  133. package/lib/theme/ApiItem/Layout/index.js +121 -0
  134. package/lib/theme/ApiItem/Layout/styles.module.css +17 -0
  135. package/lib/theme/ApiItem/hooks.d.ts +12 -0
  136. package/lib/theme/ApiItem/hooks.js +13 -0
  137. package/lib/theme/ApiItem/index.d.ts +2 -0
  138. package/lib/theme/ApiItem/index.js +238 -0
  139. package/lib/theme/ApiItem/store.d.ts +58 -0
  140. package/lib/theme/ApiItem/store.js +53 -0
  141. package/lib/theme/ApiLogo/index.d.ts +2 -0
  142. package/lib/theme/ApiLogo/index.js +51 -0
  143. package/lib/theme/ApiTabs/_ApiTabs.scss +142 -0
  144. package/lib/theme/ApiTabs/index.d.ts +7 -0
  145. package/lib/theme/ApiTabs/index.js +275 -0
  146. package/lib/theme/ArrayBrackets/index.d.ts +3 -0
  147. package/lib/theme/ArrayBrackets/index.js +50 -0
  148. package/lib/theme/CodeSamples/_CodeSamples.scss +3 -0
  149. package/lib/theme/CodeSamples/index.d.ts +8 -0
  150. package/lib/theme/CodeSamples/index.js +27 -0
  151. package/lib/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
  152. package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
  153. package/lib/theme/DiscriminatorTabs/index.js +258 -0
  154. package/lib/theme/Markdown/Details/_Details.scss +122 -0
  155. package/lib/theme/Markdown/index.js +179 -0
  156. package/lib/theme/MimeTabs/_MimeTabs.scss +70 -0
  157. package/lib/theme/MimeTabs/index.d.ts +6 -0
  158. package/lib/theme/MimeTabs/index.js +286 -0
  159. package/lib/theme/OperationTabs/_OperationTabs.scss +72 -0
  160. package/lib/theme/OperationTabs/index.d.ts +3 -0
  161. package/lib/theme/OperationTabs/index.js +248 -0
  162. package/lib/theme/ParamsDetails/index.d.ts +6 -0
  163. package/lib/theme/ParamsDetails/index.js +93 -0
  164. package/lib/theme/ParamsItem/_ParamsItem.scss +54 -0
  165. package/lib/theme/ParamsItem/index.d.ts +22 -0
  166. package/lib/theme/ParamsItem/index.js +281 -0
  167. package/lib/theme/RequestSchema/index.d.ts +15 -0
  168. package/lib/theme/RequestSchema/index.js +208 -0
  169. package/lib/theme/ResponseExamples/index.d.ts +18 -0
  170. package/lib/theme/ResponseExamples/index.js +213 -0
  171. package/lib/theme/ResponseHeaders/index.d.ts +13 -0
  172. package/lib/theme/ResponseHeaders/index.js +39 -0
  173. package/lib/theme/ResponseSchema/index.d.ts +15 -0
  174. package/lib/theme/ResponseSchema/index.js +165 -0
  175. package/lib/theme/Schema/index.d.ts +8 -0
  176. package/lib/theme/Schema/index.js +853 -0
  177. package/lib/theme/SchemaItem/_SchemaItem.scss +89 -0
  178. package/lib/theme/SchemaItem/index.d.ts +12 -0
  179. package/lib/theme/SchemaItem/index.js +314 -0
  180. package/lib/theme/SchemaTabs/_SchemaTabs.scss +61 -0
  181. package/lib/theme/SchemaTabs/index.d.ts +3 -0
  182. package/lib/theme/SchemaTabs/index.js +255 -0
  183. package/lib/theme/SkeletonLoader/index.d.ts +6 -0
  184. package/lib/theme/SkeletonLoader/index.js +20 -0
  185. package/lib/theme/StatusCodes/index.d.ts +9 -0
  186. package/lib/theme/StatusCodes/index.js +90 -0
  187. package/lib/theme/styles.scss +215 -0
  188. package/lib/theme/translationIds.d.ts +83 -0
  189. package/lib/theme/translationIds.js +106 -0
  190. package/lib/types.d.ts +46 -0
  191. package/lib/types.js +8 -0
  192. package/package.json +85 -0
  193. package/src/index.ts +85 -0
  194. package/src/markdown/createDescription.ts +13 -0
  195. package/src/markdown/schema.ts +186 -0
  196. package/src/markdown/utils.test.ts +49 -0
  197. package/src/markdown/utils.ts +59 -0
  198. package/src/plugin-content-docs.d.ts +20 -0
  199. package/src/postman-code-generators.d.ts +9 -0
  200. package/src/react-magic-dropzone.d.ts +9 -0
  201. package/src/theme/ApiExplorer/Accept/index.tsx +36 -0
  202. package/src/theme/ApiExplorer/Accept/slice.ts +29 -0
  203. package/src/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
  204. package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx +32 -0
  205. package/src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx +34 -0
  206. package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +134 -0
  207. package/src/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
  208. package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
  209. package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx +83 -0
  210. package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
  211. package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx +55 -0
  212. package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
  213. package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx +166 -0
  214. package/src/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
  215. package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx +48 -0
  216. package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
  217. package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx +54 -0
  218. package/src/theme/ApiExplorer/ApiCodeBlock/index.tsx +45 -0
  219. package/src/theme/ApiExplorer/Authorization/auth-types.ts +30 -0
  220. package/src/theme/ApiExplorer/Authorization/index.tsx +199 -0
  221. package/src/theme/ApiExplorer/Authorization/slice.ts +146 -0
  222. package/src/theme/ApiExplorer/Body/index.tsx +388 -0
  223. package/src/theme/ApiExplorer/Body/json2xml.d.ts +8 -0
  224. package/src/theme/ApiExplorer/Body/json2xml.js +43 -0
  225. package/src/theme/ApiExplorer/Body/slice.ts +133 -0
  226. package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +57 -0
  227. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +383 -0
  228. package/src/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
  229. package/src/theme/ApiExplorer/CodeSnippets/languages.ts +139 -0
  230. package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +505 -0
  231. package/src/theme/ApiExplorer/CodeTabs/index.tsx +261 -0
  232. package/src/theme/ApiExplorer/ContentType/index.tsx +38 -0
  233. package/src/theme/ApiExplorer/ContentType/slice.ts +29 -0
  234. package/src/theme/ApiExplorer/Export/index.tsx +47 -0
  235. package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
  236. package/src/theme/ApiExplorer/FloatingButton/index.tsx +29 -0
  237. package/src/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
  238. package/src/theme/ApiExplorer/FormFileUpload/index.tsx +124 -0
  239. package/src/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
  240. package/src/theme/ApiExplorer/FormItem/index.tsx +40 -0
  241. package/src/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
  242. package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +57 -0
  243. package/src/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
  244. package/src/theme/ApiExplorer/FormSelect/index.tsx +38 -0
  245. package/src/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
  246. package/src/theme/ApiExplorer/FormTextInput/index.tsx +89 -0
  247. package/src/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
  248. package/src/theme/ApiExplorer/LiveEditor/index.tsx +122 -0
  249. package/src/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
  250. package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +91 -0
  251. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +185 -0
  252. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +72 -0
  253. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +94 -0
  254. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +74 -0
  255. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +38 -0
  256. package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
  257. package/src/theme/ApiExplorer/ParamOptions/index.tsx +154 -0
  258. package/src/theme/ApiExplorer/ParamOptions/slice.ts +37 -0
  259. package/src/theme/ApiExplorer/Request/_Request.scss +129 -0
  260. package/src/theme/ApiExplorer/Request/index.tsx +352 -0
  261. package/src/theme/ApiExplorer/Request/makeRequest.ts +255 -0
  262. package/src/theme/ApiExplorer/Response/_Response.scss +121 -0
  263. package/src/theme/ApiExplorer/Response/index.tsx +173 -0
  264. package/src/theme/ApiExplorer/Response/slice.ts +52 -0
  265. package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +375 -0
  266. package/src/theme/ApiExplorer/Server/_Server.scss +26 -0
  267. package/src/theme/ApiExplorer/Server/index.tsx +138 -0
  268. package/src/theme/ApiExplorer/Server/slice.ts +39 -0
  269. package/src/theme/ApiExplorer/buildPostmanRequest.ts +524 -0
  270. package/src/theme/ApiExplorer/index.tsx +52 -0
  271. package/src/theme/ApiExplorer/persistanceMiddleware.ts +73 -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 +243 -0
  281. package/src/theme/ArrayBrackets/index.tsx +37 -0
  282. package/src/theme/CodeSamples/_CodeSamples.scss +3 -0
  283. package/src/theme/CodeSamples/index.tsx +26 -0
  284. package/src/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
  285. package/src/theme/DiscriminatorTabs/index.tsx +229 -0
  286. package/src/theme/Markdown/Details/_Details.scss +122 -0
  287. package/src/theme/Markdown/index.d.ts +8 -0
  288. package/src/theme/Markdown/index.js +179 -0
  289. package/src/theme/MimeTabs/_MimeTabs.scss +70 -0
  290. package/src/theme/MimeTabs/index.tsx +257 -0
  291. package/src/theme/OperationTabs/_OperationTabs.scss +72 -0
  292. package/src/theme/OperationTabs/index.tsx +220 -0
  293. package/src/theme/ParamsDetails/index.tsx +90 -0
  294. package/src/theme/ParamsItem/_ParamsItem.scss +54 -0
  295. package/src/theme/ParamsItem/index.tsx +246 -0
  296. package/src/theme/RequestSchema/index.tsx +172 -0
  297. package/src/theme/ResponseExamples/index.tsx +209 -0
  298. package/src/theme/ResponseHeaders/index.tsx +49 -0
  299. package/src/theme/ResponseSchema/index.tsx +150 -0
  300. package/src/theme/Schema/index.tsx +938 -0
  301. package/src/theme/SchemaItem/_SchemaItem.scss +89 -0
  302. package/src/theme/SchemaItem/index.tsx +273 -0
  303. package/src/theme/SchemaTabs/_SchemaTabs.scss +61 -0
  304. package/src/theme/SchemaTabs/index.tsx +224 -0
  305. package/src/theme/SkeletonLoader/index.tsx +18 -0
  306. package/src/theme/StatusCodes/index.tsx +83 -0
  307. package/src/theme/styles.scss +215 -0
  308. package/src/theme/translationIds.ts +103 -0
  309. package/src/theme-classic.d.ts +80 -0
  310. package/src/theme-openapi.d.ts +20 -0
  311. package/src/types.ts +72 -0
  312. package/tsconfig.json +16 -0
@@ -0,0 +1,146 @@
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
+ import { createStorage, hashArray } from "@theme/ApiExplorer/storage-utils";
10
+ import {
11
+ SecurityRequirementObject,
12
+ SecuritySchemeObject,
13
+ } from "@camunda8/docusaurus-plugin-openapi-docs/src/openapi/types";
14
+ /* eslint-disable import/no-extraneous-dependencies*/
15
+ import { ThemeConfig } from "@camunda8/docusaurus-theme-openapi-docs/src/types";
16
+
17
+ import { getAuthDataKeys } from "./auth-types";
18
+
19
+ // The global definitions
20
+ // "securitySchemes": {
21
+ // "BearerAuth": { "type": "http", "scheme": "BeAreR" },
22
+ // "BasicAuth": { "type": "http", "scheme": "basic" }
23
+ // },
24
+
25
+ // The operation level requirements
26
+ // "security": [
27
+ // { "BearerAuth": [] },
28
+ // { "BearerAuth": [], "BasicAuth": [] }
29
+ // ],
30
+
31
+ // SLICE_STATE
32
+ // data:
33
+ // BearerAuth:
34
+ // token=xxx
35
+ // BasicAuth:
36
+ // username=xxx
37
+ // password=xxx
38
+ //
39
+ // options:
40
+ // "BearerAuth": [{ key: "BearerAuth", scopes: [], ...rest }]
41
+ // "BearerAuth and BasicAuth": [{ key: "BearerAuth", scopes: [], ...rest }, { key: "BasicAuth", scopes: [], ...rest }]
42
+ //
43
+ // selected: "BearerAuth and BasicAuth"
44
+
45
+ // LOCAL_STORAGE
46
+ // hash(SLICE_STATE.options) -> "BearerAuth and BasicAuth"
47
+ // BearerAuth -> { token: xxx }
48
+ // BasicAuth -> { username: xxx, password: xxx }
49
+
50
+ export function createAuth({
51
+ security,
52
+ securitySchemes,
53
+ options: opts,
54
+ }: {
55
+ security?: SecurityRequirementObject[];
56
+ securitySchemes?: {
57
+ [key: string]: SecuritySchemeObject;
58
+ };
59
+ options?: ThemeConfig["api"];
60
+ }): AuthState {
61
+ const storage = createStorage("sessionStorage");
62
+
63
+ let data: AuthState["data"] = {};
64
+ let options: AuthState["options"] = {};
65
+
66
+ for (const option of security ?? []) {
67
+ const id = Object.keys(option).join(" and ");
68
+ for (const [schemeID, scopes] of Object.entries(option)) {
69
+ const scheme = securitySchemes?.[schemeID];
70
+ if (scheme) {
71
+ if (options[id] === undefined) {
72
+ options[id] = [];
73
+ }
74
+ const dataKeys = getAuthDataKeys(scheme);
75
+ for (const key of dataKeys) {
76
+ if (data[schemeID] === undefined) {
77
+ data[schemeID] = {};
78
+ }
79
+
80
+ let persisted = undefined;
81
+ try {
82
+ persisted = JSON.parse(storage.getItem(schemeID) ?? "")[key];
83
+ } catch {}
84
+
85
+ data[schemeID][key] = persisted;
86
+ }
87
+ options[id].push({
88
+ ...scheme,
89
+ key: schemeID,
90
+ scopes,
91
+ });
92
+ }
93
+ }
94
+ }
95
+
96
+ let persisted = undefined;
97
+ try {
98
+ persisted = storage.getItem(hashArray(Object.keys(options))) ?? undefined;
99
+ } catch {}
100
+
101
+ return {
102
+ data,
103
+ options,
104
+ selected: persisted ?? Object.keys(options)[0],
105
+ };
106
+ }
107
+
108
+ export type Scheme = {
109
+ key: string;
110
+ scopes: string[];
111
+ } & SecuritySchemeObject;
112
+
113
+ export interface AuthState {
114
+ data: {
115
+ [scheme: string]: {
116
+ [key: string]: string | undefined;
117
+ };
118
+ };
119
+ options: {
120
+ [key: string]: Scheme[];
121
+ };
122
+ selected?: string;
123
+ }
124
+
125
+ const initialState: AuthState = {} as any;
126
+
127
+ export const slice = createSlice({
128
+ name: "auth",
129
+ initialState,
130
+ reducers: {
131
+ setAuthData: (
132
+ state,
133
+ action: PayloadAction<{ scheme: string; key: string; value?: string }>
134
+ ) => {
135
+ const { scheme, key, value } = action.payload;
136
+ state.data[scheme][key] = value;
137
+ },
138
+ setSelectedAuth: (state, action: PayloadAction<string>) => {
139
+ state.selected = action.payload;
140
+ },
141
+ },
142
+ });
143
+
144
+ export const { setAuthData, setSelectedAuth } = slice.actions;
145
+
146
+ export default slice.reducer;
@@ -0,0 +1,388 @@
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 { translate } from "@docusaurus/Translate";
11
+
12
+ import json2xml from "@theme/ApiExplorer/Body/json2xml";
13
+ import FormFileUpload from "@theme/ApiExplorer/FormFileUpload";
14
+ import FormItem from "@theme/ApiExplorer/FormItem";
15
+ import FormSelect from "@theme/ApiExplorer/FormSelect";
16
+ import FormTextInput from "@theme/ApiExplorer/FormTextInput";
17
+ import LiveApp from "@theme/ApiExplorer/LiveEditor";
18
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
19
+ import Markdown from "@theme/Markdown";
20
+ import SchemaTabs from "@theme/SchemaTabs";
21
+ import TabItem from "@theme/TabItem";
22
+ import { OPENAPI_BODY, OPENAPI_REQUEST } from "@theme/translationIds";
23
+ import { RequestBodyObject } from "@camunda8/docusaurus-plugin-openapi-docs/src/openapi/types";
24
+ import format from "xml-formatter";
25
+
26
+ import {
27
+ clearFormBodyKey,
28
+ clearRawBody,
29
+ setFileFormBody,
30
+ setFileRawBody,
31
+ setStringFormBody,
32
+ } from "./slice";
33
+
34
+ export interface Props {
35
+ jsonRequestBodyExample: string;
36
+ requestBodyMetadata?: RequestBodyObject;
37
+ methods?: any;
38
+ required?: boolean;
39
+ }
40
+
41
+ function BodyWrap({
42
+ requestBodyMetadata,
43
+ jsonRequestBodyExample,
44
+ methods,
45
+ required,
46
+ }: Props) {
47
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
48
+
49
+ // NOTE: We used to check if body was required, but opted to always show the request body
50
+ // to reduce confusion, see: https://github.com/cloud-annotations/docusaurus-openapi/issues/145
51
+
52
+ // No body
53
+ if (contentType === undefined) {
54
+ return null;
55
+ }
56
+
57
+ return (
58
+ <Body
59
+ requestBodyMetadata={requestBodyMetadata}
60
+ jsonRequestBodyExample={jsonRequestBodyExample}
61
+ required={required}
62
+ />
63
+ );
64
+ }
65
+
66
+ function Body({
67
+ requestBodyMetadata,
68
+ jsonRequestBodyExample,
69
+ methods,
70
+ required,
71
+ }: Props) {
72
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
73
+ const dispatch = useTypedDispatch();
74
+
75
+ // Lot's of possible content-types:
76
+ // - application/json
77
+ // - application/xml
78
+ // - text/plain
79
+ // - text/css
80
+ // - text/html
81
+ // - text/javascript
82
+ // - application/javascript
83
+ // - multipart/form-data
84
+ // - application/x-www-form-urlencoded
85
+ // - image/svg+xml;charset=US-ASCII
86
+
87
+ // Show editor:
88
+ // - application/json
89
+ // - application/xml
90
+ // - */*
91
+
92
+ // Show form:
93
+ // - multipart/form-data
94
+ // - application/x-www-form-urlencoded
95
+
96
+ const schema = requestBodyMetadata?.content?.[contentType]?.schema;
97
+ const example = requestBodyMetadata?.content?.[contentType]?.example;
98
+ const examples = requestBodyMetadata?.content?.[contentType]?.examples;
99
+
100
+ if (schema?.format === "binary") {
101
+ return (
102
+ <FormItem>
103
+ <FormFileUpload
104
+ placeholder={
105
+ schema.description ||
106
+ translate({ id: OPENAPI_REQUEST.BODY_TITLE, message: "Body" })
107
+ }
108
+ onChange={(file: any) => {
109
+ if (file === undefined) {
110
+ dispatch(clearRawBody());
111
+ return;
112
+ }
113
+ dispatch(
114
+ setFileRawBody({
115
+ src: `/path/to/${file.name}`,
116
+ content: file,
117
+ })
118
+ );
119
+ }}
120
+ />
121
+ </FormItem>
122
+ );
123
+ }
124
+ if (
125
+ (contentType === "multipart/form-data" ||
126
+ contentType === "application/x-www-form-urlencoded") &&
127
+ schema?.type === "object"
128
+ ) {
129
+ return (
130
+ <FormItem className="openapi-explorer__form-item-body-container">
131
+ <div>
132
+ {Object.entries(schema.properties ?? {}).map(([key, val]: any) => {
133
+ if (val.format === "binary") {
134
+ return (
135
+ <FormItem
136
+ key={key}
137
+ label={key}
138
+ required={
139
+ Array.isArray(schema.required) &&
140
+ schema.required.includes(key)
141
+ }
142
+ >
143
+ <FormFileUpload
144
+ placeholder={val.description || key}
145
+ onChange={(file: any) => {
146
+ if (file === undefined) {
147
+ dispatch(clearFormBodyKey(key));
148
+ return;
149
+ }
150
+ dispatch(
151
+ setFileFormBody({
152
+ key: key,
153
+ value: {
154
+ src: `/path/to/${file.name}`,
155
+ content: file,
156
+ },
157
+ })
158
+ );
159
+ }}
160
+ />
161
+ </FormItem>
162
+ );
163
+ }
164
+
165
+ if (val.enum) {
166
+ return (
167
+ <FormItem
168
+ key={key}
169
+ label={key}
170
+ required={
171
+ Array.isArray(schema.required) &&
172
+ schema.required.includes(key)
173
+ }
174
+ >
175
+ <FormSelect
176
+ options={["---", ...val.enum]}
177
+ onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
178
+ const val = e.target.value;
179
+ if (val === "---") {
180
+ dispatch(clearFormBodyKey(key));
181
+ } else {
182
+ dispatch(
183
+ setStringFormBody({
184
+ key: key,
185
+ value: val,
186
+ })
187
+ );
188
+ }
189
+ }}
190
+ />
191
+ </FormItem>
192
+ );
193
+ }
194
+ // TODO: support all the other types.
195
+ return (
196
+ <FormItem
197
+ key={key}
198
+ label={key}
199
+ required={
200
+ Array.isArray(schema.required) &&
201
+ schema.required.includes(key)
202
+ }
203
+ >
204
+ <FormTextInput
205
+ paramName={key}
206
+ isRequired={
207
+ Array.isArray(schema.required) &&
208
+ schema.required.includes(key)
209
+ }
210
+ placeholder={val.description || key}
211
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
212
+ dispatch(
213
+ setStringFormBody({ key: key, value: e.target.value })
214
+ );
215
+ }}
216
+ />
217
+ </FormItem>
218
+ );
219
+ })}
220
+ </div>
221
+ </FormItem>
222
+ );
223
+ }
224
+
225
+ let language = "plaintext";
226
+ let defaultBody = ""; //"body content";
227
+ let exampleBody;
228
+ let examplesBodies = [] as any;
229
+
230
+ if (
231
+ contentType.includes("application/json") ||
232
+ contentType.endsWith("+json")
233
+ ) {
234
+ if (jsonRequestBodyExample) {
235
+ defaultBody = JSON.stringify(jsonRequestBodyExample, null, 2);
236
+ }
237
+ if (example) {
238
+ exampleBody = JSON.stringify(example, null, 2);
239
+ }
240
+ if (examples) {
241
+ for (const [key, example] of Object.entries(examples)) {
242
+ let body = example.value;
243
+ try {
244
+ // If the value is already valid JSON we shouldn't double encode the value
245
+ JSON.parse(example.value);
246
+ } catch (e) {
247
+ body = JSON.stringify(example.value, null, 2);
248
+ }
249
+
250
+ examplesBodies.push({
251
+ label: key,
252
+ body,
253
+ summary: example.summary,
254
+ });
255
+ }
256
+ }
257
+ language = "json";
258
+ }
259
+
260
+ if (contentType === "application/xml" || contentType.endsWith("+xml")) {
261
+ if (jsonRequestBodyExample) {
262
+ try {
263
+ defaultBody = format(json2xml(jsonRequestBodyExample, ""), {
264
+ indentation: " ",
265
+ lineSeparator: "\n",
266
+ collapseContent: true,
267
+ });
268
+ } catch {
269
+ defaultBody = json2xml(jsonRequestBodyExample);
270
+ }
271
+ }
272
+ if (example) {
273
+ try {
274
+ exampleBody = format(json2xml(example, ""), {
275
+ indentation: " ",
276
+ lineSeparator: "\n",
277
+ collapseContent: true,
278
+ });
279
+ } catch {
280
+ exampleBody = json2xml(example);
281
+ }
282
+ }
283
+ if (examples) {
284
+ for (const [key, example] of Object.entries(examples)) {
285
+ let formattedXmlBody;
286
+ try {
287
+ formattedXmlBody = format(example.value, {
288
+ indentation: " ",
289
+ lineSeparator: "\n",
290
+ collapseContent: true,
291
+ });
292
+ } catch {
293
+ formattedXmlBody = example.value;
294
+ }
295
+ examplesBodies.push({
296
+ label: key,
297
+ body: formattedXmlBody,
298
+ summary: example.summary,
299
+ });
300
+ }
301
+ }
302
+ language = "xml";
303
+ }
304
+
305
+ if (exampleBody) {
306
+ return (
307
+ <FormItem>
308
+ <SchemaTabs className="openapi-tabs__schema" lazy>
309
+ {/* @ts-ignore */}
310
+ <TabItem
311
+ label={translate({
312
+ id: OPENAPI_BODY.EXAMPLE_FROM_SCHEMA,
313
+ message: "Example (from schema)",
314
+ })}
315
+ value="Example (from schema)"
316
+ default
317
+ >
318
+ <LiveApp action={dispatch} language={language} required={required}>
319
+ {defaultBody}
320
+ </LiveApp>
321
+ </TabItem>
322
+ {/* @ts-ignore */}
323
+ <TabItem label="Example" value="example">
324
+ {example.summary && <Markdown>{example.summary}</Markdown>}
325
+ {exampleBody && (
326
+ <LiveApp
327
+ action={dispatch}
328
+ language={language}
329
+ required={required}
330
+ >
331
+ {exampleBody}
332
+ </LiveApp>
333
+ )}
334
+ </TabItem>
335
+ </SchemaTabs>
336
+ </FormItem>
337
+ );
338
+ }
339
+
340
+ if (examplesBodies && examplesBodies.length > 0) {
341
+ return (
342
+ <FormItem className="openapi-explorer__form-item-body-container">
343
+ <SchemaTabs className="openapi-tabs__schema" lazy>
344
+ {/* @ts-ignore */}
345
+ <TabItem
346
+ label={translate({
347
+ id: OPENAPI_BODY.EXAMPLE_FROM_SCHEMA,
348
+ message: "Example (from schema)",
349
+ })}
350
+ value="Example (from schema)"
351
+ default
352
+ >
353
+ <LiveApp action={dispatch} language={language} required={required}>
354
+ {defaultBody}
355
+ </LiveApp>
356
+ </TabItem>
357
+ {examplesBodies.map((example: any) => {
358
+ return (
359
+ // @ts-ignore
360
+ <TabItem
361
+ label={example.label}
362
+ value={example.label}
363
+ key={example.label}
364
+ >
365
+ {example.summary && <Markdown>{example.summary}</Markdown>}
366
+ {example.body && (
367
+ <LiveApp action={dispatch} language={language}>
368
+ {example.body}
369
+ </LiveApp>
370
+ )}
371
+ </TabItem>
372
+ );
373
+ })}
374
+ </SchemaTabs>
375
+ </FormItem>
376
+ );
377
+ }
378
+
379
+ return (
380
+ <FormItem>
381
+ <LiveApp action={dispatch} language={language} required={required}>
382
+ {defaultBody}
383
+ </LiveApp>
384
+ </FormItem>
385
+ );
386
+ }
387
+
388
+ export default BodyWrap;
@@ -0,0 +1,8 @@
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(input: any, indent?: any): any;
@@ -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
+ }