@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,115 @@
1
+ export const examples = {
2
+ cat: {
3
+ mime: 'application/json',
4
+ value: {
5
+ category: {
6
+ name: 'string',
7
+ sub: {
8
+ prop1: 'string',
9
+ },
10
+ },
11
+ name: 'Guru',
12
+ photoUrls: ['string'],
13
+ friend: {},
14
+ tags: [
15
+ {
16
+ name: 'string',
17
+ },
18
+ ],
19
+ cvv_check: 'string',
20
+ status: 'available',
21
+ petType: 'cat',
22
+ huntingSkill: 'adventurous',
23
+ },
24
+ rawValue: {},
25
+ },
26
+ dog: {
27
+ mime: 'application/json',
28
+ value: {
29
+ category: {
30
+ name: 'string',
31
+ sub: {
32
+ prop1: 'string',
33
+ },
34
+ },
35
+ name: 'Guru',
36
+ photoUrls: ['string'],
37
+ friend: {},
38
+ tags: [
39
+ {
40
+ name: 'string',
41
+ },
42
+ ],
43
+ cvv_check: 'string',
44
+ status: 'available',
45
+ petType: 'dog',
46
+ packSize: 1,
47
+ },
48
+ rawValue: {},
49
+ },
50
+ bee: {
51
+ mime: 'application/json',
52
+ value: {
53
+ category: {
54
+ name: 'string',
55
+ sub: {
56
+ prop1: 'string',
57
+ },
58
+ },
59
+ name: 'Guru',
60
+ photoUrls: ['string'],
61
+ friend: {},
62
+ tags: [
63
+ {
64
+ name: 'string',
65
+ },
66
+ ],
67
+ cvv_check: 'string',
68
+ status: 'available',
69
+ petType: 'bee',
70
+ honeyPerDay: 3.14,
71
+ },
72
+ rawValue: {},
73
+ },
74
+ };
75
+ export const examplesJSON = {
76
+ foo: {
77
+ mime: 'application/json',
78
+ value: {
79
+ foo: 'bar',
80
+ },
81
+ rawValue: {
82
+ foo: 'bar',
83
+ },
84
+ summary: 'A foo example',
85
+ },
86
+ bar: {
87
+ mime: 'application/json',
88
+ value: {
89
+ bar: 'baz',
90
+ },
91
+ rawValue: {
92
+ bar: 'baz',
93
+ },
94
+ summary: 'A bar example',
95
+ },
96
+ };
97
+ export const exampleXML = {
98
+ xmlExample: {
99
+ rawValue: undefined,
100
+ value: undefined,
101
+ mime: 'application/xml',
102
+ summary: 'This is an example in XML',
103
+ },
104
+ foo: {
105
+ mime: 'application/xml',
106
+ value: {
107
+ foo: 'bar',
108
+ },
109
+ rawValue: {
110
+ foo: 'bar',
111
+ },
112
+ summary: 'A foo example',
113
+ },
114
+ };
115
+ //# sourceMappingURL=examples.js.map
@@ -1,4 +1,4 @@
1
- import{jsx as c}from"react/jsx-runtime";import{css as p}from"styled-components";import{useLocation as l}from"react-router-dom";import{LinkIcon as r}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{encodeBackSlashes as m}from"../../utils/string.js";import{constructFieldDeepFragment as d,joinWithSeparator as n}from"../../services/history/helpers.js";import{ShareLink as f}from"./linkify.js";import{styled as h}from"../../styled-components.js";function F(i,s){const o=i.deps.operation,e=d(i,s);if(!o?.id&&!o.isCallback)return"#"+e.toLowerCase();const t=n(o.href,n(o.id,e),"#");return m(t.toLowerCase())}const S=({to:i,className:s})=>{const o=i,e=l(),t=o?.split("#")[1],a=e?e.hash===`#${t}`:!1;return c(k,{ariaLabel:`link to ${o}`,className:s,isActive:a,to:o,id:t})},k=h(f)`
1
+ import{jsx as c}from"react/jsx-runtime";import{css as p}from"styled-components";import{useLocation as l}from"react-router";import{LinkIcon as r}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{encodeBackSlashes as m}from"../../utils/string.js";import{constructFieldDeepFragment as d,joinWithSeparator as n}from"../../services/history/helpers.js";import{ShareLink as f}from"./linkify.js";import{styled as h}from"../../styled-components.js";function F(i,s){const o=i.deps.operation,e=d(i,s);if(!o?.id&&!o.isCallback)return"#"+e.toLowerCase();const t=n(o.href,n(o.id,e),"#");return m(t.toLowerCase())}const S=({to:i,className:s})=>{const o=i,e=l(),t=o?.split("#")[1],a=e?e.hash===`#${t}`:!1;return c(k,{ariaLabel:`link to ${o}`,className:s,isActive:a,to:o,id:t})},k=h(f)`
2
2
  display: flex;
3
3
  ${r} {
4
4
  visibility: hidden;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,129 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, fireEvent, screen } from '@testing-library/react';
3
+ import { Dropdown } from '../Dropdown/index.js';
4
+ describe('DropdownComponent', () => {
5
+ const options = [
6
+ { value: 'option1', label: 'Option 1' },
7
+ { value: 'option2', label: 'Option 2' },
8
+ { value: 'option3', label: 'Option 3' },
9
+ ];
10
+ const value = 'option1';
11
+ const onChange = vi.fn();
12
+ const defaultProps = {
13
+ options,
14
+ value,
15
+ onChange,
16
+ className: 'custom-dropdown',
17
+ };
18
+ beforeEach(() => {
19
+ vi.clearAllMocks();
20
+ });
21
+ it('renders dropdown options correctly', () => {
22
+ const { getAllByText, getByRole } = render(_jsx(Dropdown, { ...defaultProps }));
23
+ fireEvent.click(getByRole('button'));
24
+ options.forEach((option) => {
25
+ const elements = getAllByText(option.label);
26
+ expect(elements.length).toBeGreaterThan(0);
27
+ });
28
+ });
29
+ it('calls onChange callback when an option is clicked', () => {
30
+ const { getByText, getByRole } = render(_jsx(Dropdown, { ...defaultProps }));
31
+ fireEvent.click(getByRole('button'));
32
+ fireEvent.click(getByText('Option 2'));
33
+ expect(onChange).toHaveBeenCalledWith(options[1]);
34
+ });
35
+ it('calls onChange callback when Enter key is pressed on an option', () => {
36
+ const { getByText, getByRole } = render(_jsx(Dropdown, { ...defaultProps }));
37
+ fireEvent.click(getByRole('button'));
38
+ fireEvent.keyDown(getByText('Option 3'), { key: 'Enter' });
39
+ expect(onChange).toHaveBeenCalledWith(options[2]);
40
+ });
41
+ it('renders title correctly', () => {
42
+ const { getAllByText } = render(_jsx(Dropdown, { ...defaultProps }));
43
+ expect(getAllByText('Option 1')[0]).toBeInTheDocument();
44
+ });
45
+ it('renders title when there is only one option', () => {
46
+ const singleOption = [{ value: 'option1', label: 'Option 1' }];
47
+ const singleOptionProps = {
48
+ options: singleOption,
49
+ value: 'option1',
50
+ onChange,
51
+ className: 'custom-dropdown',
52
+ };
53
+ const { getByText } = render(_jsx(Dropdown, { ...singleOptionProps }));
54
+ expect(getByText('Option 1')).toBeInTheDocument();
55
+ });
56
+ describe('search functionality (auto-enabled with 7+ options)', () => {
57
+ const searchOptions = [
58
+ { value: 'apple', label: 'Apple' },
59
+ { value: 'banana', label: 'Banana' },
60
+ { value: 'cherry', label: 'Cherry' },
61
+ { value: 'date', label: 'Date' },
62
+ { value: 'elderberry', label: 'Elderberry' },
63
+ { value: 'fig', label: 'Fig' },
64
+ { value: 'grape', label: 'Grape' },
65
+ ];
66
+ const searchProps = {
67
+ options: searchOptions,
68
+ value: 'apple',
69
+ onChange,
70
+ };
71
+ it('renders search input when there are 7 or more options', () => {
72
+ render(_jsx(Dropdown, { ...searchProps }));
73
+ fireEvent.click(screen.getByRole('button'));
74
+ const searchInput = screen.getByPlaceholderText('Search items');
75
+ expect(searchInput).toBeInTheDocument();
76
+ });
77
+ it('does not render search input when there are fewer than 7 options', () => {
78
+ render(_jsx(Dropdown, { ...defaultProps }));
79
+ fireEvent.click(screen.getByRole('button'));
80
+ const searchInput = screen.queryByPlaceholderText('Search items');
81
+ expect(searchInput).not.toBeInTheDocument();
82
+ });
83
+ it('filters options based on search input', () => {
84
+ render(_jsx(Dropdown, { ...searchProps }));
85
+ fireEvent.click(screen.getByRole('button'));
86
+ const searchInput = screen.getByPlaceholderText('Search items');
87
+ fireEvent.change(searchInput, { target: { value: 'an' } });
88
+ const menu = screen.getByTestId('dropdown-menu');
89
+ expect(menu).toHaveTextContent('Banana');
90
+ const menuItems = screen.getAllByRole('menuitem');
91
+ const menuItemTexts = menuItems.map((item) => item.textContent);
92
+ expect(menuItemTexts.some((text) => text?.includes('Banana'))).toBe(true);
93
+ expect(menuItemTexts.filter((text) => text?.includes('Cherry'))).toHaveLength(0);
94
+ });
95
+ it('filters options case-insensitively', () => {
96
+ render(_jsx(Dropdown, { ...searchProps }));
97
+ fireEvent.click(screen.getByRole('button'));
98
+ const searchInput = screen.getByPlaceholderText('Search items');
99
+ fireEvent.change(searchInput, { target: { value: 'banana' } });
100
+ const menu = screen.getByTestId('dropdown-menu');
101
+ expect(menu).toHaveTextContent('Banana');
102
+ const menuItems = screen.getAllByRole('menuitem');
103
+ const fruitItems = menuItems.filter((item) => !item.querySelector('input'));
104
+ expect(fruitItems).toHaveLength(1);
105
+ expect(fruitItems[0]).toHaveTextContent('Banana');
106
+ });
107
+ it('shows "No items found" when no options match search', () => {
108
+ render(_jsx(Dropdown, { ...searchProps }));
109
+ fireEvent.click(screen.getByRole('button'));
110
+ const searchInput = screen.getByPlaceholderText('Search items');
111
+ fireEvent.change(searchInput, { target: { value: 'xyz' } });
112
+ expect(screen.getByText('No items found')).toBeInTheDocument();
113
+ const menuItems = screen.getAllByRole('menuitem');
114
+ const fruitItems = menuItems.filter((item) => !item.querySelector('input') && !item.textContent?.includes('No items found'));
115
+ expect(fruitItems).toHaveLength(0);
116
+ });
117
+ it('handles empty search input correctly', () => {
118
+ render(_jsx(Dropdown, { ...searchProps }));
119
+ fireEvent.click(screen.getByRole('button'));
120
+ const searchInput = screen.getByPlaceholderText('Search items');
121
+ fireEvent.change(searchInput, { target: { value: '' } });
122
+ const menu = screen.getByTestId('dropdown-menu');
123
+ searchOptions.forEach((option) => {
124
+ expect(menu).toHaveTextContent(option.label);
125
+ });
126
+ });
127
+ });
128
+ });
129
+ //# sourceMappingURL=Dropdown.test.js.map
@@ -0,0 +1,39 @@
1
+ import { generateDeepLink } from '../LinkToField.js';
2
+ import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
3
+ import { getField } from '../../../models/index.js';
4
+ import spec from './fixtures/simpleOpenAPI.json';
5
+ const options = normalizeOptions({});
6
+ describe('generateDeepLink', () => {
7
+ const parser = new OpenAPIParser(spec, undefined, options);
8
+ const deps = {
9
+ type: 'request',
10
+ operation: {
11
+ id: 'paths/~1pets/post',
12
+ pointer: '/paths/~1pets/post',
13
+ href: '/paths/~1pets/post',
14
+ },
15
+ };
16
+ const field = getField(parser, {
17
+ name: 'name',
18
+ required: false,
19
+ schema: {
20
+ type: 'string',
21
+ },
22
+ }, '/properties/name', options, deps);
23
+ it('generates a deep link for a field without an operation', () => {
24
+ const field = getField(parser, {
25
+ name: 'name',
26
+ required: false,
27
+ schema: {
28
+ type: 'string',
29
+ },
30
+ }, '/properties/name', options, { ...deps, operation: {} });
31
+ const deepLink = generateDeepLink(field);
32
+ expect(deepLink).toBe('#t=request&path=name');
33
+ });
34
+ it('generates a deep link with the default deepLinkPrefix', () => {
35
+ const deepLink = generateDeepLink(field);
36
+ expect(deepLink).toBe('/paths/~1pets/post#paths/~1pets/post/t=request&path=name');
37
+ });
38
+ });
39
+ //# sourceMappingURL=LinkToField.test.js.map
@@ -1,4 +1,4 @@
1
- import{jsx as a,jsxs as c}from"react/jsx-runtime";import{useAtomValue as m}from"jotai";import{Link as h}from"react-router-dom";import{LinkIcon as o}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{globalOptionsAtom as d}from"../../jotai/store.js";import{tryDecodeURIComponent as f}from"../../utils/index.js";import{styled as k}from"../../styled-components.js";import{joinWithSeparator as e}from"../../services/history/helpers.js";function u(i){const{routingBasePath:n,onDeepLinkClick:r}=m(d),t=i.to,l=r&&{onClick:s=>{s.preventDefault(),r(e(n||"",t))}};return t?a(h,{"aria-label":i["aria-label"]||`link to ${t}`,id:f(i.id||""),className:i.className||"",to:t?.startsWith("#")?t:e(n||"",t),...l,children:i.children}):i.children?c("span",{"aria-label":i["aria-label"]||`link to ${t}`,className:i.className,children:[" ",i.children," "]}):null}const b=k(u)`
1
+ import{jsx as a,jsxs as c}from"react/jsx-runtime";import{useAtomValue as m}from"jotai";import{Link as h}from"react-router";import{LinkIcon as o}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{globalOptionsAtom as d}from"../../jotai/store.js";import{tryDecodeURIComponent as f}from"../../utils/index.js";import{styled as k}from"../../styled-components.js";import{joinWithSeparator as e}from"../../services/history/helpers.js";function u(i){const{routingBasePath:n,onDeepLinkClick:r}=m(d),t=i.to,l=r&&{onClick:s=>{s.preventDefault(),r(e(n||"",t))}};return t?a(h,{"aria-label":i["aria-label"]||`link to ${t}`,id:f(i.id||""),className:i.className||"",to:t?.startsWith("#")?t:e(n||"",t),...l,children:i.children}):i.children?c("span",{"aria-label":i["aria-label"]||`link to ${t}`,className:i.className,children:[" ",i.children," "]}):null}const b=k(u)`
2
2
  position: absolute;
3
3
  top: 50%;
4
4
  left: 0;
@@ -1 +1 @@
1
- import{BrowserRouter as s,HashRouter as a,MemoryRouter as n}from"react-router-dom";const m={history:s,memory:n,hash:a},R=(e,o)=>{const r=m[e],t={...e!=="memory"&&{basename:o,feature:{v7_startTransition:!1,v7_relativeSplatPath:!1}}};return{Router:r,routerProps:t}};export{R as useRouter};
1
+ import{BrowserRouter as s,HashRouter as a,MemoryRouter as n}from"react-router";const m={history:s,memory:n,hash:a},R=(e,o)=>{const r=m[e],t={...e!=="memory"&&{basename:o,feature:{v7_startTransition:!1,v7_relativeSplatPath:!1}}};return{Router:r,routerProps:t}};export{R as useRouter};
@@ -1 +1 @@
1
- import{useEffect as t}from"react";import{useLocation as o,useNavigate as r}from"react-router-dom";function p(){const a=r(),e=o();t(()=>{e.pathname.toLowerCase()!==e.pathname&&a(e.pathname.toLowerCase(),{replace:!0})},[e.pathname,a])}export{p as useUppercase2LowercaseRedirect};
1
+ import{useEffect as t}from"react";import{useLocation as o,useNavigate as r}from"react-router";function p(){const a=r(),e=o();t(()=>{e.pathname.toLowerCase()!==e.pathname&&a(e.pathname.toLowerCase(),{replace:!0})},[e.pathname,a])}export{p as useUppercase2LowercaseRedirect};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,53 @@
1
+ import { act, renderHook } from '@testing-library/react';
2
+ import { useAtomValue, useSetAtom } from 'jotai';
3
+ import {
4
+ // @community-ignore
5
+ environmentAtom,
6
+ // @community-ignore-end
7
+ appStore, appStoreOverrideAtom, } from '../app.js';
8
+ describe('jotai atoms', () => {
9
+ describe('environmentAtom', () => {
10
+ test('should return default values with empty state', () => {
11
+ const { result: { current: [env, envName], }, } = renderHook(() => useAtomValue(environmentAtom));
12
+ expect(envName).toEqual('');
13
+ expect(env).toEqual({});
14
+ });
15
+ test('should return first environment if non-existing is selected', () => {
16
+ const { result: { current: setApp }, } = renderHook(() => useSetAtom(appStore));
17
+ act(() => {
18
+ setApp({
19
+ environments: {
20
+ Default: { foo: 'bar', baz: 'qux' },
21
+ },
22
+ environment: 'non-existing',
23
+ });
24
+ });
25
+ const { result: { current: [env, envName], }, } = renderHook(() => useAtomValue(environmentAtom));
26
+ expect(envName).toEqual('Default');
27
+ expect(env).toEqual({ foo: 'bar', baz: 'qux' });
28
+ });
29
+ test('should work with override data', () => {
30
+ const { result: { current: setApp }, } = renderHook(() => useSetAtom(appStore));
31
+ const { result: { current: setOverride }, } = renderHook(() => useSetAtom(appStoreOverrideAtom));
32
+ act(() => {
33
+ setApp({
34
+ environments: {
35
+ Mock: {},
36
+ Default: { foo: 'bar', baz: 'qux' },
37
+ },
38
+ environment: 'non-existing',
39
+ });
40
+ setOverride({
41
+ environments: {
42
+ Default: { foo: '123', secret: 'password' },
43
+ },
44
+ environment: 'Default',
45
+ });
46
+ });
47
+ const { result: { current: [env, envName], }, } = renderHook(() => useAtomValue(environmentAtom));
48
+ expect(envName).toEqual('Default');
49
+ expect(env).toEqual({ foo: '123', baz: 'qux', secret: 'password' });
50
+ });
51
+ });
52
+ });
53
+ //# sourceMappingURL=app.test.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { getCallback } from '../callback.js';
2
+ import { normalizeOptions, OpenAPIParser } from '../../services/index.js';
3
+ import spec from './fixtures/callback.json';
4
+ const opts = normalizeOptions({});
5
+ describe('Models', () => {
6
+ describe('CallbackModel', () => {
7
+ const parser = new OpenAPIParser(spec, undefined, opts);
8
+ test('basic callback details', () => {
9
+ const callback = getCallback(parser, 'Test.Callback', { $ref: '#/components/callbacks/Test' }, '', opts, '');
10
+ expect(callback.name).toEqual('Test.Callback');
11
+ expect(callback.operations.length).toEqual(0);
12
+ });
13
+ });
14
+ });
15
+ //# sourceMappingURL=Callback.test.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,117 @@
1
+ import { getField } from '../field.js';
2
+ import { normalizeOptions, OpenAPIParser } from '../../services/index.js';
3
+ import spec from './fixtures/fields.json';
4
+ const opts = normalizeOptions({});
5
+ const deps = { operation: { pointer: 'testFieldModel' } };
6
+ describe('Models', () => {
7
+ describe('FieldModel', () => {
8
+ const parser = new OpenAPIParser(spec, undefined, opts);
9
+ test('basic field details', () => {
10
+ const field = getField(parser, {
11
+ $ref: '#/components/parameters/testParam',
12
+ }, '#/components/parameters/testParam', opts, deps);
13
+ expect(field.name).toEqual('test_name');
14
+ expect(field.in).toEqual('path');
15
+ expect(field.required).toEqual(false);
16
+ expect(field.schema.type).toEqual('string');
17
+ });
18
+ test('field details relevant for parameter serialization', () => {
19
+ const field = getField(parser, {
20
+ $ref: '#/components/parameters/serializationParam',
21
+ }, '#/components/parameters/serializationParam', opts, deps);
22
+ expect(field.name).toEqual('serialization_test_name');
23
+ expect(field.in).toEqual('query');
24
+ expect(field.schema.type).toEqual('array');
25
+ expect(field.style).toEqual('form');
26
+ expect(field.explode).toEqual(true);
27
+ });
28
+ test('field details relevant for default path param serialization', () => {
29
+ const field = getField(parser, {
30
+ $ref: '#/components/parameters/pathParamWithNoStyle',
31
+ }, '#/components/parameters/pathParamWithNoStyle', opts, deps);
32
+ expect(field.name).toEqual('serialization_test_name');
33
+ expect(field.in).toEqual('path');
34
+ expect(field.schema.type).toEqual('array');
35
+ expect(field.style).toEqual('simple');
36
+ expect(field.explode).toEqual(false);
37
+ });
38
+ test('field details relevant for default query parameter serialization', () => {
39
+ const field = getField(parser, {
40
+ $ref: '#/components/parameters/queryParamWithNoStyle',
41
+ }, '#/components/parameters/queryParamWithNoStyle', opts, deps);
42
+ expect(field.name).toEqual('serialization_test_name');
43
+ expect(field.in).toEqual('query');
44
+ expect(field.schema.type).toEqual('array');
45
+ expect(field.style).toEqual('form');
46
+ expect(field.explode).toEqual(true);
47
+ });
48
+ test('field details relevant for default cookie parameter serialization', () => {
49
+ const field = getField(parser, {
50
+ $ref: '#/components/parameters/queryParamWithNoStyle',
51
+ }, '#/components/parameters/queryParamWithNoStyle', opts, deps);
52
+ expect(field.name).toEqual('serialization_test_name');
53
+ expect(field.in).toEqual('query');
54
+ expect(field.schema.type).toEqual('array');
55
+ expect(field.style).toEqual('form');
56
+ expect(field.explode).toEqual(true);
57
+ });
58
+ test('field name should populated from name even if $ref (headers)', () => {
59
+ const field = getField(parser, {
60
+ $ref: '#/components/headers/testHeader',
61
+ name: 'Test-Header',
62
+ }, '#/components/headers/testHeader', opts, deps);
63
+ expect(field.name).toEqual('Test-Header');
64
+ });
65
+ test('param example should be override the example provided by the schema', () => {
66
+ const field = getField(parser, {
67
+ $ref: '#/components/parameters/queryParamExample',
68
+ }, '', opts, deps);
69
+ expect(field.example).toEqual({ id: 'main example' });
70
+ expect(field.schema.example).toEqual({ id: 'main example' });
71
+ expect(field.schema.schema.example).toEqual({ id: 'main example' });
72
+ });
73
+ test('content example should be override the example provided by the schema', () => {
74
+ const field = getField(parser, {
75
+ $ref: '#/components/parameters/queryParamWithContentExample',
76
+ }, '', opts, deps);
77
+ expect(field.example).toEqual({ id: 'content example' });
78
+ expect(field.schema.example).toEqual({ id: 'content example' });
79
+ expect(field.schema.schema.example).toEqual({ id: 'content example' });
80
+ });
81
+ test('field includes allowReserved when parameter has allowReserved', () => {
82
+ const field = getField(parser, {
83
+ $ref: '#/components/parameters/allowReservedParam',
84
+ }, '#/components/parameters/allowReservedParam', opts, deps);
85
+ expect(field.name).toEqual('filter');
86
+ expect(field.in).toEqual('query');
87
+ expect(field.allowReserved).toEqual(true);
88
+ });
89
+ test('should include badges from x-badges on parameter', () => {
90
+ const field = getField(parser, { $ref: '#/components/parameters/paramWithBadges' }, '#/components/parameters/paramWithBadges', opts, deps);
91
+ expect(field.name).toEqual('experimentalFlag');
92
+ expect(field.badges).toEqual([
93
+ { name: 'Experimental', position: 'after' },
94
+ { name: 'Beta', position: 'before', color: 'blue' },
95
+ ]);
96
+ });
97
+ test('should include badges from x-badges on schema property', () => {
98
+ const field = getField(parser, {
99
+ name: 'quantityFilled',
100
+ required: false,
101
+ schema: {
102
+ type: 'integer',
103
+ description: 'Filled quantity (experimental).',
104
+ 'x-badges': [{ name: 'Experimental' }],
105
+ },
106
+ }, '#/components/schemas/schemaWithBadgeProperty/properties/quantityFilled', opts, deps);
107
+ expect(field.name).toEqual('quantityFilled');
108
+ expect(field.badges).toEqual([{ name: 'Experimental' }]);
109
+ });
110
+ test('should include badges from x-badges on schema when parameter schema is a $ref', () => {
111
+ const field = getField(parser, { $ref: '#/components/parameters/paramWithSchemaRefBadges' }, '#/components/parameters/paramWithSchemaRefBadges', opts, deps);
112
+ expect(field.name).toEqual('statusFilter');
113
+ expect(field.badges).toEqual([{ name: 'From ref schema', position: 'after' }]);
114
+ });
115
+ });
116
+ });
117
+ //# sourceMappingURL=FieldModel.test.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,105 @@
1
+ import { getMediaContent } from '../mediaContent.js';
2
+ import { normalizeOptions, OpenAPIParser } from '../../services/index.js';
3
+ import { MediaTypes } from '../../constants.js';
4
+ const options = normalizeOptions({});
5
+ const data = { operation: { pointer: 'testMediaContent' } };
6
+ describe('Models', () => {
7
+ describe('mediaContent', () => {
8
+ let parser;
9
+ const info = {
10
+ [MediaTypes.JSON]: {
11
+ schema: {
12
+ additionalProperties: {
13
+ format: 'int32',
14
+ },
15
+ },
16
+ },
17
+ };
18
+ beforeEach(() => {
19
+ parser = new OpenAPIParser({ openapi: '3.0.0' }, undefined, options);
20
+ });
21
+ test('should work with default arguments', () => {
22
+ const consoleError = vi.spyOn(global.console, 'error');
23
+ const mediaContentModel = getMediaContent({
24
+ parser,
25
+ info: {},
26
+ isRequestType: true,
27
+ options,
28
+ data,
29
+ });
30
+ expect(consoleError).not.toHaveBeenCalled();
31
+ expect(mediaContentModel).toEqual({
32
+ hasSample: false,
33
+ isRequestType: true,
34
+ mediaTypes: [],
35
+ ...data,
36
+ });
37
+ });
38
+ test('should handle isRequestType argument', () => {
39
+ const mediaContentModelWithRequestTypeTrue = getMediaContent({
40
+ parser,
41
+ info: {},
42
+ isRequestType: true,
43
+ options,
44
+ data,
45
+ });
46
+ const mediaContentModelWithRequestTypeFalse = getMediaContent({
47
+ parser,
48
+ info: {},
49
+ isRequestType: false,
50
+ options,
51
+ data,
52
+ });
53
+ expect(mediaContentModelWithRequestTypeTrue.isRequestType).toEqual(true);
54
+ expect(mediaContentModelWithRequestTypeFalse.isRequestType).toEqual(false);
55
+ });
56
+ test('should return mediaType', () => {
57
+ const mediaContentModel = getMediaContent({
58
+ parser,
59
+ info,
60
+ isRequestType: true,
61
+ options,
62
+ data,
63
+ });
64
+ const firstMediaType = mediaContentModel.mediaTypes[0];
65
+ expect(mediaContentModel.mediaTypes.length).toEqual(1);
66
+ expect(firstMediaType.name).toEqual(MediaTypes.JSON);
67
+ });
68
+ test('should preserve summary for each example when media type uses examples object', () => {
69
+ const infoWithExamples = {
70
+ [MediaTypes.JSON]: {
71
+ schema: {
72
+ type: 'object',
73
+ properties: { publisherId: { type: 'string' } },
74
+ },
75
+ examples: {
76
+ 'example-0': {
77
+ summary: 'First Example',
78
+ value: { publisherId: '1' },
79
+ },
80
+ 'example-1': {
81
+ summary: 'Second Example',
82
+ value: { publisherId: '2' },
83
+ },
84
+ },
85
+ },
86
+ };
87
+ const mediaContentModel = getMediaContent({
88
+ parser,
89
+ info: infoWithExamples,
90
+ isRequestType: true,
91
+ options,
92
+ data,
93
+ });
94
+ const examples = mediaContentModel.mediaTypes[0]?.examples;
95
+ expect(examples).toBeDefined();
96
+ expect(examples?.['example-0']).toBeDefined();
97
+ expect(examples?.['example-0']?.summary).toBe('First Example');
98
+ expect(examples?.['example-0']?.value).toEqual({ publisherId: '1' });
99
+ expect(examples?.['example-1']).toBeDefined();
100
+ expect(examples?.['example-1']?.summary).toBe('Second Example');
101
+ expect(examples?.['example-1']?.value).toEqual({ publisherId: '2' });
102
+ });
103
+ });
104
+ });
105
+ //# sourceMappingURL=MediaContent.test.js.map
@@ -0,0 +1 @@
1
+ export {};