@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,79 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { act, render } from '@testing-library/react';
3
+ import { MediaTypesSwitch } from '../MediaTypesSwitch.js';
4
+ import { getOperation } from '../../../models/index.js';
5
+ import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
6
+ import testDefinition from './fixtures/test-definition.json';
7
+ import { withTestProviders } from '../../../testProviders.js';
8
+ describe('Components', () => {
9
+ describe('MediaTypesSwitch', () => {
10
+ const options = normalizeOptions({});
11
+ const parser = new OpenAPIParser(testDefinition, undefined, options);
12
+ let operation;
13
+ beforeEach(() => {
14
+ operation = getOperation(parser, {
15
+ pointer: '#/paths/~1test/get',
16
+ pathName: '/test',
17
+ httpVerb: 'GET',
18
+ pathParameters: [],
19
+ pathServers: [],
20
+ isWebhook: false,
21
+ isAdditionalOperation: false,
22
+ ...testDefinition.paths['/test'].get,
23
+ }, undefined, options, '');
24
+ });
25
+ test('renders with default media type by default', () => {
26
+ const childrenFn = vi.fn((mimeType) => _jsxs(_Fragment, { children: ["children: ", mimeType.name] }));
27
+ const renderSelectFn = vi.fn(() => null);
28
+ const { getByText } = render(withTestProviders(_jsx(MediaTypesSwitch, { renderSelect: renderSelectFn, content: operation.requestBody?.content, children: childrenFn }), { definition: parser.definition }));
29
+ expect(renderSelectFn.mock.calls[0][0].options).toEqual([
30
+ { idx: 0, value: 'application/json' },
31
+ { idx: 1, value: 'application/xml' },
32
+ ]);
33
+ expect(getByText('children: application/json')).toBeInTheDocument();
34
+ });
35
+ test('withLabel renders label', () => {
36
+ const childrenFn = vi.fn((mimeType) => _jsxs(_Fragment, { children: ["children: ", mimeType.name] }));
37
+ const renderSelectFn = vi.fn(() => _jsx(_Fragment, { children: "dropdown" }));
38
+ const { getByText } = render(withTestProviders(_jsx(MediaTypesSwitch, { withLabel: true, renderSelect: renderSelectFn, content: operation.requestBody?.content, children: childrenFn }), { definition: parser.definition }));
39
+ expect(getByText('Content type')).toBeInTheDocument();
40
+ });
41
+ test('should try to restore scroll on switch', async () => {
42
+ const childrenFn = vi.fn((mimeType) => _jsxs(_Fragment, { children: ["children: ", mimeType.name] }));
43
+ const renderSelectFn = vi.fn(() => (_jsx(_Fragment, { children: "dropdown" })));
44
+ const { findByText, container } = render(withTestProviders(_jsx(MediaTypesSwitch, { withLabel: true, renderSelect: renderSelectFn, content: operation.requestBody?.content, children: childrenFn }), { definition: parser.definition }));
45
+ // Create a mock implementation of window.scrollBy
46
+ const scrollByMock = vi.fn();
47
+ Object.defineProperty(window, 'scrollBy', { value: scrollByMock });
48
+ const rectMock = vi.fn(() => {
49
+ return (rectMock.mock.calls.length > 1 ? { y: 150 } : { y: 100 });
50
+ });
51
+ vi.spyOn(container?.firstElementChild, 'getBoundingClientRect').mockImplementation(rectMock);
52
+ act(() => {
53
+ const selectProps = renderSelectFn.mock.calls[0][0];
54
+ selectProps.onChange(selectProps.options[1]);
55
+ });
56
+ await findByText('children: application/xml');
57
+ await new Promise((resolve) => setTimeout(resolve, 500)); // sleep
58
+ expect(rectMock).toHaveBeenCalledTimes(2);
59
+ expect(scrollByMock).toHaveBeenCalledWith(0, 50);
60
+ });
61
+ test('should not throw and render null for empty media types', () => {
62
+ const childrenFn = vi.fn((mimeType) => _jsxs(_Fragment, { children: ["children: ", mimeType.name] }));
63
+ const renderSelectFn = vi.fn(() => null);
64
+ const { container } = render(withTestProviders(_jsx(MediaTypesSwitch, { renderSelect: renderSelectFn,
65
+ // @ts-ignore invalid content shape
66
+ content: null, children: childrenFn }), { definition: parser.definition }));
67
+ expect(container.firstChild).toBeNull();
68
+ const { container: container2 } = render(withTestProviders(_jsx(MediaTypesSwitch, { renderSelect: renderSelectFn,
69
+ // @ts-expect-error invalid content shape
70
+ content: { mediaTypes: null }, children: childrenFn }), { definition: parser.definition }));
71
+ expect(container2.firstChild).toBeNull();
72
+ const { container: container3 } = render(withTestProviders(_jsx(MediaTypesSwitch, { renderSelect: renderSelectFn,
73
+ // @ts-expect-error invalid content shape
74
+ content: { mediaTypes: [] }, children: childrenFn }), { definition: parser.definition }));
75
+ expect(container3.firstChild).toBeNull();
76
+ });
77
+ });
78
+ });
79
+ //# sourceMappingURL=MediaTypesSwitch.test.js.map
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import { OperationItem } from '../OperationItem.js';
4
+ import { normalizeOptions } from '../../../services/index.js';
5
+ import spec from './fixtures/petstore.json';
6
+ import definition from './fixtures/operationDefinition.json';
7
+ import { environmentAtom } from '../../../jotai/app.js';
8
+ import { globalStoreAtom } from '../../../jotai/store.js';
9
+ import { allOperationsAtom } from '../../../jotai/replay.js';
10
+ import { MockIntersectionObserver } from './__mocks__/mock-intersection-observer.js';
11
+ import { TestBrowserRouter } from '../../../testProviders.js';
12
+ vi.mock('jotai', async () => ({
13
+ ...(await vi.importActual('jotai')),
14
+ useAtomValue: vi.fn((a) => {
15
+ if (a === globalStoreAtom) {
16
+ return {
17
+ parser: {
18
+ definition: spec,
19
+ },
20
+ options: normalizeOptions({
21
+ codeSamples: {
22
+ languages: [{ lang: 'curl', label: 'curl' }],
23
+ },
24
+ }),
25
+ };
26
+ }
27
+ if (a === environmentAtom) {
28
+ return [{}, ''];
29
+ }
30
+ if (a === allOperationsAtom) {
31
+ return [];
32
+ }
33
+ return {};
34
+ }),
35
+ useAtom: vi.fn((a) => {
36
+ if (a === environmentAtom) {
37
+ return [[{ server: {} }], vi.fn()];
38
+ }
39
+ return [
40
+ {
41
+ activeOneOf: { '/paths/~1pet/post': 0 },
42
+ requestValues: {},
43
+ request: { expandedFields: {} },
44
+ response: { expandedFields: {} },
45
+ activeLanguage: 'curl',
46
+ },
47
+ vi.fn(),
48
+ ];
49
+ }),
50
+ }));
51
+ describe('OperationItem', () => {
52
+ beforeAll(() => {
53
+ window.IntersectionObserver = MockIntersectionObserver;
54
+ });
55
+ it('should render badges with correct position', () => {
56
+ const { getByTestId } = render(_jsx(OperationItem, { item: {
57
+ operationDefinition: definition,
58
+ parent: undefined,
59
+ href: 'test',
60
+ } }), {
61
+ wrapper: TestBrowserRouter,
62
+ });
63
+ const parentElement = getByTestId('operation-item-header');
64
+ const childNodes = parentElement.childNodes;
65
+ expect(childNodes[1].textContent).toBe('Alpha');
66
+ expect(childNodes[3].textContent).toBe('Beta');
67
+ expect(childNodes[4].textContent).toBe('Gamma');
68
+ });
69
+ });
70
+ //# sourceMappingURL=OperationItem.test.js.map
@@ -0,0 +1,16 @@
1
+ export declare class MockIntersectionObserver {
2
+ readonly root: Element | Document | null;
3
+ readonly rootMargin: string;
4
+ readonly scrollMargin: string;
5
+ readonly thresholds: ReadonlyArray<number>;
6
+ private viewPort;
7
+ private entries;
8
+ private readonly callback;
9
+ constructor(callback: IntersectionObserverCallback, options?: IntersectionObserverInit);
10
+ private intersect;
11
+ isInViewPort(target: HTMLElement): boolean;
12
+ observe(target: HTMLElement): void;
13
+ unobserve(target: HTMLElement): void;
14
+ disconnect(): void;
15
+ takeRecords(): any[];
16
+ }
@@ -0,0 +1,42 @@
1
+ export class MockIntersectionObserver {
2
+ root;
3
+ rootMargin;
4
+ scrollMargin;
5
+ thresholds;
6
+ viewPort;
7
+ entries;
8
+ callback;
9
+ constructor(callback, options) {
10
+ this.viewPort = options?.root ? options.root : window;
11
+ this.entries = [];
12
+ this.root = null;
13
+ this.rootMargin = '0px';
14
+ this.scrollMargin = '';
15
+ this.thresholds = [1];
16
+ this.callback = callback;
17
+ this.viewPort.addEventListener('scroll', this.intersect);
18
+ }
19
+ intersect = () => {
20
+ this.entries.map((entry) => {
21
+ entry.isIntersecting = this.isInViewPort(entry.target);
22
+ });
23
+ this.callback(this.entries, this);
24
+ };
25
+ isInViewPort(target) {
26
+ return target.id !== 'toc-0';
27
+ }
28
+ observe(target) {
29
+ this.entries.push({ isIntersecting: false, target });
30
+ }
31
+ unobserve(target) {
32
+ this.entries = this.entries.filter((ob) => ob.target !== target);
33
+ }
34
+ disconnect() {
35
+ this.viewPort.removeEventListener('scroll', this.intersect);
36
+ this.entries = [];
37
+ }
38
+ takeRecords() {
39
+ return this.entries;
40
+ }
41
+ }
42
+ //# sourceMappingURL=mock-intersection-observer.js.map
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import { Overview } from '../Overview.js';
4
+ const mockTranslate = (key, defaultValue) => defaultValue || key;
5
+ describe('Overview', () => {
6
+ it('should render correctly with full data', () => {
7
+ const info = {
8
+ title: 'Test API',
9
+ version: '1.0.0',
10
+ description: 'Test description',
11
+ contact: {
12
+ name: 'Test Contact',
13
+ url: 'https://example.com',
14
+ email: 'test@example.com',
15
+ },
16
+ license: {
17
+ name: 'MIT',
18
+ url: 'https://opensource.org/licenses/MIT',
19
+ identifier: 'MIT',
20
+ },
21
+ termsOfService: 'https://example.com/terms',
22
+ };
23
+ const { container } = render(_jsx(Overview, { info: info, translate: mockTranslate }));
24
+ expect(container).toMatchSnapshot();
25
+ });
26
+ it('should render correctly with partial data', () => {
27
+ const info = {
28
+ title: 'Test API',
29
+ version: '1.0.0',
30
+ };
31
+ const { container } = render(_jsx(Overview, { info: info, translate: mockTranslate }));
32
+ expect(container).toMatchSnapshot();
33
+ });
34
+ it('should render correctly with contact data but without a name', () => {
35
+ const info = {
36
+ title: 'Test API',
37
+ version: '1.0.0',
38
+ contact: {
39
+ url: 'https://example.com',
40
+ email: 'test@example.com',
41
+ },
42
+ };
43
+ const { container } = render(_jsx(Overview, { info: info, translate: mockTranslate }));
44
+ expect(container).toMatchSnapshot();
45
+ });
46
+ it('should render license with name and url when identifier is not present', () => {
47
+ const info = {
48
+ title: 'Test API',
49
+ version: '1.0.0',
50
+ license: {
51
+ name: 'Apache 2.0',
52
+ url: 'https://www.apache.org/licenses/LICENSE-2.0.html',
53
+ },
54
+ };
55
+ const { container } = render(_jsx(Overview, { info: info, translate: mockTranslate }));
56
+ expect(container).toMatchSnapshot();
57
+ });
58
+ });
59
+ //# sourceMappingURL=Overview.test.js.map
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import * as Jotai from 'jotai';
4
+ import { Example } from '../Example.js';
5
+ import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
6
+ import { getExamples } from '../../../models/index.js';
7
+ import testDefinition from './fixtures/mediaTypeUrlencoded.json';
8
+ describe('Example component', () => {
9
+ const opts = normalizeOptions({});
10
+ const parser = new OpenAPIParser(testDefinition, undefined, opts);
11
+ it('render component without error when `externalValue` is pdf file', () => {
12
+ const example = getExamples({
13
+ parser,
14
+ infoOrRef: {
15
+ summary: 'A sample file',
16
+ externalValue: 'https://assets.identi.tech/dummy.pdf',
17
+ },
18
+ mime: 'application/pdf',
19
+ });
20
+ const { container } = render(_jsx(Jotai.Provider, { children: _jsx(Example, { example: example, mimeType: example.mime, onCopyClick: vi.fn() }) }));
21
+ expect(container).toMatchSnapshot();
22
+ });
23
+ it('render component with `externalValue`', () => {
24
+ const example = getExamples({
25
+ parser,
26
+ infoOrRef: {
27
+ summary: 'A sample json',
28
+ externalValue: 'https://jsonplaceholder.typicode.com/todos/1',
29
+ },
30
+ mime: 'application/json',
31
+ });
32
+ const { container } = render(_jsx(Jotai.Provider, { children: _jsx(Example, { example: example, mimeType: example.mime, onCopyClick: vi.fn() }) }));
33
+ expect(container).toMatchSnapshot();
34
+ });
35
+ });
36
+ //# sourceMappingURL=Example.test.js.map
@@ -0,0 +1,197 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import { vi } from 'vitest';
4
+ import * as Jotai from 'jotai';
5
+ import { ExampleValue } from '../ExampleValue.js';
6
+ import { globalOptionsAtom } from '../../../jotai/store.js';
7
+ import { normalizeOptions } from '../../../services/index.js';
8
+ vi.mock('@redocly/theme/components/JsonViewer/JsonViewer', () => ({
9
+ JsonViewer: vi.fn(({ data, expandLevel, onCopyClick, onPanelToggle }) => (_jsxs("div", { "data-testid": "json-viewer", "data-expand-level": expandLevel, children: [_jsx("pre", { "data-testid": "json-viewer-data", children: JSON.stringify(data, null, 2) }), onCopyClick && _jsx("button", { "data-testid": "copy-button", onClick: onCopyClick }), onPanelToggle && _jsx("button", { "data-testid": "panel-toggle", onClick: () => onPanelToggle(true) })] }))),
10
+ }));
11
+ vi.mock('../styled.js', () => ({
12
+ StyledCodeBlock: vi.fn(({ source, lang, header }) => (_jsxs("div", { "data-testid": "code-block", "data-lang": lang, children: [_jsx("pre", { children: source }), header?.controls?.copy && (_jsx("button", { "data-testid": "code-block-copy", onClick: header.controls.copy.onClick }))] }))),
13
+ }));
14
+ vi.mock('jotai', async () => {
15
+ const actual = await vi.importActual('jotai');
16
+ return {
17
+ ...actual,
18
+ useAtomValue: vi.fn(),
19
+ };
20
+ });
21
+ describe('ExampleValue', () => {
22
+ const mockUseAtomValue = Jotai.useAtomValue;
23
+ const options = normalizeOptions({});
24
+ beforeEach(async () => {
25
+ vi.clearAllMocks();
26
+ const actualJotai = await vi.importActual('jotai');
27
+ mockUseAtomValue.mockImplementation((atom) => {
28
+ if (atom === globalOptionsAtom) {
29
+ return {
30
+ ...options,
31
+ jsonSamplesExpandLevel: 2,
32
+ };
33
+ }
34
+ return actualJotai.useAtomValue(atom);
35
+ });
36
+ });
37
+ describe('JSON parsing for application/json', () => {
38
+ it('should parse valid JSON string and pass parsed object to JsonViewer', () => {
39
+ const validJsonString = '{"name":"Test User","value":"premium","count":5}';
40
+ const props = {
41
+ value: validJsonString,
42
+ mimeType: 'application/json',
43
+ onCopyClick: vi.fn(),
44
+ };
45
+ const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
46
+ const jsonData = getByTestId('json-viewer-data');
47
+ const parsedData = JSON.parse(jsonData.textContent || '{}');
48
+ expect(parsedData).toEqual({
49
+ name: 'Test User',
50
+ value: 'premium',
51
+ count: 5,
52
+ });
53
+ });
54
+ it('should use value as-is when it is already an object (not a string)', () => {
55
+ const objectValue = { name: 'Test User', value: 'premium', count: 5 };
56
+ const props = {
57
+ value: objectValue,
58
+ mimeType: 'application/json',
59
+ onCopyClick: vi.fn(),
60
+ };
61
+ const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
62
+ const jsonData = getByTestId('json-viewer-data');
63
+ const parsedData = JSON.parse(jsonData.textContent || '{}');
64
+ expect(parsedData).toEqual(objectValue);
65
+ });
66
+ it('should fallback to original value when JSON string is invalid', () => {
67
+ const invalidJsonString = '{"name":"Test User",invalid json}';
68
+ const props = {
69
+ value: invalidJsonString,
70
+ mimeType: 'application/json',
71
+ onCopyClick: vi.fn(),
72
+ };
73
+ const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
74
+ const jsonData = getByTestId('json-viewer-data');
75
+ const parsedData = JSON.parse(jsonData.textContent || '');
76
+ expect(parsedData).toBe(invalidJsonString);
77
+ });
78
+ });
79
+ describe('XML handling for application/xml', () => {
80
+ it('should wrap object in root tag and convert to XML (dataValue case)', () => {
81
+ const objectValue = { name: 'Test User', value: 'premium' };
82
+ const props = {
83
+ value: objectValue,
84
+ mimeType: 'application/xml',
85
+ onCopyClick: vi.fn(),
86
+ };
87
+ const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
88
+ const codeBlock = getByTestId('code-block');
89
+ const source = codeBlock.querySelector('pre')?.textContent || '';
90
+ expect(source).toContain('<root>');
91
+ expect(source).toContain('<name>Test User</name>');
92
+ expect(source).toContain('<value>premium</value>');
93
+ expect(source).toContain('</root>');
94
+ });
95
+ it('should not wrap array in root tag for XML', () => {
96
+ const arrayValue = [{ item: 'one' }, { item: 'two' }];
97
+ const props = {
98
+ value: arrayValue,
99
+ mimeType: 'application/xml',
100
+ onCopyClick: vi.fn(),
101
+ };
102
+ const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
103
+ const codeBlock = getByTestId('code-block');
104
+ const source = codeBlock.querySelector('pre')?.textContent || '';
105
+ expect(source).not.toContain('<root>');
106
+ expect(source).toContain('<item>one</item>');
107
+ expect(source).toContain('<item>two</item>');
108
+ });
109
+ it('should render pre-built XML string from sampler with attributes (nodeType: attribute)', () => {
110
+ const xmlString = '<Artifact catalogId="ART-2024-001">\n <title>Mona Lisa</title>\n</Artifact>';
111
+ const props = {
112
+ value: xmlString,
113
+ mimeType: 'application/xml',
114
+ onCopyClick: vi.fn(),
115
+ };
116
+ const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
117
+ const codeBlock = getByTestId('code-block');
118
+ const source = codeBlock.querySelector('pre')?.textContent || '';
119
+ expect(source).toContain('catalogId="ART-2024-001"');
120
+ expect(source).toContain('<title>Mona Lisa</title>');
121
+ });
122
+ it('should render pre-built XML string with text nodes (nodeType: text)', () => {
123
+ const xmlString = '<Artifact>\n <title>Mona Lisa</title>\nPortrait painting by Leonardo da Vinci</Artifact>';
124
+ const props = {
125
+ value: xmlString,
126
+ mimeType: 'application/xml',
127
+ onCopyClick: vi.fn(),
128
+ };
129
+ const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
130
+ const codeBlock = getByTestId('code-block');
131
+ const source = codeBlock.querySelector('pre')?.textContent || '';
132
+ expect(source).toContain('Portrait painting by Leonardo da Vinci');
133
+ expect(source).toContain('<title>Mona Lisa</title>');
134
+ });
135
+ it('should render pre-built XML string with CDATA (nodeType: cdata)', () => {
136
+ const xmlString = '<Documentation>\n <![CDATA[<html><head><title>Docs</title></head></html>]]>\n</Documentation>';
137
+ const props = {
138
+ value: xmlString,
139
+ mimeType: 'application/xml',
140
+ onCopyClick: vi.fn(),
141
+ };
142
+ const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
143
+ const codeBlock = getByTestId('code-block');
144
+ const source = codeBlock.querySelector('pre')?.textContent || '';
145
+ expect(source).toContain('<![CDATA[');
146
+ expect(source).toContain('<html><head><title>Docs</title></head></html>');
147
+ expect(source).toContain(']]>');
148
+ });
149
+ it('should render pre-built XML string with all nodeTypes combined (sampler output)', () => {
150
+ const xmlString = [
151
+ '<Artifact catalogId="ART-2024-001" era="Renaissance">',
152
+ ' <title>Mona Lisa</title>',
153
+ 'Portrait painting by Leonardo da Vinci',
154
+ ' <![CDATA[<note>Handle with <b>extreme</b> care</note>]]>',
155
+ ' <artists>',
156
+ ' <Artist role="painter">',
157
+ ' <name>Leonardo da Vinci</name>',
158
+ ' </Artist>',
159
+ ' </artists>',
160
+ '</Artifact>',
161
+ ].join('\n');
162
+ const props = {
163
+ value: xmlString,
164
+ mimeType: 'application/xml',
165
+ onCopyClick: vi.fn(),
166
+ };
167
+ const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
168
+ const codeBlock = getByTestId('code-block');
169
+ const source = codeBlock.querySelector('pre')?.textContent || '';
170
+ expect(source).toContain('catalogId="ART-2024-001"');
171
+ expect(source).toContain('era="Renaissance"');
172
+ expect(source).toContain('<title>Mona Lisa</title>');
173
+ expect(source).toContain('Portrait painting by Leonardo da Vinci');
174
+ expect(source).toContain('<![CDATA[<note>Handle with <b>extreme</b> care</note>]]>');
175
+ expect(source).not.toContain('internalCode');
176
+ expect(source).not.toContain('INT-7742-X');
177
+ });
178
+ it('should convert JS object to XML with CDATA support via xmlBuilder', () => {
179
+ const objectValue = {
180
+ Documentation: {
181
+ '#cdata': '<html><head><title>Docs</title></head></html>',
182
+ },
183
+ };
184
+ const props = {
185
+ value: objectValue,
186
+ mimeType: 'application/xml',
187
+ onCopyClick: vi.fn(),
188
+ };
189
+ const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
190
+ const codeBlock = getByTestId('code-block');
191
+ const source = codeBlock.querySelector('pre')?.textContent || '';
192
+ expect(source).toContain('<![CDATA[');
193
+ expect(source).toContain(']]>');
194
+ });
195
+ });
196
+ });
197
+ //# sourceMappingURL=ExampleValue.test.js.map
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
4
+ import { getMediaContent, getOperation } from '../../../models/index.js';
5
+ import { withTestProviders } from '../../../testProviders.js';
6
+ import { PayloadSamples } from '../PayloadSamples.js';
7
+ import testDefinition from './fixtures/mediaTypeUrlencoded.json';
8
+ describe('PayloadSamples', () => {
9
+ let operation;
10
+ const options = normalizeOptions({});
11
+ const parser = new OpenAPIParser(testDefinition, undefined, options);
12
+ test('should renders correctly without example to application/x-www-form-urlencoded', async () => {
13
+ operation = getOperation(parser, {
14
+ pointer: '#/paths/~1test/get',
15
+ pathName: '/test',
16
+ httpVerb: 'GET',
17
+ pathParameters: [],
18
+ pathServers: [],
19
+ isWebhook: false,
20
+ isAdditionalOperation: false,
21
+ ...testDefinition.paths['/test'].get,
22
+ }, undefined, options, 'tests');
23
+ const props = {
24
+ operation,
25
+ content: getMediaContent({
26
+ parser,
27
+ info: testDefinition.paths['/test'].get.requestBody.content,
28
+ isRequestType: true,
29
+ options,
30
+ data: { operation },
31
+ }),
32
+ onCopyClick: vi.fn(),
33
+ };
34
+ const { container } = render(withTestProviders(_jsx(PayloadSamples, { ...props }), { definition: parser.definition }));
35
+ expect(container).toHaveTextContent(/name=string&status=string/);
36
+ });
37
+ });
38
+ //# sourceMappingURL=PayloadSamples.test.js.map
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import * as Jotai from 'jotai';
4
+ import { Extensions } from '../Extensions.js';
5
+ import { normalizeOptions } from '../../../services/index.js';
6
+ vi.mock('jotai', async () => ({
7
+ ...(await vi.importActual('jotai')),
8
+ useAtomValue: vi.fn(),
9
+ }));
10
+ describe('Components', () => {
11
+ describe('Extensions', () => {
12
+ it('Extensions label renders correctly', () => {
13
+ vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({
14
+ showExtensions: true,
15
+ }));
16
+ const { container } = render(_jsx(Extensions, { extensions: { 'x-test': 'Add new pet to the store inventory' } }));
17
+ expect(container).toHaveTextContent(/test: Add new pet to the store inventory/);
18
+ });
19
+ });
20
+ });
21
+ //# sourceMappingURL=Extensions.test.js.map
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import { FieldDetail } from '../FieldDetail.js';
4
+ describe('FieldDetail', () => {
5
+ const wrapper = (label, value) => render(_jsx(FieldDetail, { label: label, value: value }));
6
+ it('should render with DefaultValue component', () => {
7
+ const { getByText } = wrapper('Default', 'value');
8
+ expect(getByText('"value"')).toBeInTheDocument();
9
+ expect(getByText('Default')).toBeInTheDocument();
10
+ });
11
+ it('should render with ExampleValue component', () => {
12
+ const { getByText } = wrapper('Example:', 'value');
13
+ expect(getByText('"value"')).toBeInTheDocument();
14
+ expect(getByText('Example:')).toBeInTheDocument();
15
+ });
16
+ it('should render FieldValueLabel in all other cases', () => {
17
+ const { getByText } = wrapper('Deprecated', 'value');
18
+ expect(getByText('"value"')).toBeInTheDocument();
19
+ expect(getByText('Deprecated')).toBeInTheDocument();
20
+ });
21
+ describe('example type with structured values', () => {
22
+ const objectValue = {
23
+ name: 'John Alfred Smith',
24
+ street: '123 Main Street',
25
+ city: 'San Francisco',
26
+ };
27
+ it('should render object example pretty-printed with JSON highlighting', () => {
28
+ const { getByTestId, getByText } = render(_jsx(FieldDetail, { label: "Example:", value: objectValue, type: "example" }));
29
+ expect(getByText('Example:')).toBeInTheDocument();
30
+ const viewer = getByTestId('json-viewer');
31
+ // pretty-printed: keys and values are separate tokens on multiple lines,
32
+ // not a single-line JSON.stringify blob
33
+ expect(viewer.textContent).toContain('"name"');
34
+ expect(viewer.textContent).toContain('"John Alfred Smith"');
35
+ expect(viewer.textContent).toContain('\n');
36
+ // syntax highlighting: token spans styled by the code theme
37
+ expect(viewer.querySelector('.token.string')).not.toBeNull();
38
+ });
39
+ it('should render array example pretty-printed with JSON highlighting', () => {
40
+ const { getByTestId } = render(_jsx(FieldDetail, { label: "Example:", value: ['79f943e212cce7de21c054a8'], type: "example" }));
41
+ const viewer = getByTestId('json-viewer');
42
+ expect(viewer.textContent).toContain('"79f943e212cce7de21c054a8"');
43
+ expect(viewer.querySelector('.token.string')).not.toBeNull();
44
+ });
45
+ it('should keep scalar example values inline without JSON viewer', () => {
46
+ const { getByText, queryByTestId } = render(_jsx(FieldDetail, { label: "Example:", value: "HRIS-27", type: "example" }));
47
+ expect(getByText('"HRIS-27"')).toBeInTheDocument();
48
+ expect(queryByTestId('json-viewer')).toBeNull();
49
+ });
50
+ });
51
+ });
52
+ //# sourceMappingURL=FieldDetail.test.js.map