@redocly/openapi-docs 3.24.0-next.9 → 3.24.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 (314) hide show
  1. package/dist/{redocly-openapi-docs.min.AiChatProvider-DcsGB2gP.js → redocly-openapi-docs.min.AiChatProvider-j-VDfFJ9.js} +3 -3
  2. package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-wCZA4usG.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js} +1 -1
  3. package/dist/{redocly-openapi-docs.min.AiPanel-jo7fqtSt.js → redocly-openapi-docs.min.AiPanel-DTzHqAiI.js} +116 -116
  4. package/dist/redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js +1 -0
  5. package/dist/redocly-openapi-docs.min.Observable-D6wKbFwB.js +1 -0
  6. package/dist/redocly-openapi-docs.min.SemanticSearchService-DNFOPBZK.js +1 -0
  7. package/dist/{redocly-openapi-docs.min.SqliteDBStorage-B_f6WR8o.js → redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js} +1 -1
  8. package/dist/redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js +1 -0
  9. package/dist/redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js +1 -0
  10. package/dist/redocly-openapi-docs.min.ai-chat-mappers-CmX-8902.js +1 -0
  11. package/dist/redocly-openapi-docs.min.core-BYyFOtMX.js +1 -0
  12. package/dist/redocly-openapi-docs.min.external-resolver-BkceRyB4.js +2 -0
  13. package/dist/redocly-openapi-docs.min.index-BCcol5vU.js +1 -0
  14. package/dist/redocly-openapi-docs.min.index-C6uU_v-b.js +1 -0
  15. package/dist/redocly-openapi-docs.min.index-CmXZfuiZ.js +7730 -0
  16. package/dist/redocly-openapi-docs.min.index-DVWw0ICA.js +1 -0
  17. package/dist/redocly-openapi-docs.min.index-YnvLQkG_.js +1 -0
  18. package/dist/redocly-openapi-docs.min.index-xl_tBaHD.js +1 -0
  19. package/dist/redocly-openapi-docs.min.js +1 -1
  20. package/dist/{redocly-openapi-docs.min.lint-C-zlwxhp.js → redocly-openapi-docs.min.lint-2YpbCz3r.js} +69 -69
  21. package/dist/{redocly-openapi-docs.min.lint-graphql-qEh9cZHx.js → redocly-openapi-docs.min.lint-graphql-Bgfcu2tP.js} +1 -1
  22. package/dist/redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js +1 -0
  23. package/dist/redocly-openapi-docs.min.promise-map-limit-Db_42GvV.js +1 -0
  24. package/dist/{redocly-openapi-docs.min.respect-run-hfNPYQ9x.js → redocly-openapi-docs.min.respect-run-Ct8taisL.js} +1 -1
  25. package/dist/redocly-openapi-docs.min.standalone-BPCdJgtH.js +11995 -0
  26. package/dist/redocly-openapi-docs.min.tauri-path-CmqBCxGb.js +1 -0
  27. package/dist/{redocly-openapi-docs.min.useAiChatQueries-DgSsCKMW.js → redocly-openapi-docs.min.useAiChatQueries-t8oy8jik.js} +80 -80
  28. package/lib/components/ApiInfo/__tests__/ApiInfo.test.d.ts +1 -0
  29. package/lib/components/ApiInfo/__tests__/ApiInfo.test.js +46 -0
  30. package/lib/components/Callbacks/CallbackOperation.js +1 -1
  31. package/lib/components/Callbacks/__tests__/Callbacks.test.d.ts +1 -0
  32. package/lib/components/Callbacks/__tests__/Callbacks.test.js +46 -0
  33. package/lib/components/Content/__tests__/useAutoScroll.test.d.ts +1 -0
  34. package/lib/components/Content/__tests__/useAutoScroll.test.js +88 -0
  35. package/lib/components/Content/useAutoScroll.js +1 -1
  36. package/lib/components/ContentItem/__tests__/useIsExpanded.test.d.ts +1 -0
  37. package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +123 -0
  38. package/lib/components/ContentItem/useIsExpanded.js +1 -1
  39. package/lib/components/ContentItems/ContentItems.js +1 -1
  40. package/lib/components/ContentItems/VirtualList.js +1 -1
  41. package/lib/components/ContentItems/__tests__/Items.test.d.ts +1 -0
  42. package/lib/components/ContentItems/__tests__/Items.test.js +66 -0
  43. package/lib/components/ContentItems/__tests__/VirtualList.test.d.ts +1 -0
  44. package/lib/components/ContentItems/__tests__/VirtualList.test.js +135 -0
  45. package/lib/components/ContentItems/useScrollOnRender.js +1 -1
  46. package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.d.ts +1 -0
  47. package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.js +63 -0
  48. package/lib/components/Download/__tests__/DownloadSpecification.test.d.ts +1 -0
  49. package/lib/components/Download/__tests__/DownloadSpecification.test.js +52 -0
  50. package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.d.ts +1 -0
  51. package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.js +60 -0
  52. package/lib/components/ExpandAllButton/__tests__/helpers.test.d.ts +1 -0
  53. package/lib/components/ExpandAllButton/__tests__/helpers.test.js +133 -0
  54. package/lib/components/Language/__tests__/LanguageDropdown.test.d.ts +1 -0
  55. package/lib/components/Language/__tests__/LanguageDropdown.test.js +23 -0
  56. package/lib/components/Markdown/__tests__/Markdown.test.d.ts +1 -0
  57. package/lib/components/Markdown/__tests__/Markdown.test.js +34 -0
  58. package/lib/components/McpOverview/__tests__/McpOverview.test.d.ts +1 -0
  59. package/lib/components/McpOverview/__tests__/McpOverview.test.js +66 -0
  60. package/lib/components/McpTool/__tests__/McpPrompt.test.d.ts +1 -0
  61. package/lib/components/McpTool/__tests__/McpPrompt.test.js +57 -0
  62. package/lib/components/McpTool/__tests__/McpResource.test.d.ts +1 -0
  63. package/lib/components/McpTool/__tests__/McpResource.test.js +81 -0
  64. package/lib/components/McpTool/__tests__/McpTool.test.d.ts +1 -0
  65. package/lib/components/McpTool/__tests__/McpTool.test.js +82 -0
  66. package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.d.ts +1 -0
  67. package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.js +79 -0
  68. package/lib/components/OperationItem/__tests__/OperationItem.test.d.ts +1 -0
  69. package/lib/components/OperationItem/__tests__/OperationItem.test.js +70 -0
  70. package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.d.ts +16 -0
  71. package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.js +42 -0
  72. package/lib/components/Overview/__tests__/Overview.test.d.ts +1 -0
  73. package/lib/components/Overview/__tests__/Overview.test.js +59 -0
  74. package/lib/components/PayloadSamples/__tests__/Example.test.d.ts +1 -0
  75. package/lib/components/PayloadSamples/__tests__/Example.test.js +36 -0
  76. package/lib/components/PayloadSamples/__tests__/ExampleValue.test.d.ts +1 -0
  77. package/lib/components/PayloadSamples/__tests__/ExampleValue.test.js +197 -0
  78. package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.d.ts +1 -0
  79. package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.js +38 -0
  80. package/lib/components/PropertyDetails/__tests__/Extensions.test.d.ts +1 -0
  81. package/lib/components/PropertyDetails/__tests__/Extensions.test.js +21 -0
  82. package/lib/components/PropertyDetails/__tests__/FieldDetail.test.d.ts +1 -0
  83. package/lib/components/PropertyDetails/__tests__/FieldDetail.test.js +52 -0
  84. package/lib/components/PropertyDetails/__tests__/FieldDetails.test.d.ts +1 -0
  85. package/lib/components/PropertyDetails/__tests__/FieldDetails.test.js +191 -0
  86. package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.d.ts +1 -0
  87. package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.js +365 -0
  88. package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.d.ts +1 -0
  89. package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.js +23 -0
  90. package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.d.ts +1 -0
  91. package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.js +16 -0
  92. package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.d.ts +1 -0
  93. package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.js +104 -0
  94. package/lib/components/RenderHook/__tests__/RenderHook.test.d.ts +1 -0
  95. package/lib/components/RenderHook/__tests__/RenderHook.test.js +15 -0
  96. package/lib/components/Replay/__tests__/utils.test.d.ts +1 -0
  97. package/lib/components/Replay/__tests__/utils.test.js +526 -0
  98. package/lib/components/Request/__tests__/RequestDetails.test.d.ts +1 -0
  99. package/lib/components/Request/__tests__/RequestDetails.test.js +98 -0
  100. package/lib/components/RequestSamples/__tests__/Example.test.d.ts +1 -0
  101. package/lib/components/RequestSamples/__tests__/Example.test.js +384 -0
  102. package/lib/components/RequestSamples/__tests__/RequestSamples.test.d.ts +1 -0
  103. package/lib/components/RequestSamples/__tests__/RequestSamples.test.js +226 -0
  104. package/lib/components/RequestSamples/__tests__/useCodeSamples.test.d.ts +1 -0
  105. package/lib/components/RequestSamples/__tests__/useCodeSamples.test.js +64 -0
  106. package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.d.ts +1 -0
  107. package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.js +29 -0
  108. package/lib/components/Responses/OperationResponseList.js +1 -1
  109. package/lib/components/Responses/__tests__/OperationResponseList.test.d.ts +1 -0
  110. package/lib/components/Responses/__tests__/OperationResponseList.test.js +89 -0
  111. package/lib/components/Responses/__tests__/ResponseDetails.test.d.ts +1 -0
  112. package/lib/components/Responses/__tests__/ResponseDetails.test.js +111 -0
  113. package/lib/components/Responses/__tests__/ResponsesHeaders.test.d.ts +1 -0
  114. package/lib/components/Responses/__tests__/ResponsesHeaders.test.js +26 -0
  115. package/lib/components/Schema/Schema.js +1 -1
  116. package/lib/components/Schema/SubSchema.js +1 -1
  117. package/lib/components/Schema/__tests__/ArraySchema.test.d.ts +1 -0
  118. package/lib/components/Schema/__tests__/ArraySchema.test.js +93 -0
  119. package/lib/components/Schema/__tests__/ObjectSchema.test.d.ts +1 -0
  120. package/lib/components/Schema/__tests__/ObjectSchema.test.js +115 -0
  121. package/lib/components/Schema/__tests__/OneOfSchema.test.d.ts +1 -0
  122. package/lib/components/Schema/__tests__/OneOfSchema.test.js +33 -0
  123. package/lib/components/Schema/__tests__/Schema.test.d.ts +1 -0
  124. package/lib/components/Schema/__tests__/Schema.test.js +67 -0
  125. package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.d.ts +1 -0
  126. package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.js +22 -0
  127. package/lib/components/Schema/useOneOfLocationIdx.js +1 -1
  128. package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.d.ts +1 -0
  129. package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.js +95 -0
  130. package/lib/components/Security/__tests__/Security.test.d.ts +1 -0
  131. package/lib/components/Security/__tests__/Security.test.js +38 -0
  132. package/lib/components/Security/__tests__/SecurityButton.test.d.ts +1 -0
  133. package/lib/components/Security/__tests__/SecurityButton.test.js +92 -0
  134. package/lib/components/Security/__tests__/SecurityModal.test.d.ts +1 -0
  135. package/lib/components/Security/__tests__/SecurityModal.test.js +172 -0
  136. package/lib/components/ServerList/__tests__/ServerList.test.d.ts +1 -0
  137. package/lib/components/ServerList/__tests__/ServerList.test.js +83 -0
  138. package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
  139. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +1 -1
  140. package/lib/components/Tabs/__tests__/Tabs.test.d.ts +1 -0
  141. package/lib/components/Tabs/__tests__/Tabs.test.js +27 -0
  142. package/lib/components/TagItem/OperationsNavigation.js +1 -1
  143. package/lib/components/TagItem/TagItem.js +1 -1
  144. package/lib/components/ViewNested/__tests__/ViewNested.test.d.ts +1 -0
  145. package/lib/components/ViewNested/__tests__/ViewNested.test.js +42 -0
  146. package/lib/components/__tests__/Samples/ExampleSwitch.test.d.ts +1 -0
  147. package/lib/components/__tests__/Samples/ExampleSwitch.test.js +45 -0
  148. package/lib/components/__tests__/Samples/use-example-key.test.d.ts +1 -0
  149. package/lib/components/__tests__/Samples/use-example-key.test.js +28 -0
  150. package/lib/components/__tests__/common/ClearButton.test.d.ts +1 -0
  151. package/lib/components/__tests__/common/ClearButton.test.js +18 -0
  152. package/lib/components/__tests__/common/Dropdown.test.d.ts +1 -0
  153. package/lib/components/__tests__/common/Dropdown.test.js +52 -0
  154. package/lib/components/__tests__/mocks/examples.d.ts +4 -0
  155. package/lib/components/__tests__/mocks/examples.js +115 -0
  156. package/lib/components/common/LinkToField.js +1 -1
  157. package/lib/components/common/__tests__/Dropdown.test.d.ts +1 -0
  158. package/lib/components/common/__tests__/Dropdown.test.js +129 -0
  159. package/lib/components/common/__tests__/LinkToField.test.d.ts +1 -0
  160. package/lib/components/common/__tests__/LinkToField.test.js +39 -0
  161. package/lib/components/common/linkify.js +1 -1
  162. package/lib/hooks/useRouter.js +1 -1
  163. package/lib/hooks/useUppercase2LowercaseRedirect.js +1 -1
  164. package/lib/jotai/__tests__/app.test.d.ts +1 -0
  165. package/lib/jotai/__tests__/app.test.js +53 -0
  166. package/lib/models/__tests__/Callback.test.d.ts +1 -0
  167. package/lib/models/__tests__/Callback.test.js +15 -0
  168. package/lib/models/__tests__/FieldModel.test.d.ts +1 -0
  169. package/lib/models/__tests__/FieldModel.test.js +117 -0
  170. package/lib/models/__tests__/MediaContent.test.d.ts +1 -0
  171. package/lib/models/__tests__/MediaContent.test.js +105 -0
  172. package/lib/models/__tests__/Operation.test.d.ts +1 -0
  173. package/lib/models/__tests__/Operation.test.js +459 -0
  174. package/lib/models/__tests__/Response.test.d.ts +1 -0
  175. package/lib/models/__tests__/Response.test.js +221 -0
  176. package/lib/models/__tests__/Schema.circular.test.d.ts +1 -0
  177. package/lib/models/__tests__/Schema.circular.test.js +694 -0
  178. package/lib/models/__tests__/Schema.test.d.ts +1 -0
  179. package/lib/models/__tests__/Schema.test.js +1395 -0
  180. package/lib/models/__tests__/example.test.d.ts +1 -0
  181. package/lib/models/__tests__/example.test.js +90 -0
  182. package/lib/models/__tests__/group.test.d.ts +1 -0
  183. package/lib/models/__tests__/group.test.js +52 -0
  184. package/lib/models/__tests__/helpers.d.ts +5 -0
  185. package/lib/models/__tests__/helpers.js +62 -0
  186. package/lib/models/__tests__/request.test.d.ts +1 -0
  187. package/lib/models/__tests__/request.test.js +119 -0
  188. package/lib/services/__tests__/OpenAPIParser.test.d.ts +1 -0
  189. package/lib/services/__tests__/OpenAPIParser.test.js +80 -0
  190. package/lib/services/__tests__/check.test.d.ts +1 -0
  191. package/lib/services/__tests__/check.test.js +22 -0
  192. package/lib/services/__tests__/utils.test.d.ts +1 -0
  193. package/lib/services/__tests__/utils.test.js +42 -0
  194. package/lib/services/code-samples/__tests__/apply-environments.test.d.ts +1 -0
  195. package/lib/services/code-samples/__tests__/apply-environments.test.js +64 -0
  196. package/lib/services/code-samples/__tests__/build-code-samples.test.d.ts +1 -0
  197. package/lib/services/code-samples/__tests__/build-code-samples.test.js +70 -0
  198. package/lib/services/code-samples/__tests__/convertSampleToString.test.d.ts +1 -0
  199. package/lib/services/code-samples/__tests__/convertSampleToString.test.js +116 -0
  200. package/lib/services/code-samples/__tests__/generator-data-value.test.d.ts +1 -0
  201. package/lib/services/code-samples/__tests__/generator-data-value.test.js +277 -0
  202. package/lib/services/code-samples/__tests__/generator-serialized-value.test.d.ts +1 -0
  203. package/lib/services/code-samples/__tests__/generator-serialized-value.test.js +258 -0
  204. package/lib/services/code-samples/__tests__/generator-value.test.d.ts +1 -0
  205. package/lib/services/code-samples/__tests__/generator-value.test.js +273 -0
  206. package/lib/services/code-samples/__tests__/generator.test.d.ts +249 -0
  207. package/lib/services/code-samples/__tests__/generator.test.js +1201 -0
  208. package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.d.ts +1 -0
  209. package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.js +31 -0
  210. package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.d.ts +1 -0
  211. package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.js +222 -0
  212. package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.d.ts +1 -0
  213. package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.js +129 -0
  214. package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.d.ts +1 -0
  215. package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.js +49 -0
  216. package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.d.ts +1 -0
  217. package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.js +172 -0
  218. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.d.ts +1 -0
  219. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.js +172 -0
  220. package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.d.ts +1 -0
  221. package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.js +130 -0
  222. package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.d.ts +1 -0
  223. package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.js +191 -0
  224. package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.d.ts +1 -0
  225. package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.js +172 -0
  226. package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.d.ts +1 -0
  227. package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.js +85 -0
  228. package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.d.ts +1 -0
  229. package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.js +85 -0
  230. package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.d.ts +1 -0
  231. package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.js +126 -0
  232. package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.d.ts +1 -0
  233. package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.js +105 -0
  234. package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.d.ts +1 -0
  235. package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.js +126 -0
  236. package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.d.ts +1 -0
  237. package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.js +129 -0
  238. package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.d.ts +1 -0
  239. package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.js +129 -0
  240. package/lib/services/config-options/__tests__/helpers.test.d.ts +1 -0
  241. package/lib/services/config-options/__tests__/helpers.test.js +234 -0
  242. package/lib/services/history/__tests__/helpers.test.d.ts +1 -0
  243. package/lib/services/history/__tests__/helpers.test.js +19 -0
  244. package/lib/services/menu/__tests__/buildNestedTagsItems.test.d.ts +1 -0
  245. package/lib/services/menu/__tests__/buildNestedTagsItems.test.js +109 -0
  246. package/lib/services/menu/__tests__/builder.test.d.ts +1 -0
  247. package/lib/services/menu/__tests__/builder.test.js +307 -0
  248. package/lib/services/menu/__tests__/operation.test.d.ts +1 -0
  249. package/lib/services/menu/__tests__/operation.test.js +240 -0
  250. package/lib/services/menu/__tests__/tags.test.d.ts +1 -0
  251. package/lib/services/menu/__tests__/tags.test.js +71 -0
  252. package/lib/telemetry/RedocTelemetry.js +31 -1
  253. package/lib/telemetry/__tests__/RedocTelemetry.test.d.ts +1 -0
  254. package/lib/telemetry/__tests__/RedocTelemetry.test.js +107 -0
  255. package/lib/testProviders.d.ts +6 -0
  256. package/lib/testProviders.js +14 -0
  257. package/lib/utils/__tests__/areArraysEqual.test.d.ts +1 -0
  258. package/lib/utils/__tests__/areArraysEqual.test.js +33 -0
  259. package/lib/utils/__tests__/argValuesHelpers.d.ts +1 -0
  260. package/lib/utils/__tests__/argValuesHelpers.js +56 -0
  261. package/lib/utils/__tests__/calculateMaxLength.test.d.ts +1 -0
  262. package/lib/utils/__tests__/calculateMaxLength.test.js +119 -0
  263. package/lib/utils/__tests__/configure-helpers.test.d.ts +1 -0
  264. package/lib/utils/__tests__/configure-helpers.test.js +356 -0
  265. package/lib/utils/__tests__/convertSwagger2OpenAPI.test.d.ts +1 -0
  266. package/lib/utils/__tests__/convertSwagger2OpenAPI.test.js +392 -0
  267. package/lib/utils/__tests__/debounce.test.d.ts +1 -0
  268. package/lib/utils/__tests__/debounce.test.js +54 -0
  269. package/lib/utils/__tests__/debug.test.d.ts +1 -0
  270. package/lib/utils/__tests__/debug.test.js +23 -0
  271. package/lib/utils/__tests__/dom.test.d.ts +1 -0
  272. package/lib/utils/__tests__/dom.test.js +108 -0
  273. package/lib/utils/__tests__/getBreadcrumbs.test.d.ts +1 -0
  274. package/lib/utils/__tests__/getBreadcrumbs.test.js +98 -0
  275. package/lib/utils/__tests__/hasNestedFields.test.d.ts +1 -0
  276. package/lib/utils/__tests__/hasNestedFields.test.js +147 -0
  277. package/lib/utils/__tests__/helpers.test.d.ts +1 -0
  278. package/lib/utils/__tests__/helpers.test.js +174 -0
  279. package/lib/utils/__tests__/isMobile.test.d.ts +1 -0
  280. package/lib/utils/__tests__/isMobile.test.js +28 -0
  281. package/lib/utils/__tests__/loadAndBundleSpec.test.d.ts +1 -0
  282. package/lib/utils/__tests__/loadAndBundleSpec.test.js +22 -0
  283. package/lib/utils/__tests__/local-storage.test.d.ts +1 -0
  284. package/lib/utils/__tests__/local-storage.test.js +48 -0
  285. package/lib/utils/__tests__/object.test.d.ts +1 -0
  286. package/lib/utils/__tests__/object.test.js +45 -0
  287. package/lib/utils/__tests__/openapi.test.d.ts +1 -0
  288. package/lib/utils/__tests__/openapi.test.js +1378 -0
  289. package/lib/utils/__tests__/path.test.d.ts +1 -0
  290. package/lib/utils/__tests__/path.test.js +16 -0
  291. package/lib/utils/__tests__/queryString.test.d.ts +1 -0
  292. package/lib/utils/__tests__/queryString.test.js +60 -0
  293. package/lib/utils/__tests__/replaceVariables.test.d.ts +1 -0
  294. package/lib/utils/__tests__/replaceVariables.test.js +46 -0
  295. package/lib/utils/__tests__/simplifyAstStructure.test.d.ts +1 -0
  296. package/lib/utils/__tests__/simplifyAstStructure.test.js +26 -0
  297. package/lib/utils/__tests__/sort.test.d.ts +1 -0
  298. package/lib/utils/__tests__/sort.test.js +16 -0
  299. package/lib/utils/__tests__/string.test.d.ts +1 -0
  300. package/lib/utils/__tests__/string.test.js +16 -0
  301. package/lib/utils/__tests__/theme-helpers.test.d.ts +1 -0
  302. package/lib/utils/__tests__/theme-helpers.test.js +24 -0
  303. package/lib/utils/__tests__/url.test.d.ts +1 -0
  304. package/lib/utils/__tests__/url.test.js +134 -0
  305. package/lib/utils/path.d.ts +1 -1
  306. package/package.json +12 -12
  307. package/dist/redocly-openapi-docs.min.ai-chat-mappers-MY79QAeW.js +0 -1
  308. package/dist/redocly-openapi-docs.min.external-resolver-3KMJv7SC.js +0 -2
  309. package/dist/redocly-openapi-docs.min.index-BYVMr_la.js +0 -1
  310. package/dist/redocly-openapi-docs.min.index-CsqzTi3Z.js +0 -7586
  311. package/dist/redocly-openapi-docs.min.index-D8F7x0S6.js +0 -1
  312. package/dist/redocly-openapi-docs.min.index-qqKTpI_q.js +0 -1
  313. package/dist/redocly-openapi-docs.min.standalone-Ci6886Cr.js +0 -12114
  314. package/dist/redocly-openapi-docs.min.tauri-path-Bs1-AQjc.js +0 -1
@@ -0,0 +1,172 @@
1
+ export { HTTPSnippet } from '../../../index.js'; // we need to reexport it before to prevent circular ref issue
2
+ import apachehttp from '../apachehttp.js';
3
+ import { originalOptions, serverVariablesOptions, source } from '../../__mocks__/mock.js';
4
+ describe('#code-samples Java8+Apache', () => {
5
+ describe('handler', () => {
6
+ it('returns code API POST /pet', () => {
7
+ const result = apachehttp(source['POST http://petstore.swagger.io/v2/pet'], originalOptions, {
8
+ target: 'java8',
9
+ client: 'apachehttp',
10
+ });
11
+ expect(result).toMatchSnapshot();
12
+ });
13
+ it('returns code with path parameters reserved (data) and not (petId) /pet/{petId}/uploadImage/{data}', () => {
14
+ const result = apachehttp(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}'], originalOptions, { target: 'java8', client: 'apachehttp' });
15
+ expect(result).toMatchSnapshot();
16
+ });
17
+ it('returns code with one path parameter inside url /pet/{petId}/uploadImage', () => {
18
+ const result = apachehttp(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage'], originalOptions, { target: 'java8', client: 'apachehttp' });
19
+ expect(result).toMatchSnapshot();
20
+ });
21
+ it('returns code with path parameter and query /pet/findByStatus/{id}?status=...', () => {
22
+ const result = apachehttp(source['GET http://petstore.swagger.io/v2/pet/findByStatus/{id}'], originalOptions, { target: 'java8', client: 'apachehttp' });
23
+ expect(result).toMatchSnapshot();
24
+ });
25
+ it('should generate code with server variables', () => {
26
+ const result = apachehttp(source['POST https://{customerId}.saas-app.com:{port}/v2'], serverVariablesOptions, {
27
+ target: 'java8',
28
+ client: 'apachehttp',
29
+ });
30
+ expect(result).toMatchSnapshot();
31
+ });
32
+ it('should generate code with basic auth', () => {
33
+ const result = apachehttp(source['POST http://petstore.swagger.io/login'], serverVariablesOptions, {
34
+ target: 'java8',
35
+ client: 'apachehttp',
36
+ });
37
+ expect(result).toMatchSnapshot();
38
+ });
39
+ it('should handle URL_ENCODED with text but no params (serializedValue case)', () => {
40
+ const sourceWithUrlEncodedText = {
41
+ method: 'post',
42
+ url: 'http://petstore.swagger.io/v2/pet',
43
+ httpVersion: 'HTTP/1.1',
44
+ cookies: [],
45
+ headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }],
46
+ queryString: [],
47
+ postData: {
48
+ mimeType: 'application/x-www-form-urlencoded',
49
+ text: 'name=Museum+Visitor&value=premium&count=5',
50
+ params: [],
51
+ },
52
+ headersSize: 0,
53
+ bodySize: 0,
54
+ securityOAuth2ExtraCalls: [],
55
+ pathParameters: {},
56
+ serverVariables: {},
57
+ queryObj: {},
58
+ headersObj: { 'Content-Type': 'application/x-www-form-urlencoded' },
59
+ cookiesObj: {},
60
+ allHeaders: { 'Content-Type': 'application/x-www-form-urlencoded' },
61
+ uriObj: {
62
+ protocol: 'http:',
63
+ slashes: true,
64
+ auth: null,
65
+ host: 'petstore.swagger.io',
66
+ port: null,
67
+ hostname: 'petstore.swagger.io',
68
+ hash: null,
69
+ search: '',
70
+ query: {},
71
+ pathname: '/v2/pet',
72
+ path: '/v2/pet',
73
+ href: 'http://petstore.swagger.io/v2/pet',
74
+ },
75
+ fullUrl: 'http://petstore.swagger.io/v2/pet',
76
+ };
77
+ const result = apachehttp(sourceWithUrlEncodedText, originalOptions, {
78
+ target: 'java8',
79
+ client: 'apachehttp',
80
+ });
81
+ expect(result).toMatchSnapshot();
82
+ });
83
+ it('should handle MULTIPART with text but no params (serializedValue case)', () => {
84
+ const sourceWithMultipartText = {
85
+ method: 'post',
86
+ url: 'http://petstore.swagger.io/v2/pet',
87
+ httpVersion: 'HTTP/1.1',
88
+ cookies: [],
89
+ headers: [{ name: 'Content-Type', value: 'multipart/form-data' }],
90
+ queryString: [],
91
+ postData: {
92
+ mimeType: 'multipart/form-data',
93
+ text: '--boundary123\r\nContent-Disposition: form-data; name="field1"\r\n\r\nvalue1\r\n--boundary123\r\nContent-Disposition: form-data; name="field2"\r\n\r\nvalue2\r\n--boundary123--',
94
+ params: [],
95
+ },
96
+ headersSize: 0,
97
+ bodySize: 0,
98
+ securityOAuth2ExtraCalls: [],
99
+ pathParameters: {},
100
+ serverVariables: {},
101
+ queryObj: {},
102
+ headersObj: { 'Content-Type': 'multipart/form-data' },
103
+ cookiesObj: {},
104
+ allHeaders: { 'Content-Type': 'multipart/form-data' },
105
+ uriObj: {
106
+ protocol: 'http:',
107
+ slashes: true,
108
+ auth: null,
109
+ host: 'petstore.swagger.io',
110
+ port: null,
111
+ hostname: 'petstore.swagger.io',
112
+ hash: null,
113
+ search: '',
114
+ query: {},
115
+ pathname: '/v2/pet',
116
+ path: '/v2/pet',
117
+ href: 'http://petstore.swagger.io/v2/pet',
118
+ },
119
+ fullUrl: 'http://petstore.swagger.io/v2/pet',
120
+ };
121
+ const result = apachehttp(sourceWithMultipartText, originalOptions, {
122
+ target: 'java8',
123
+ client: 'apachehttp',
124
+ });
125
+ expect(result).toMatchSnapshot();
126
+ });
127
+ it('should handle OCTET_STREAM with text (binary data case)', () => {
128
+ const sourceWithOctetStream = {
129
+ method: 'post',
130
+ url: 'http://petstore.swagger.io/v2/upload',
131
+ httpVersion: 'HTTP/1.1',
132
+ cookies: [],
133
+ headers: [{ name: 'Content-Type', value: 'application/octet-stream' }],
134
+ queryString: [],
135
+ postData: {
136
+ mimeType: 'application/octet-stream',
137
+ text: 'SGVsbG8gV29ybGQ=',
138
+ },
139
+ headersSize: 0,
140
+ bodySize: 0,
141
+ securityOAuth2ExtraCalls: [],
142
+ pathParameters: {},
143
+ serverVariables: {},
144
+ queryObj: {},
145
+ headersObj: { 'Content-Type': 'application/octet-stream' },
146
+ cookiesObj: {},
147
+ allHeaders: { 'Content-Type': 'application/octet-stream' },
148
+ uriObj: {
149
+ protocol: 'http:',
150
+ slashes: true,
151
+ auth: null,
152
+ host: 'petstore.swagger.io',
153
+ port: null,
154
+ hostname: 'petstore.swagger.io',
155
+ hash: null,
156
+ search: '',
157
+ query: {},
158
+ pathname: '/v2/upload',
159
+ path: '/v2/upload',
160
+ href: 'http://petstore.swagger.io/v2/upload',
161
+ },
162
+ fullUrl: 'http://petstore.swagger.io/v2/upload',
163
+ };
164
+ const result = apachehttp(sourceWithOctetStream, originalOptions, {
165
+ target: 'java8',
166
+ client: 'apachehttp',
167
+ });
168
+ expect(result).toMatchSnapshot();
169
+ });
170
+ });
171
+ });
172
+ //# sourceMappingURL=apachehttp.test.js.map
@@ -0,0 +1 @@
1
+ export { HTTPSnippet } from '../../../index.js';
@@ -0,0 +1,85 @@
1
+ export { HTTPSnippet } from '../../../index.js'; // we need to reexport it before to prevent circular ref issue
2
+ import fetch from '../fetch.js';
3
+ import { originalOptions, serverVariablesOptions, source } from '../../__mocks__/mock.js';
4
+ describe('#code-samples Javascript', () => {
5
+ describe('handler', () => {
6
+ it('returns code API POST /pet', () => {
7
+ const result = fetch(source['POST http://petstore.swagger.io/v2/pet'], originalOptions, {
8
+ target: 'javascript',
9
+ client: 'fetch',
10
+ });
11
+ expect(result).toMatchSnapshot();
12
+ });
13
+ it('returns code with path parameters reserved (data) and not (petId) /pet/{petId}/uploadImage/{data}', () => {
14
+ const result = fetch(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}'], originalOptions, { target: 'javascript', client: 'fetch' });
15
+ expect(result).toMatchSnapshot();
16
+ });
17
+ it('returns code with one path parameter inside url /pet/{petId}/uploadImage', () => {
18
+ const result = fetch(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage'], originalOptions, { target: 'javascript', client: 'fetch' });
19
+ expect(result).toMatchSnapshot();
20
+ });
21
+ it('returns code with path parameter and query /pet/findByStatus/{id}?status=...', () => {
22
+ const result = fetch(source['GET http://petstore.swagger.io/v2/pet/findByStatus/{id}'], originalOptions, { target: 'javascript', client: 'fetch' });
23
+ expect(result).toMatchSnapshot();
24
+ });
25
+ it('should generate code with server variables', () => {
26
+ const result = fetch(source['POST https://{customerId}.saas-app.com:{port}/v2'], serverVariablesOptions, {
27
+ target: 'javascript',
28
+ client: 'fetch',
29
+ });
30
+ expect(result).toMatchSnapshot();
31
+ });
32
+ it('should generate code with basic auth', () => {
33
+ const result = fetch(source['POST http://petstore.swagger.io/login'], serverVariablesOptions, {
34
+ target: 'javascript',
35
+ client: 'fetch',
36
+ });
37
+ expect(result).toMatchSnapshot();
38
+ });
39
+ it('should handle MULTIPART with text but no params (serializedValue case)', () => {
40
+ const sourceWithMultipartText = {
41
+ method: 'post',
42
+ url: 'http://petstore.swagger.io/v2/pet',
43
+ httpVersion: 'HTTP/1.1',
44
+ cookies: [],
45
+ headers: [{ name: 'Content-Type', value: 'multipart/form-data' }],
46
+ queryString: [],
47
+ postData: {
48
+ mimeType: 'multipart/form-data',
49
+ text: '--boundary123\r\nContent-Disposition: form-data; name="field1"\r\n\r\nvalue1\r\n--boundary123\r\nContent-Disposition: form-data; name="field2"\r\n\r\nvalue2\r\n--boundary123--',
50
+ params: [],
51
+ },
52
+ headersSize: 0,
53
+ bodySize: 0,
54
+ securityOAuth2ExtraCalls: [],
55
+ pathParameters: {},
56
+ serverVariables: {},
57
+ queryObj: {},
58
+ headersObj: { 'Content-Type': 'multipart/form-data' },
59
+ cookiesObj: {},
60
+ allHeaders: { 'Content-Type': 'multipart/form-data' },
61
+ uriObj: {
62
+ protocol: 'http:',
63
+ slashes: true,
64
+ auth: null,
65
+ host: 'petstore.swagger.io',
66
+ port: null,
67
+ hostname: 'petstore.swagger.io',
68
+ hash: null,
69
+ search: '',
70
+ query: {},
71
+ pathname: '/v2/pet',
72
+ path: '/v2/pet',
73
+ href: 'http://petstore.swagger.io/v2/pet',
74
+ },
75
+ fullUrl: 'http://petstore.swagger.io/v2/pet',
76
+ };
77
+ const result = fetch(sourceWithMultipartText, originalOptions, {
78
+ target: 'javascript',
79
+ client: 'fetch',
80
+ });
81
+ expect(result).toMatchSnapshot();
82
+ });
83
+ });
84
+ });
85
+ //# sourceMappingURL=fetch.test.js.map
@@ -0,0 +1 @@
1
+ export { HTTPSnippet } from '../../../index.js';
@@ -0,0 +1,85 @@
1
+ export { HTTPSnippet } from '../../../index.js'; // we need to reexport it before to prevent circular ref issue
2
+ import fetch from '../fetch.js';
3
+ import { originalOptions, serverVariablesOptions, source } from '../../__mocks__/mock.js';
4
+ describe('#code-samples Nodejs', () => {
5
+ describe('handler', () => {
6
+ it('returns code API POST /pet', () => {
7
+ const result = fetch(source['POST http://petstore.swagger.io/v2/pet'], originalOptions, {
8
+ target: 'node',
9
+ client: 'fetch',
10
+ });
11
+ expect(result).toMatchSnapshot();
12
+ });
13
+ it('returns code with path parameters reserved (data) and not (petId) /pet/{petId}/uploadImage/{data}', () => {
14
+ const result = fetch(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}'], originalOptions, { target: 'node', client: 'fetch' });
15
+ expect(result).toMatchSnapshot();
16
+ });
17
+ it('returns code with one path parameter inside url /pet/{petId}/uploadImage', () => {
18
+ const result = fetch(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage'], originalOptions, { target: 'node', client: 'fetch' });
19
+ expect(result).toMatchSnapshot();
20
+ });
21
+ it('returns code with path parameter and query /pet/findByStatus/{id}?status=...', () => {
22
+ const result = fetch(source['GET http://petstore.swagger.io/v2/pet/findByStatus/{id}'], originalOptions, { target: 'node', client: 'fetch' });
23
+ expect(result).toMatchSnapshot();
24
+ });
25
+ it('should generate code with server variables', () => {
26
+ const result = fetch(source['POST https://{customerId}.saas-app.com:{port}/v2'], serverVariablesOptions, {
27
+ target: 'node',
28
+ client: 'fetch',
29
+ });
30
+ expect(result).toMatchSnapshot();
31
+ });
32
+ it('should generate code with basic auth', () => {
33
+ const result = fetch(source['POST http://petstore.swagger.io/login'], serverVariablesOptions, {
34
+ target: 'node',
35
+ client: 'fetch',
36
+ });
37
+ expect(result).toMatchSnapshot();
38
+ });
39
+ it('should handle MULTIPART with text but no params (serializedValue case)', () => {
40
+ const sourceWithMultipartText = {
41
+ method: 'post',
42
+ url: 'http://petstore.swagger.io/v2/pet',
43
+ httpVersion: 'HTTP/1.1',
44
+ cookies: [],
45
+ headers: [{ name: 'Content-Type', value: 'multipart/form-data' }],
46
+ queryString: [],
47
+ postData: {
48
+ mimeType: 'multipart/form-data',
49
+ text: '--boundary123\r\nContent-Disposition: form-data; name="field1"\r\n\r\nvalue1\r\n--boundary123\r\nContent-Disposition: form-data; name="field2"\r\n\r\nvalue2\r\n--boundary123--',
50
+ params: [],
51
+ },
52
+ headersSize: 0,
53
+ bodySize: 0,
54
+ securityOAuth2ExtraCalls: [],
55
+ pathParameters: {},
56
+ serverVariables: {},
57
+ queryObj: {},
58
+ headersObj: { 'Content-Type': 'multipart/form-data' },
59
+ cookiesObj: {},
60
+ allHeaders: { 'Content-Type': 'multipart/form-data' },
61
+ uriObj: {
62
+ protocol: 'http:',
63
+ slashes: true,
64
+ auth: null,
65
+ host: 'petstore.swagger.io',
66
+ port: null,
67
+ hostname: 'petstore.swagger.io',
68
+ hash: null,
69
+ search: '',
70
+ query: {},
71
+ pathname: '/v2/pet',
72
+ path: '/v2/pet',
73
+ href: 'http://petstore.swagger.io/v2/pet',
74
+ },
75
+ fullUrl: 'http://petstore.swagger.io/v2/pet',
76
+ };
77
+ const result = fetch(sourceWithMultipartText, originalOptions, {
78
+ target: 'node',
79
+ client: 'fetch',
80
+ });
81
+ expect(result).toMatchSnapshot();
82
+ });
83
+ });
84
+ });
85
+ //# sourceMappingURL=fetch.test.js.map
@@ -0,0 +1 @@
1
+ export { HTTPSnippet } from '../../../index.js';
@@ -0,0 +1,126 @@
1
+ export { HTTPSnippet } from '../../../index.js'; // we need to reexport it before to prevent circular ref issue
2
+ import curl from '../curl.js';
3
+ import { originalOptions, serverVariablesOptions, source } from '../../__mocks__/mock.js';
4
+ describe('#code-samples PHP lang', () => {
5
+ describe('handler', () => {
6
+ it('returns code API POST /pet', () => {
7
+ const result = curl(source['POST http://petstore.swagger.io/v2/pet'], originalOptions, {
8
+ target: 'php',
9
+ client: 'curl',
10
+ });
11
+ expect(result).toMatchSnapshot();
12
+ });
13
+ it('returns code with path parameters reserved (data) and not (petId) /pet/{petId}/uploadImage/{data}', () => {
14
+ const result = curl(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}'], originalOptions, { target: 'php', client: 'curl' });
15
+ expect(result).toMatchSnapshot();
16
+ });
17
+ it('returns code with one path parameter inside url /pet/{petId}/uploadImage', () => {
18
+ const result = curl(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage'], originalOptions, { target: 'php', client: 'curl' });
19
+ expect(result).toMatchSnapshot();
20
+ });
21
+ it('returns code with path parameter and query /pet/findByStatus/{id}?status=...', () => {
22
+ const result = curl(source['GET http://petstore.swagger.io/v2/pet/findByStatus/{id}'], originalOptions, { target: 'php', client: 'curl' });
23
+ expect(result).toMatchSnapshot();
24
+ });
25
+ it('should generate code with server variables', () => {
26
+ const result = curl(source['POST https://{customerId}.saas-app.com:{port}/v2'], serverVariablesOptions, { target: 'php', client: 'curl' });
27
+ expect(result).toMatchSnapshot();
28
+ });
29
+ it('should generate code with basic auth', () => {
30
+ const result = curl(source['POST http://petstore.swagger.io/login'], serverVariablesOptions, {
31
+ target: 'php',
32
+ client: 'curl',
33
+ });
34
+ expect(result).toMatchSnapshot();
35
+ });
36
+ it('should handle MULTIPART with text but no params (serializedValue case)', () => {
37
+ const sourceWithMultipartText = {
38
+ method: 'post',
39
+ url: 'http://petstore.swagger.io/v2/pet',
40
+ httpVersion: 'HTTP/1.1',
41
+ cookies: [],
42
+ headers: [{ name: 'Content-Type', value: 'multipart/form-data' }],
43
+ queryString: [],
44
+ postData: {
45
+ mimeType: 'multipart/form-data',
46
+ text: '--boundary123\r\nContent-Disposition: form-data; name="field1"\r\n\r\nvalue1\r\n--boundary123\r\nContent-Disposition: form-data; name="field2"\r\n\r\nvalue2\r\n--boundary123--',
47
+ params: [],
48
+ },
49
+ headersSize: 0,
50
+ bodySize: 0,
51
+ securityOAuth2ExtraCalls: [],
52
+ pathParameters: {},
53
+ serverVariables: {},
54
+ queryObj: {},
55
+ headersObj: { 'Content-Type': 'multipart/form-data' },
56
+ cookiesObj: {},
57
+ allHeaders: { 'Content-Type': 'multipart/form-data' },
58
+ uriObj: {
59
+ protocol: 'http:',
60
+ slashes: true,
61
+ auth: null,
62
+ host: 'petstore.swagger.io',
63
+ port: null,
64
+ hostname: 'petstore.swagger.io',
65
+ hash: null,
66
+ search: '',
67
+ query: {},
68
+ pathname: '/v2/pet',
69
+ path: '/v2/pet',
70
+ href: 'http://petstore.swagger.io/v2/pet',
71
+ },
72
+ fullUrl: 'http://petstore.swagger.io/v2/pet',
73
+ };
74
+ const result = curl(sourceWithMultipartText, originalOptions, {
75
+ target: 'php',
76
+ client: 'curl',
77
+ });
78
+ expect(result).toMatchSnapshot();
79
+ });
80
+ it('should handle URL_ENCODED with text but no params (serializedValue case)', () => {
81
+ const sourceWithUrlEncodedText = {
82
+ method: 'post',
83
+ url: 'http://petstore.swagger.io/v2/pet',
84
+ httpVersion: 'HTTP/1.1',
85
+ cookies: [],
86
+ headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }],
87
+ queryString: [],
88
+ postData: {
89
+ mimeType: 'application/x-www-form-urlencoded',
90
+ text: 'name=Museum+Visitor&value=premium&count=5',
91
+ params: [],
92
+ },
93
+ headersSize: 0,
94
+ bodySize: 0,
95
+ securityOAuth2ExtraCalls: [],
96
+ pathParameters: {},
97
+ serverVariables: {},
98
+ queryObj: {},
99
+ headersObj: { 'Content-Type': 'application/x-www-form-urlencoded' },
100
+ cookiesObj: {},
101
+ allHeaders: { 'Content-Type': 'application/x-www-form-urlencoded' },
102
+ uriObj: {
103
+ protocol: 'http:',
104
+ slashes: true,
105
+ auth: null,
106
+ host: 'petstore.swagger.io',
107
+ port: null,
108
+ hostname: 'petstore.swagger.io',
109
+ hash: null,
110
+ search: '',
111
+ query: {},
112
+ pathname: '/v2/pet',
113
+ path: '/v2/pet',
114
+ href: 'http://petstore.swagger.io/v2/pet',
115
+ },
116
+ fullUrl: 'http://petstore.swagger.io/v2/pet',
117
+ };
118
+ const result = curl(sourceWithUrlEncodedText, originalOptions, {
119
+ target: 'php',
120
+ client: 'curl',
121
+ });
122
+ expect(result).toMatchSnapshot();
123
+ });
124
+ });
125
+ });
126
+ //# sourceMappingURL=curl.test.js.map
@@ -0,0 +1 @@
1
+ export { HTTPSnippet } from '../../../index.js';
@@ -0,0 +1,105 @@
1
+ export { HTTPSnippet } from '../../../index.js'; // we need to reexport it before to prevent circular ref issue
2
+ import requests from '../requests.js';
3
+ import { originalOptions, serverVariablesOptions, source } from '../../__mocks__/mock.js';
4
+ describe('#code-samples Python', () => {
5
+ describe('handler', () => {
6
+ it('returns code API PUT /pet', () => {
7
+ const result = requests(source['PUT http://petstore.swagger.io/v2/pet'], originalOptions, {
8
+ target: 'python',
9
+ client: 'requests',
10
+ });
11
+ expect(result).toMatchSnapshot();
12
+ });
13
+ it('returns code with path parameters reserved (data) and not (petId) /pet/{petId}/uploadImage/{data}', () => {
14
+ const result = requests(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}'], originalOptions, { target: 'python', client: 'requests' });
15
+ expect(result).toMatchSnapshot();
16
+ });
17
+ it('returns code with one path parameter inside url /pet/{petId}/uploadImage', () => {
18
+ const result = requests(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage'], originalOptions, { target: 'python', client: 'requests' });
19
+ expect(result).toMatchSnapshot();
20
+ });
21
+ it('returns code with path parameter and query /pet/findByStatus/{id}?status=...', () => {
22
+ const result = requests(source['GET http://petstore.swagger.io/v2/pet/findByStatus/{id}'], originalOptions, { target: 'python', client: 'requests' });
23
+ expect(result).toMatchSnapshot();
24
+ });
25
+ it('should generate code with server variables', () => {
26
+ const result = requests(source['POST https://{customerId}.saas-app.com:{port}/v2'], serverVariablesOptions, {
27
+ target: 'python',
28
+ client: 'requests',
29
+ });
30
+ expect(result).toMatchSnapshot();
31
+ });
32
+ it('should generate code with basic auth', () => {
33
+ const result = requests(source['POST http://petstore.swagger.io/login'], serverVariablesOptions, {
34
+ target: 'python',
35
+ client: 'requests',
36
+ });
37
+ expect(result).toMatchSnapshot();
38
+ });
39
+ it('handles multipart form-data with multiple fields', () => {
40
+ const multipartSource = {
41
+ ...source['POST http://petstore.swagger.io/v2/uploadImage'],
42
+ postData: {
43
+ mimeType: 'multipart/form-data',
44
+ text: '',
45
+ params: [
46
+ { name: 'file', value: 'pet_image.png' },
47
+ { name: 'description', value: 'Pet photo' },
48
+ ],
49
+ },
50
+ };
51
+ const result = requests(multipartSource, originalOptions, {
52
+ target: 'python',
53
+ client: 'requests',
54
+ });
55
+ expect(result).toContain(`"file": "pet_image.png"`);
56
+ expect(result).toContain(`"description": "Pet photo"`);
57
+ expect(result).toMatchSnapshot();
58
+ });
59
+ it('should handle MULTIPART with text but no params (serializedValue case)', () => {
60
+ const sourceWithMultipartText = {
61
+ method: 'post',
62
+ url: 'http://petstore.swagger.io/v2/pet',
63
+ httpVersion: 'HTTP/1.1',
64
+ cookies: [],
65
+ headers: [{ name: 'Content-Type', value: 'multipart/form-data' }],
66
+ queryString: [],
67
+ postData: {
68
+ mimeType: 'multipart/form-data',
69
+ text: '--boundary123\r\nContent-Disposition: form-data; name="field1"\r\n\r\nvalue1\r\n--boundary123\r\nContent-Disposition: form-data; name="field2"\r\n\r\nvalue2\r\n--boundary123--',
70
+ params: [],
71
+ },
72
+ headersSize: 0,
73
+ bodySize: 0,
74
+ securityOAuth2ExtraCalls: [],
75
+ pathParameters: {},
76
+ serverVariables: {},
77
+ queryObj: {},
78
+ headersObj: { 'Content-Type': 'multipart/form-data' },
79
+ cookiesObj: {},
80
+ allHeaders: { 'Content-Type': 'multipart/form-data' },
81
+ uriObj: {
82
+ protocol: 'http:',
83
+ slashes: true,
84
+ auth: null,
85
+ host: 'petstore.swagger.io',
86
+ port: null,
87
+ hostname: 'petstore.swagger.io',
88
+ hash: null,
89
+ search: '',
90
+ query: {},
91
+ pathname: '/v2/pet',
92
+ path: '/v2/pet',
93
+ href: 'http://petstore.swagger.io/v2/pet',
94
+ },
95
+ fullUrl: 'http://petstore.swagger.io/v2/pet',
96
+ };
97
+ const result = requests(sourceWithMultipartText, originalOptions, {
98
+ target: 'python',
99
+ client: 'requests',
100
+ });
101
+ expect(result).toMatchSnapshot();
102
+ });
103
+ });
104
+ });
105
+ //# sourceMappingURL=requests.test.js.map
@@ -0,0 +1 @@
1
+ export { HTTPSnippet } from '../../../index.js';