@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.
- package/dist/{redocly-openapi-docs.min.AiChatProvider-DcsGB2gP.js → redocly-openapi-docs.min.AiChatProvider-j-VDfFJ9.js} +3 -3
- package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-wCZA4usG.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiPanel-jo7fqtSt.js → redocly-openapi-docs.min.AiPanel-DTzHqAiI.js} +116 -116
- package/dist/redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js +1 -0
- package/dist/redocly-openapi-docs.min.Observable-D6wKbFwB.js +1 -0
- package/dist/redocly-openapi-docs.min.SemanticSearchService-DNFOPBZK.js +1 -0
- package/dist/{redocly-openapi-docs.min.SqliteDBStorage-B_f6WR8o.js → redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js} +1 -1
- package/dist/redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js +1 -0
- package/dist/redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js +1 -0
- package/dist/redocly-openapi-docs.min.ai-chat-mappers-CmX-8902.js +1 -0
- package/dist/redocly-openapi-docs.min.core-BYyFOtMX.js +1 -0
- package/dist/redocly-openapi-docs.min.external-resolver-BkceRyB4.js +2 -0
- package/dist/redocly-openapi-docs.min.index-BCcol5vU.js +1 -0
- package/dist/redocly-openapi-docs.min.index-C6uU_v-b.js +1 -0
- package/dist/redocly-openapi-docs.min.index-CmXZfuiZ.js +7730 -0
- package/dist/redocly-openapi-docs.min.index-DVWw0ICA.js +1 -0
- package/dist/redocly-openapi-docs.min.index-YnvLQkG_.js +1 -0
- package/dist/redocly-openapi-docs.min.index-xl_tBaHD.js +1 -0
- package/dist/redocly-openapi-docs.min.js +1 -1
- package/dist/{redocly-openapi-docs.min.lint-C-zlwxhp.js → redocly-openapi-docs.min.lint-2YpbCz3r.js} +69 -69
- package/dist/{redocly-openapi-docs.min.lint-graphql-qEh9cZHx.js → redocly-openapi-docs.min.lint-graphql-Bgfcu2tP.js} +1 -1
- package/dist/redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js +1 -0
- package/dist/redocly-openapi-docs.min.promise-map-limit-Db_42GvV.js +1 -0
- package/dist/{redocly-openapi-docs.min.respect-run-hfNPYQ9x.js → redocly-openapi-docs.min.respect-run-Ct8taisL.js} +1 -1
- package/dist/redocly-openapi-docs.min.standalone-BPCdJgtH.js +11995 -0
- package/dist/redocly-openapi-docs.min.tauri-path-CmqBCxGb.js +1 -0
- package/dist/{redocly-openapi-docs.min.useAiChatQueries-DgSsCKMW.js → redocly-openapi-docs.min.useAiChatQueries-t8oy8jik.js} +80 -80
- package/lib/components/ApiInfo/__tests__/ApiInfo.test.d.ts +1 -0
- package/lib/components/ApiInfo/__tests__/ApiInfo.test.js +46 -0
- package/lib/components/Callbacks/CallbackOperation.js +1 -1
- package/lib/components/Callbacks/__tests__/Callbacks.test.d.ts +1 -0
- package/lib/components/Callbacks/__tests__/Callbacks.test.js +46 -0
- package/lib/components/Content/__tests__/useAutoScroll.test.d.ts +1 -0
- package/lib/components/Content/__tests__/useAutoScroll.test.js +88 -0
- package/lib/components/Content/useAutoScroll.js +1 -1
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.d.ts +1 -0
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +123 -0
- package/lib/components/ContentItem/useIsExpanded.js +1 -1
- package/lib/components/ContentItems/ContentItems.js +1 -1
- package/lib/components/ContentItems/VirtualList.js +1 -1
- package/lib/components/ContentItems/__tests__/Items.test.d.ts +1 -0
- package/lib/components/ContentItems/__tests__/Items.test.js +66 -0
- package/lib/components/ContentItems/__tests__/VirtualList.test.d.ts +1 -0
- package/lib/components/ContentItems/__tests__/VirtualList.test.js +135 -0
- package/lib/components/ContentItems/useScrollOnRender.js +1 -1
- package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.d.ts +1 -0
- package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.js +63 -0
- package/lib/components/Download/__tests__/DownloadSpecification.test.d.ts +1 -0
- package/lib/components/Download/__tests__/DownloadSpecification.test.js +52 -0
- package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.d.ts +1 -0
- package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.js +60 -0
- package/lib/components/ExpandAllButton/__tests__/helpers.test.d.ts +1 -0
- package/lib/components/ExpandAllButton/__tests__/helpers.test.js +133 -0
- package/lib/components/Language/__tests__/LanguageDropdown.test.d.ts +1 -0
- package/lib/components/Language/__tests__/LanguageDropdown.test.js +23 -0
- package/lib/components/Markdown/__tests__/Markdown.test.d.ts +1 -0
- package/lib/components/Markdown/__tests__/Markdown.test.js +34 -0
- package/lib/components/McpOverview/__tests__/McpOverview.test.d.ts +1 -0
- package/lib/components/McpOverview/__tests__/McpOverview.test.js +66 -0
- package/lib/components/McpTool/__tests__/McpPrompt.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpPrompt.test.js +57 -0
- package/lib/components/McpTool/__tests__/McpResource.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpResource.test.js +81 -0
- package/lib/components/McpTool/__tests__/McpTool.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpTool.test.js +82 -0
- package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.d.ts +1 -0
- package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.js +79 -0
- package/lib/components/OperationItem/__tests__/OperationItem.test.d.ts +1 -0
- package/lib/components/OperationItem/__tests__/OperationItem.test.js +70 -0
- package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.d.ts +16 -0
- package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.js +42 -0
- package/lib/components/Overview/__tests__/Overview.test.d.ts +1 -0
- package/lib/components/Overview/__tests__/Overview.test.js +59 -0
- package/lib/components/PayloadSamples/__tests__/Example.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/Example.test.js +36 -0
- package/lib/components/PayloadSamples/__tests__/ExampleValue.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/ExampleValue.test.js +197 -0
- package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.js +38 -0
- package/lib/components/PropertyDetails/__tests__/Extensions.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/Extensions.test.js +21 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetail.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetail.test.js +52 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetails.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetails.test.js +191 -0
- package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.js +365 -0
- package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.js +23 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.d.ts +1 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.js +16 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.d.ts +1 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.js +104 -0
- package/lib/components/RenderHook/__tests__/RenderHook.test.d.ts +1 -0
- package/lib/components/RenderHook/__tests__/RenderHook.test.js +15 -0
- package/lib/components/Replay/__tests__/utils.test.d.ts +1 -0
- package/lib/components/Replay/__tests__/utils.test.js +526 -0
- package/lib/components/Request/__tests__/RequestDetails.test.d.ts +1 -0
- package/lib/components/Request/__tests__/RequestDetails.test.js +98 -0
- package/lib/components/RequestSamples/__tests__/Example.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/Example.test.js +384 -0
- package/lib/components/RequestSamples/__tests__/RequestSamples.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/RequestSamples.test.js +226 -0
- package/lib/components/RequestSamples/__tests__/useCodeSamples.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/useCodeSamples.test.js +64 -0
- package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.d.ts +1 -0
- package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.js +29 -0
- package/lib/components/Responses/OperationResponseList.js +1 -1
- package/lib/components/Responses/__tests__/OperationResponseList.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/OperationResponseList.test.js +89 -0
- package/lib/components/Responses/__tests__/ResponseDetails.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/ResponseDetails.test.js +111 -0
- package/lib/components/Responses/__tests__/ResponsesHeaders.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/ResponsesHeaders.test.js +26 -0
- package/lib/components/Schema/Schema.js +1 -1
- package/lib/components/Schema/SubSchema.js +1 -1
- package/lib/components/Schema/__tests__/ArraySchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/ArraySchema.test.js +93 -0
- package/lib/components/Schema/__tests__/ObjectSchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/ObjectSchema.test.js +115 -0
- package/lib/components/Schema/__tests__/OneOfSchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/OneOfSchema.test.js +33 -0
- package/lib/components/Schema/__tests__/Schema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/Schema.test.js +67 -0
- package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.js +22 -0
- package/lib/components/Schema/useOneOfLocationIdx.js +1 -1
- package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.d.ts +1 -0
- package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.js +95 -0
- package/lib/components/Security/__tests__/Security.test.d.ts +1 -0
- package/lib/components/Security/__tests__/Security.test.js +38 -0
- package/lib/components/Security/__tests__/SecurityButton.test.d.ts +1 -0
- package/lib/components/Security/__tests__/SecurityButton.test.js +92 -0
- package/lib/components/Security/__tests__/SecurityModal.test.d.ts +1 -0
- package/lib/components/Security/__tests__/SecurityModal.test.js +172 -0
- package/lib/components/ServerList/__tests__/ServerList.test.d.ts +1 -0
- package/lib/components/ServerList/__tests__/ServerList.test.js +83 -0
- package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
- package/lib/components/StickySidebar/StickyResponsiveSidebar.js +1 -1
- package/lib/components/Tabs/__tests__/Tabs.test.d.ts +1 -0
- package/lib/components/Tabs/__tests__/Tabs.test.js +27 -0
- package/lib/components/TagItem/OperationsNavigation.js +1 -1
- package/lib/components/TagItem/TagItem.js +1 -1
- package/lib/components/ViewNested/__tests__/ViewNested.test.d.ts +1 -0
- package/lib/components/ViewNested/__tests__/ViewNested.test.js +42 -0
- package/lib/components/__tests__/Samples/ExampleSwitch.test.d.ts +1 -0
- package/lib/components/__tests__/Samples/ExampleSwitch.test.js +45 -0
- package/lib/components/__tests__/Samples/use-example-key.test.d.ts +1 -0
- package/lib/components/__tests__/Samples/use-example-key.test.js +28 -0
- package/lib/components/__tests__/common/ClearButton.test.d.ts +1 -0
- package/lib/components/__tests__/common/ClearButton.test.js +18 -0
- package/lib/components/__tests__/common/Dropdown.test.d.ts +1 -0
- package/lib/components/__tests__/common/Dropdown.test.js +52 -0
- package/lib/components/__tests__/mocks/examples.d.ts +4 -0
- package/lib/components/__tests__/mocks/examples.js +115 -0
- package/lib/components/common/LinkToField.js +1 -1
- package/lib/components/common/__tests__/Dropdown.test.d.ts +1 -0
- package/lib/components/common/__tests__/Dropdown.test.js +129 -0
- package/lib/components/common/__tests__/LinkToField.test.d.ts +1 -0
- package/lib/components/common/__tests__/LinkToField.test.js +39 -0
- package/lib/components/common/linkify.js +1 -1
- package/lib/hooks/useRouter.js +1 -1
- package/lib/hooks/useUppercase2LowercaseRedirect.js +1 -1
- package/lib/jotai/__tests__/app.test.d.ts +1 -0
- package/lib/jotai/__tests__/app.test.js +53 -0
- package/lib/models/__tests__/Callback.test.d.ts +1 -0
- package/lib/models/__tests__/Callback.test.js +15 -0
- package/lib/models/__tests__/FieldModel.test.d.ts +1 -0
- package/lib/models/__tests__/FieldModel.test.js +117 -0
- package/lib/models/__tests__/MediaContent.test.d.ts +1 -0
- package/lib/models/__tests__/MediaContent.test.js +105 -0
- package/lib/models/__tests__/Operation.test.d.ts +1 -0
- package/lib/models/__tests__/Operation.test.js +459 -0
- package/lib/models/__tests__/Response.test.d.ts +1 -0
- package/lib/models/__tests__/Response.test.js +221 -0
- package/lib/models/__tests__/Schema.circular.test.d.ts +1 -0
- package/lib/models/__tests__/Schema.circular.test.js +694 -0
- package/lib/models/__tests__/Schema.test.d.ts +1 -0
- package/lib/models/__tests__/Schema.test.js +1395 -0
- package/lib/models/__tests__/example.test.d.ts +1 -0
- package/lib/models/__tests__/example.test.js +90 -0
- package/lib/models/__tests__/group.test.d.ts +1 -0
- package/lib/models/__tests__/group.test.js +52 -0
- package/lib/models/__tests__/helpers.d.ts +5 -0
- package/lib/models/__tests__/helpers.js +62 -0
- package/lib/models/__tests__/request.test.d.ts +1 -0
- package/lib/models/__tests__/request.test.js +119 -0
- package/lib/services/__tests__/OpenAPIParser.test.d.ts +1 -0
- package/lib/services/__tests__/OpenAPIParser.test.js +80 -0
- package/lib/services/__tests__/check.test.d.ts +1 -0
- package/lib/services/__tests__/check.test.js +22 -0
- package/lib/services/__tests__/utils.test.d.ts +1 -0
- package/lib/services/__tests__/utils.test.js +42 -0
- package/lib/services/code-samples/__tests__/apply-environments.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/apply-environments.test.js +64 -0
- package/lib/services/code-samples/__tests__/build-code-samples.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/build-code-samples.test.js +70 -0
- package/lib/services/code-samples/__tests__/convertSampleToString.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/convertSampleToString.test.js +116 -0
- package/lib/services/code-samples/__tests__/generator-data-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-data-value.test.js +277 -0
- package/lib/services/code-samples/__tests__/generator-serialized-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-serialized-value.test.js +258 -0
- package/lib/services/code-samples/__tests__/generator-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-value.test.js +273 -0
- package/lib/services/code-samples/__tests__/generator.test.d.ts +249 -0
- package/lib/services/code-samples/__tests__/generator.test.js +1201 -0
- package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.js +31 -0
- package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.js +222 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.js +129 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.js +49 -0
- package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.js +130 -0
- package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.js +191 -0
- package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.js +85 -0
- package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.js +85 -0
- package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.js +126 -0
- package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.js +105 -0
- package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.js +126 -0
- package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.js +129 -0
- package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.js +129 -0
- package/lib/services/config-options/__tests__/helpers.test.d.ts +1 -0
- package/lib/services/config-options/__tests__/helpers.test.js +234 -0
- package/lib/services/history/__tests__/helpers.test.d.ts +1 -0
- package/lib/services/history/__tests__/helpers.test.js +19 -0
- package/lib/services/menu/__tests__/buildNestedTagsItems.test.d.ts +1 -0
- package/lib/services/menu/__tests__/buildNestedTagsItems.test.js +109 -0
- package/lib/services/menu/__tests__/builder.test.d.ts +1 -0
- package/lib/services/menu/__tests__/builder.test.js +307 -0
- package/lib/services/menu/__tests__/operation.test.d.ts +1 -0
- package/lib/services/menu/__tests__/operation.test.js +240 -0
- package/lib/services/menu/__tests__/tags.test.d.ts +1 -0
- package/lib/services/menu/__tests__/tags.test.js +71 -0
- package/lib/telemetry/RedocTelemetry.js +31 -1
- package/lib/telemetry/__tests__/RedocTelemetry.test.d.ts +1 -0
- package/lib/telemetry/__tests__/RedocTelemetry.test.js +107 -0
- package/lib/testProviders.d.ts +6 -0
- package/lib/testProviders.js +14 -0
- package/lib/utils/__tests__/areArraysEqual.test.d.ts +1 -0
- package/lib/utils/__tests__/areArraysEqual.test.js +33 -0
- package/lib/utils/__tests__/argValuesHelpers.d.ts +1 -0
- package/lib/utils/__tests__/argValuesHelpers.js +56 -0
- package/lib/utils/__tests__/calculateMaxLength.test.d.ts +1 -0
- package/lib/utils/__tests__/calculateMaxLength.test.js +119 -0
- package/lib/utils/__tests__/configure-helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/configure-helpers.test.js +356 -0
- package/lib/utils/__tests__/convertSwagger2OpenAPI.test.d.ts +1 -0
- package/lib/utils/__tests__/convertSwagger2OpenAPI.test.js +392 -0
- package/lib/utils/__tests__/debounce.test.d.ts +1 -0
- package/lib/utils/__tests__/debounce.test.js +54 -0
- package/lib/utils/__tests__/debug.test.d.ts +1 -0
- package/lib/utils/__tests__/debug.test.js +23 -0
- package/lib/utils/__tests__/dom.test.d.ts +1 -0
- package/lib/utils/__tests__/dom.test.js +108 -0
- package/lib/utils/__tests__/getBreadcrumbs.test.d.ts +1 -0
- package/lib/utils/__tests__/getBreadcrumbs.test.js +98 -0
- package/lib/utils/__tests__/hasNestedFields.test.d.ts +1 -0
- package/lib/utils/__tests__/hasNestedFields.test.js +147 -0
- package/lib/utils/__tests__/helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/helpers.test.js +174 -0
- package/lib/utils/__tests__/isMobile.test.d.ts +1 -0
- package/lib/utils/__tests__/isMobile.test.js +28 -0
- package/lib/utils/__tests__/loadAndBundleSpec.test.d.ts +1 -0
- package/lib/utils/__tests__/loadAndBundleSpec.test.js +22 -0
- package/lib/utils/__tests__/local-storage.test.d.ts +1 -0
- package/lib/utils/__tests__/local-storage.test.js +48 -0
- package/lib/utils/__tests__/object.test.d.ts +1 -0
- package/lib/utils/__tests__/object.test.js +45 -0
- package/lib/utils/__tests__/openapi.test.d.ts +1 -0
- package/lib/utils/__tests__/openapi.test.js +1378 -0
- package/lib/utils/__tests__/path.test.d.ts +1 -0
- package/lib/utils/__tests__/path.test.js +16 -0
- package/lib/utils/__tests__/queryString.test.d.ts +1 -0
- package/lib/utils/__tests__/queryString.test.js +60 -0
- package/lib/utils/__tests__/replaceVariables.test.d.ts +1 -0
- package/lib/utils/__tests__/replaceVariables.test.js +46 -0
- package/lib/utils/__tests__/simplifyAstStructure.test.d.ts +1 -0
- package/lib/utils/__tests__/simplifyAstStructure.test.js +26 -0
- package/lib/utils/__tests__/sort.test.d.ts +1 -0
- package/lib/utils/__tests__/sort.test.js +16 -0
- package/lib/utils/__tests__/string.test.d.ts +1 -0
- package/lib/utils/__tests__/string.test.js +16 -0
- package/lib/utils/__tests__/theme-helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/theme-helpers.test.js +24 -0
- package/lib/utils/__tests__/url.test.d.ts +1 -0
- package/lib/utils/__tests__/url.test.js +134 -0
- package/lib/utils/path.d.ts +1 -1
- package/package.json +12 -12
- package/dist/redocly-openapi-docs.min.ai-chat-mappers-MY79QAeW.js +0 -1
- package/dist/redocly-openapi-docs.min.external-resolver-3KMJv7SC.js +0 -2
- package/dist/redocly-openapi-docs.min.index-BYVMr_la.js +0 -1
- package/dist/redocly-openapi-docs.min.index-CsqzTi3Z.js +0 -7586
- package/dist/redocly-openapi-docs.min.index-D8F7x0S6.js +0 -1
- package/dist/redocly-openapi-docs.min.index-qqKTpI_q.js +0 -1
- package/dist/redocly-openapi-docs.min.standalone-Ci6886Cr.js +0 -12114
- package/dist/redocly-openapi-docs.min.tauri-path-Bs1-AQjc.js +0 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, fireEvent, act } from '@testing-library/react';
|
|
3
|
+
import { SecurityModal } from '../SecurityModal.js';
|
|
4
|
+
describe('SecurityModal Component', () => {
|
|
5
|
+
const securities = [
|
|
6
|
+
{
|
|
7
|
+
schemes: [
|
|
8
|
+
{
|
|
9
|
+
id: 'B',
|
|
10
|
+
description: 'Test description scheme B',
|
|
11
|
+
type: 'http',
|
|
12
|
+
bearerFormat: 'password',
|
|
13
|
+
scopes: [],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 'C',
|
|
17
|
+
description: 'Test description scheme C',
|
|
18
|
+
type: 'http',
|
|
19
|
+
bearerFormat: 'password',
|
|
20
|
+
scopes: [],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
schemes: [
|
|
26
|
+
{
|
|
27
|
+
id: 'A',
|
|
28
|
+
description: 'Test description scheme A',
|
|
29
|
+
type: 'apiKey',
|
|
30
|
+
in: 'header',
|
|
31
|
+
name: 'api_key',
|
|
32
|
+
scopes: [],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
schemes: [
|
|
38
|
+
{
|
|
39
|
+
id: 'D',
|
|
40
|
+
description: 'Test description scheme D',
|
|
41
|
+
type: 'oauth2',
|
|
42
|
+
flows: {
|
|
43
|
+
authorizationCode: {
|
|
44
|
+
authorizationUrl: 'https://example.com/authorization',
|
|
45
|
+
tokenUrl: 'https://example.com/token',
|
|
46
|
+
scopes: {
|
|
47
|
+
'read:pets': 'read your pets',
|
|
48
|
+
'write:pets': 'modify pets in your account',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
scopes: ['read:pets'],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
it('renders the SecurityModal with the correct number of SegmentedItems', () => {
|
|
58
|
+
const { getByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
59
|
+
expect(getByText('A')).toBeInTheDocument();
|
|
60
|
+
expect(getByText('B and C')).toBeInTheDocument();
|
|
61
|
+
});
|
|
62
|
+
it('renders the SecurityModal with the correct number of SecurityFlows and Dividers', () => {
|
|
63
|
+
const { getByText, getAllByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
64
|
+
expect(getByText('Test description scheme B')).toBeInTheDocument();
|
|
65
|
+
expect(getByText('Test description scheme C')).toBeInTheDocument();
|
|
66
|
+
expect(getByText('and')).toBeInTheDocument();
|
|
67
|
+
expect(getAllByText('HTTP Authorization Scheme').length).toEqual(2);
|
|
68
|
+
expect(getAllByText('http').length).toEqual(2);
|
|
69
|
+
});
|
|
70
|
+
it('should update active security scheme on click and display relevant information', async () => {
|
|
71
|
+
const { getByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
72
|
+
fireEvent.click(getByText('A'));
|
|
73
|
+
await act(async () => { });
|
|
74
|
+
expect(getByText('Test description scheme A')).toBeInTheDocument();
|
|
75
|
+
expect(getByText('Header parameter name:')).toBeInTheDocument();
|
|
76
|
+
expect(getByText('api_key')).toBeInTheDocument();
|
|
77
|
+
});
|
|
78
|
+
it('should display details for OAuth2 scheme D including initial optional scopes toggle', async () => {
|
|
79
|
+
const { getByText, getAllByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
80
|
+
fireEvent.click(getByText('D'));
|
|
81
|
+
await act(async () => { });
|
|
82
|
+
expect(getByText('Test description scheme D')).toBeInTheDocument();
|
|
83
|
+
expect(getByText('Required scopes')).toBeInTheDocument();
|
|
84
|
+
expect(getByText('Show optional scopes')).toBeInTheDocument();
|
|
85
|
+
const readPetsScopes = getAllByText('read:pets');
|
|
86
|
+
expect(readPetsScopes.length).toBe(1);
|
|
87
|
+
const writePetsScopes = getAllByText('write:pets');
|
|
88
|
+
expect(writePetsScopes.length).toBe(1);
|
|
89
|
+
});
|
|
90
|
+
it('should toggle optional scopes visibility for OAuth2 scheme D', async () => {
|
|
91
|
+
const { getByText, queryByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
92
|
+
fireEvent.click(getByText('D'));
|
|
93
|
+
await act(async () => { });
|
|
94
|
+
fireEvent.click(getByText('Show optional scopes'));
|
|
95
|
+
await act(async () => { });
|
|
96
|
+
expect(getByText('Hide optional scopes')).toBeInTheDocument();
|
|
97
|
+
expect(queryByText('Show optional scopes')).toBeNull();
|
|
98
|
+
});
|
|
99
|
+
it('calls onClose callback when the Close button is clicked', () => {
|
|
100
|
+
const onCloseMock = vi.fn();
|
|
101
|
+
const { getByTestId } = render(_jsx(SecurityModal, { securities: securities, onClose: onCloseMock }));
|
|
102
|
+
fireEvent.click(getByTestId('close'));
|
|
103
|
+
expect(onCloseMock).toHaveBeenCalled();
|
|
104
|
+
});
|
|
105
|
+
it('should display required scopes from scopes array if there are no flows', () => {
|
|
106
|
+
const securities = [
|
|
107
|
+
{
|
|
108
|
+
schemes: [
|
|
109
|
+
{
|
|
110
|
+
id: 'D',
|
|
111
|
+
description: 'Test description scheme D',
|
|
112
|
+
type: 'oauth2',
|
|
113
|
+
flows: {},
|
|
114
|
+
scopes: ['read:pets'],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
const { getByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
120
|
+
expect(getByText('read:pets')).toBeInTheDocument();
|
|
121
|
+
});
|
|
122
|
+
it('should exlcude required scopes from optional scopes', async () => {
|
|
123
|
+
const { getByText, getAllByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
124
|
+
fireEvent.click(getByText('D'));
|
|
125
|
+
await act(async () => { });
|
|
126
|
+
fireEvent.click(getByText('Show optional scopes'));
|
|
127
|
+
await act(async () => { });
|
|
128
|
+
expect(getAllByText('read:pets').length).toBe(1);
|
|
129
|
+
expect(getAllByText('write:pets').length).toBe(1);
|
|
130
|
+
});
|
|
131
|
+
it('should render required scopes once per scheme and optional scopes per flow when there are multiple flows', async () => {
|
|
132
|
+
const securities = [
|
|
133
|
+
{
|
|
134
|
+
schemes: [
|
|
135
|
+
{
|
|
136
|
+
id: 'D',
|
|
137
|
+
description: 'Test description scheme D',
|
|
138
|
+
type: 'oauth2',
|
|
139
|
+
flows: {
|
|
140
|
+
authorizationCode: {
|
|
141
|
+
authorizationUrl: 'https://example.com/authorization',
|
|
142
|
+
tokenUrl: 'https://example.com/token',
|
|
143
|
+
scopes: {
|
|
144
|
+
'read:pets': 'read your pets',
|
|
145
|
+
'write:pets': 'modify pets in your account',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
clientCredentials: {
|
|
149
|
+
tokenUrl: 'https://example.com/token',
|
|
150
|
+
scopes: {
|
|
151
|
+
'read:pets': 'read your pets',
|
|
152
|
+
'write:pets': 'modify pets in your account',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
scopes: ['read:pets'],
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
const { getByText, getAllByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
162
|
+
// Required is per scheme
|
|
163
|
+
expect(getAllByText('Required scopes').length).toBe(1);
|
|
164
|
+
expect(getAllByText('read:pets').length).toBe(1);
|
|
165
|
+
// Each flow gets its own optional scopes block
|
|
166
|
+
expect(getByText('authorizationCode')).toBeInTheDocument();
|
|
167
|
+
expect(getByText('clientCredentials')).toBeInTheDocument();
|
|
168
|
+
expect(getAllByText('Show optional scopes').length).toBe(2);
|
|
169
|
+
expect(getAllByText('write:pets').length).toBe(2);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
//# sourceMappingURL=SecurityModal.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai';
|
|
4
|
+
import { vi } from 'vitest';
|
|
5
|
+
import { ServerList } from '../ServerList.js';
|
|
6
|
+
import { normalizeOptions } from '../../../services/index.js';
|
|
7
|
+
vi.mock('jotai', async () => ({
|
|
8
|
+
...(await vi.importActual('jotai')),
|
|
9
|
+
useAtomValue: vi.fn(),
|
|
10
|
+
}));
|
|
11
|
+
describe('ServerList component', () => {
|
|
12
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({}));
|
|
13
|
+
const servers = [
|
|
14
|
+
{
|
|
15
|
+
url: 'http://petstore.swagger.io/v2',
|
|
16
|
+
description: 'Default server',
|
|
17
|
+
name: 'Default',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
url: 'http://petstore.swagger.io/sandbox',
|
|
21
|
+
description: 'Sandbox server',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
url: 'http://petstore.swagger.io/stage',
|
|
25
|
+
name: 'Stage server',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
const translateMock = vi.fn().mockImplementation((_, defaultValue) => defaultValue);
|
|
29
|
+
it('should render copy button', () => {
|
|
30
|
+
render(_jsx(ServerList, { servers: servers, path: "/pet", translate: translateMock }));
|
|
31
|
+
expect(screen.getAllByTestId('copy-button').length).toBe(3);
|
|
32
|
+
});
|
|
33
|
+
it('should render server description tooltip', () => {
|
|
34
|
+
render(_jsx(ServerList, { servers: servers, path: "/pet", translate: translateMock }));
|
|
35
|
+
expect(screen.getAllByTestId('server-item-description-tooltip').length).toBe(1);
|
|
36
|
+
});
|
|
37
|
+
it('should render server name', () => {
|
|
38
|
+
render(_jsx(ServerList, { servers: servers, path: "/pet", translate: translateMock }));
|
|
39
|
+
expect(screen.getAllByTestId('server-panel-item-name')[0]).toHaveTextContent('Default');
|
|
40
|
+
expect(screen.getAllByTestId('server-panel-item-name')[1]).toHaveTextContent('Sandbox server');
|
|
41
|
+
expect(screen.getAllByTestId('server-panel-item-name')[2]).toHaveTextContent('Stage server');
|
|
42
|
+
});
|
|
43
|
+
describe('Server variables', () => {
|
|
44
|
+
const serversWithVariables = [
|
|
45
|
+
{
|
|
46
|
+
url: 'http://petstore.swagger.io/{version}',
|
|
47
|
+
description: 'Default server with variables',
|
|
48
|
+
name: 'Default',
|
|
49
|
+
variables: {
|
|
50
|
+
version: {
|
|
51
|
+
default: 'v2',
|
|
52
|
+
description: 'API version',
|
|
53
|
+
enum: ['v1', 'v2'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
url: 'http://petstore.swagger.io/{sandbox}/{version}',
|
|
59
|
+
description: 'Sandbox server with variables',
|
|
60
|
+
variables: {
|
|
61
|
+
sandbox: {
|
|
62
|
+
default: 'dev',
|
|
63
|
+
description: 'Sandbox name',
|
|
64
|
+
},
|
|
65
|
+
version: {
|
|
66
|
+
default: 'v2',
|
|
67
|
+
description: 'API version',
|
|
68
|
+
enum: ['v1', 'v2'],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
it('should render view nested with one variable', () => {
|
|
74
|
+
render(_jsx(ServerList, { servers: [serversWithVariables[0]], path: "/pet", translate: translateMock }));
|
|
75
|
+
expect(screen.getByText('Show 1 variable')).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
it('should render view nested with multiple variables', () => {
|
|
78
|
+
render(_jsx(ServerList, { servers: [serversWithVariables[1]], path: "/pet", translate: translateMock }));
|
|
79
|
+
expect(screen.getByText('Show 2 variables')).toBeInTheDocument();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=ServerList.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMemo as b}from"react";import{useLocation as h}from"react-router
|
|
1
|
+
import{useMemo as b}from"react";import{useLocation as h}from"react-router";import{useActiveSectionId as I}from"@redocly/theme/core/openapi";import{pathMatchedLink as k}from"../../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as A}from"../../../constants.js";import{joinWithSeparator as y}from"../../../services/history/helpers.js";function L({items:s,routingBasePath:r}){const t=h(),o=I(t,!1,!1);return b(()=>S(s,o,t,r),[o,s,t,r])}function S(s,r="",t,o){const n=[];return c({contentItems:s,sidebarItems:n,activeItemId:r,location:t,routingBasePath:o}),n}function d(s,r="",t,o){return s.href?r&&o?y(o,s.id)===r:r&&!o?s.id===r:k(t,s.href):!1}function l(s,r="",t,o){return(s.items||[]).some(i=>d(i,r,t,o)||l(i,r,t,o))}function c(s){const{contentItems:r,sidebarItems:t,activeItemId:o,location:n,routingBasePath:i}=s;let p=!0;for(const e of r){const a=d(e,o,n,i),m=l(e,o,n,i);switch(e.type){case"group":t.push({type:"separator",label:e.name,active:a,hasActiveSubItem:m}),c({...s,contentItems:e.items,sidebarItems:t});break;case"tag":const f={type:"group",label:e.name,items:[],link:e.href,active:a,hasActiveSubItem:m,modified:!0};t.push(f),c({contentItems:e.items,sidebarItems:f.items||[],activeItemId:o,location:n,routingBasePath:i});break;case"operation":case"schema":case"tool":case"rsrc":case"prompt":e.isWebhook&&p&&e.parent.name!==A&&(t.push({type:"separator",label:"Webhooks",variant:"secondary"}),p=!1),t.push({type:"link",label:e.name,httpVerb:e.type=="operation"?e.httpVerb:e.type,link:e.href,badges:e.badges,active:a,hasActiveSubItem:m,modified:!0,deprecated:e.deprecated,isAdditionalOperation:e.isAdditionalOperation});break;case"section":if(e.depth===-1)continue;const u={type:e.items.length?"group":"link",label:e.name,link:e.href,items:[],active:a,hasActiveSubItem:m,modified:!0};t.push(u),e.items.length&&c({contentItems:e.items,sidebarItems:u.items,activeItemId:o,location:n,routingBasePath:i});break}}}export{L as useMenuItems};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Fragment as l,jsx as n,jsxs as f}from"react/jsx-runtime";import{memo as b,useEffect as h,useRef as u,useState as x}from"react";import{useAtom as y}from"jotai";import{useLocation as S}from"react-router
|
|
1
|
+
import{Fragment as l,jsx as n,jsxs as f}from"react/jsx-runtime";import{memo as b,useEffect as h,useRef as u,useState as x}from"react";import{useAtom as y}from"jotai";import{useLocation as S}from"react-router";import{useMount as v,breakpoints as k}from"@redocly/theme/core/openapi";import{isSidebarOpenedAtom as $}from"../../jotai/app.js";import{SidebarActions as g}from"./SidebarActions.js";import{styled as w}from"../../styled-components.js";const j=w.div`
|
|
2
2
|
overflow: hidden;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
backface-visibility: hidden;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { Tabs } from '../Tabs.js';
|
|
4
|
+
import { useTabsState } from '../useTabsState.js';
|
|
5
|
+
describe('Tabs', () => {
|
|
6
|
+
const TestComponent = () => {
|
|
7
|
+
const tabs = [
|
|
8
|
+
{ key: 'tab1', title: 'Tab 1' },
|
|
9
|
+
{ key: 'tab2', title: 'Tab 2' },
|
|
10
|
+
];
|
|
11
|
+
const { activeTab, handleTabChange } = useTabsState({ tabs });
|
|
12
|
+
return (_jsxs("div", { children: [_jsx(Tabs, { tabs: tabs, activeTab: tabs[0], onChange: handleTabChange }), _jsx("div", { children: activeTab === tabs[0].key ? 'Content 1' : 'Content 2' })] }));
|
|
13
|
+
};
|
|
14
|
+
test('should render tab list and content components', () => {
|
|
15
|
+
const { getByText } = render(_jsx(TestComponent, {}));
|
|
16
|
+
expect(getByText('Tab 1')).toBeInTheDocument();
|
|
17
|
+
expect(getByText('Tab 2')).toBeInTheDocument();
|
|
18
|
+
expect(getByText(/Content 1/)).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
test('should switch active tab when clicking on a Tab', () => {
|
|
21
|
+
const { getByText } = render(_jsx(TestComponent, {}));
|
|
22
|
+
const tab2 = getByText('Tab 2');
|
|
23
|
+
fireEvent.click(tab2);
|
|
24
|
+
expect(getByText(/Content 2/)).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=Tabs.test.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as s,jsxs as y}from"react/jsx-runtime";import{useMemo as E,memo as W,useState as _,useCallback as D}from"react";import{useNavigate as V}from"react-router
|
|
1
|
+
import{jsx as s,jsxs as y}from"react/jsx-runtime";import{useMemo as E,memo as W,useState as _,useCallback as D}from"react";import{useNavigate as V}from"react-router";import{LayoutVariant as z}from"@redocly/config";import{useAtomValue as K}from"jotai/index";import{SamplesPanel as L}from"../common/index.js";import{layoutAtom as X}from"../../jotai/app.js";import{OperationNavigationItems as i}from"./OperationNavigationItems.js";import{StyledButton as q}from"./styled.js";import{useTranslate as F}from"../../hooks/index.js";import{styled as x}from"../../styled-components.js";import{isRenderableMenuItem as G}from"../../utils/menu.js";const b=8;function H({items:c,routingBasePath:n}){const o=F(),[p,w]=_(!1),C=V(),O=K(X)===z.STACKED,{operations:m,webhooks:h,schemas:u,mcpTools:d,showMoreCount:v,totalCount:P,mcpResources:g,mcpPrompts:f,tags:l}=E(()=>{const a=c.filter(e=>G(e)),T=p?a:a.slice(0,b),{operations:M,additionalOperations:R,webhooks:A,schemas:B,mcpTools:I,mcpResources:N,mcpPrompts:j}=T.reduce((e,t)=>{if(t.type==="operation"&&t.isWebhook)e.webhooks.push(t);else if(t.type==="operation"){const k=t;k.isAdditionalOperation?e.additionalOperations.push(k):e.operations.push(k)}else t.type==="schema"?e.schemas.push(t):t.type==="tool"?e.mcpTools.push(t):t.type==="rsrc"?e.mcpResources.push(t):t.type==="prompt"&&e.mcpPrompts.push(t);return e},{operations:[],additionalOperations:[],webhooks:[],schemas:[],mcpTools:[],mcpResources:[],mcpPrompts:[]});return{operations:[...M,...R],schemas:B,mcpTools:I,webhooks:A,mcpResources:N,mcpPrompts:j,showMoreCount:!p&&a.length>b?a.length-b:0,totalCount:a.length,tags:c.filter(e=>e.type==="tag")}},[p,c]),r=D(a=>C(a),[C]),S=u.length>0||d.length>0||g.length>0||f.length>0||m.length>0||h.length>0;return!P&&l.length===0?null:y(J,{isStacked:O,"data-testid":"operation-navigation-list",children:[u.length>0&&s(i,{items:u,onClick:r,routingBasePath:n,translate:o,title:o("openapi.schemas","Schemas")}),d.length>0&&s(i,{items:d,onClick:r,routingBasePath:n,translate:o,title:o("openapi.mcp.tools","MCP Tools")}),g.length>0&&s(i,{items:g,onClick:r,routingBasePath:n,translate:o,title:o("openapi.mcp.resources","MCP Resources")}),f.length>0&&s(i,{items:f,onClick:r,routingBasePath:n,translate:o,title:o("openapi.mcp.prompts","MCP Prompts")}),m.length>0&&s(i,{items:m,onClick:r,routingBasePath:n,translate:o,title:o("openapi.operations","Operations")}),h.length>0&&s(i,{items:h,onClick:r,routingBasePath:n,translate:o,title:o("openapi.webhooks","Webhooks")}),!p&&!!v&&y(U,{variant:"link",size:"large","data-testid":"show-more-operations",fullWidth:!0,onClick:()=>w(!0),children:[o("openapi.actions.show","Show")," ",v," ",o("openapi.actions.more","more"),"..."]}),l.length>0&&S&&s(Q,{}),l.length>0&&s(i,{items:l,onClick:r,routingBasePath:n,translate:o,disableTooltip:!0})]})}const co=W(H),J=x(L)`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: var(--spacing-xxs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as i,jsxs as e}from"react/jsx-runtime";import{memo as T,useCallback as v}from"react";import{useNavigate as W}from"react-router
|
|
1
|
+
import{jsx as i,jsxs as e}from"react/jsx-runtime";import{memo as T,useCallback as v}from"react";import{useNavigate as W}from"react-router";import{useAtomValue as M}from"jotai";import{LayoutVariant as C}from"@redocly/config";import{Markdown as o}from"@redocly/theme/components/Markdown/Markdown";import{breakpoints as d}from"@redocly/theme/core/openapi";import{Button as I}from"@redocly/theme/components/Button/Button";import{PageActions as j}from"@redocly/theme/components/PageActions/PageActions";import{H2 as B}from"@redocly/theme/components/Typography/H2";import{LinkIcon as A}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{encodeBackSlashes as L,getBreadcrumbs as H}from"../../utils/index.js";import{joinWithSeparator as $}from"../../services/history/helpers.js";import{Row as P,SamplesMiddlePanel as w,SamplesPanel as c,ShareLink as D}from"../common/index.js";import{Markdown as N}from"../Markdown/index.js";import{OperationsNavigation as V}from"./OperationsNavigation.js";import{Breadcrumbs as _}from"./Breadcrumbs.js";import{layoutAtom as E}from"../../jotai/app.js";import{useTranslate as F}from"../../hooks/index.js";import{styled as r}from"../../styled-components.js";import{StyledShareLink as K}from"../common/linkify.js";function O({item:a,routingBasePath:n="",isExpanded:g}){const b=F(),{description:k,name:f,href:x}=a,t=W(),h=M(E),l=$(n,a.href),S=v(()=>{t(l)},[t,l]),p=!!a.items.length,m=h===C.STACKED,s=!p,u=H(a),y=v(z=>{t($(n,L(z)))},[t,n]);return e(R,{expanded:g,children:[e(P,{layout:h,children:[e(q,{fullWidth:s,isStacked:m,children:[e(G,{fullWidth:s,isStacked:m,children:[u.length>0&&i(_,{breadcrumbs:u,onClick:y}),e(Q,{children:[i(D,{to:x,"aria-label":`link to ${f}`}),f]}),i(j,{pageSlug:l})]}),i(J,{fullWidth:s,isStacked:m,children:i(N,{source:k})})]}),p&&i(V,{items:a.items,routingBasePath:n})]}),p&&!g&&e(U,{type:"button",variant:"text",size:"medium",onClick:S,children:["+ ",b("openapi.actions.show","Show")]})]})}const $a=T(O),R=r.div`
|
|
2
2
|
padding-top: var(--spacing-lg);
|
|
3
3
|
padding-bottom: ${({expanded:a})=>a?"var(--spacing-xxl)":""};
|
|
4
4
|
`,q=r(w)`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { ViewNested } from '../ViewNested.js';
|
|
4
|
+
describe('ViewNested', () => {
|
|
5
|
+
it('should render nested array content directly without show properties button', () => {
|
|
6
|
+
render(_jsx(ViewNested, { expandByDefault: false, isNestedArray: true, children: _jsx("div", { children: "Nested Array Content" }) }));
|
|
7
|
+
expect(screen.getByText('Nested Array Content')).toBeInTheDocument();
|
|
8
|
+
expect(screen.queryByText(/Show \d+ properties/)).toBeNull();
|
|
9
|
+
});
|
|
10
|
+
it('should auto-expand nested arrays', () => {
|
|
11
|
+
render(_jsx(ViewNested, { expandByDefault: false, isNestedArray: true, children: _jsx("div", { children: "Nested Content" }) }));
|
|
12
|
+
const nestedContent = screen.getByText('Nested Content');
|
|
13
|
+
expect(nestedContent).toBeVisible();
|
|
14
|
+
});
|
|
15
|
+
it('should expand via "Expand all" within the depth limit', () => {
|
|
16
|
+
render(_jsx(ViewNested, { expandByDefault: false, expandable: true, expandText: "Show 1 property", level: 5, expandedAll: true, children: _jsx("div", { children: "Deep Content" }) }));
|
|
17
|
+
expect(screen.getByText('Deep Content')).toBeInTheDocument();
|
|
18
|
+
expect(screen.queryByText('Show 1 property')).toBeNull();
|
|
19
|
+
});
|
|
20
|
+
it('should NOT auto-expand beyond the depth limit on "Expand all" (prevents freeze on DAG-shaped schemas)', () => {
|
|
21
|
+
render(_jsx(ViewNested, { expandByDefault: false, expandable: true, expandText: "Show 1 property", level: 50, expandedAll: true, children: _jsx("div", { children: "Very Deep Content" }) }));
|
|
22
|
+
// Stays collapsed: the node is still manually expandable, just not force-expanded.
|
|
23
|
+
expect(screen.queryByText('Very Deep Content')).toBeNull();
|
|
24
|
+
expect(screen.getByText('Show 1 property')).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
it('should respect the adaptive expandAllDepth over the default ceiling', () => {
|
|
27
|
+
render(_jsx(ViewNested, { expandByDefault: false, expandable: true, expandText: "Show 1 property", level: 6, expandedAll: true, expandAllDepth: 5, children: _jsx("div", { children: "Adaptive Deep Content" }) }));
|
|
28
|
+
expect(screen.queryByText('Adaptive Deep Content')).toBeNull();
|
|
29
|
+
expect(screen.getByText('Show 1 property')).toBeInTheDocument();
|
|
30
|
+
});
|
|
31
|
+
it('should cap expandAllDepth by the ceiling even when the budget allows more', () => {
|
|
32
|
+
render(_jsx(ViewNested, { expandByDefault: false, expandable: true, expandText: "Show 1 property", level: 12, expandedAll: true, expandAllDepth: 15, children: _jsx("div", { children: "Beyond Ceiling Content" }) }));
|
|
33
|
+
expect(screen.queryByText('Beyond Ceiling Content')).toBeNull();
|
|
34
|
+
expect(screen.getByText('Show 1 property')).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
it('should always collapse on "Collapse all" regardless of depth', () => {
|
|
37
|
+
render(_jsx(ViewNested, { expandByDefault: true, expandable: true, expandText: "Show 1 property", level: 50, expandedAll: false, children: _jsx("div", { children: "Deep Content To Collapse" }) }));
|
|
38
|
+
expect(screen.queryByText('Deep Content To Collapse')).toBeNull();
|
|
39
|
+
expect(screen.getByText('Show 1 property')).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=ViewNested.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { ExampleSwitch } from '../../Samples/index.js';
|
|
4
|
+
import { exampleXML, examples } from '../mocks/examples.js';
|
|
5
|
+
describe('ExampleSwitch', () => {
|
|
6
|
+
const exampleKey = 'cat';
|
|
7
|
+
it('should correctly render ExampleSwitch', () => {
|
|
8
|
+
const { getByTestId, getAllByRole } = render(_jsx(ExampleSwitch, { exampleKey: exampleKey, examples: examples, onChange: () => { } }));
|
|
9
|
+
expect(getByTestId('dropdown')).toBeInTheDocument();
|
|
10
|
+
const triggerButton = getByTestId('dropdown').querySelector('button');
|
|
11
|
+
if (triggerButton) {
|
|
12
|
+
fireEvent.click(triggerButton);
|
|
13
|
+
}
|
|
14
|
+
const menuItems = getAllByRole('menuitem');
|
|
15
|
+
expect(menuItems.length).toBe(3);
|
|
16
|
+
});
|
|
17
|
+
it('should correctly display ExampleSwitch with a different number of examples in the media type', () => {
|
|
18
|
+
let examplesObj = {
|
|
19
|
+
exampleKey: 'bee',
|
|
20
|
+
examples: examples,
|
|
21
|
+
};
|
|
22
|
+
const { getByTestId, getAllByRole, rerender } = render(_jsx(ExampleSwitch, { exampleKey: examplesObj.exampleKey, examples: examplesObj.examples, onChange: () => { } }));
|
|
23
|
+
expect(getByTestId('dropdown')).toBeInTheDocument();
|
|
24
|
+
let triggerButton = getByTestId('dropdown').querySelector('button');
|
|
25
|
+
if (triggerButton) {
|
|
26
|
+
fireEvent.click(triggerButton);
|
|
27
|
+
}
|
|
28
|
+
expect(getAllByRole('menuitem').length).toBe(3);
|
|
29
|
+
if (triggerButton) {
|
|
30
|
+
fireEvent.click(triggerButton);
|
|
31
|
+
}
|
|
32
|
+
examplesObj = {
|
|
33
|
+
exampleKey: 'foo',
|
|
34
|
+
examples: exampleXML,
|
|
35
|
+
};
|
|
36
|
+
rerender(_jsx(ExampleSwitch, { exampleKey: examplesObj.exampleKey, examples: examplesObj.examples, onChange: () => { } }));
|
|
37
|
+
expect(getByTestId('dropdown')).toBeInTheDocument();
|
|
38
|
+
triggerButton = getByTestId('dropdown').querySelector('button');
|
|
39
|
+
if (triggerButton) {
|
|
40
|
+
fireEvent.click(triggerButton);
|
|
41
|
+
}
|
|
42
|
+
expect(getAllByRole('menuitem').length).toBe(2);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=ExampleSwitch.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { normalizeOptions, OpenAPIParser, } from '../../../services/index.js';
|
|
3
|
+
import { getOperation } from '../../../models/index.js';
|
|
4
|
+
import testDefinition from '../../MediaTypeSwitch/__tests__/fixtures/test-definition.json';
|
|
5
|
+
import { useExampleKey } from '../../Samples/use-example-key.js';
|
|
6
|
+
describe('useExampleKey method', () => {
|
|
7
|
+
const options = normalizeOptions({});
|
|
8
|
+
const parser = new OpenAPIParser(testDefinition, undefined, options);
|
|
9
|
+
test('should take firstKey as exampleKey if activeExampleName and defaultExampleName are missing', () => {
|
|
10
|
+
const operation = getOperation(parser, {
|
|
11
|
+
pointer: '#/paths/~1test/get',
|
|
12
|
+
pathName: '/test',
|
|
13
|
+
httpVerb: 'GET',
|
|
14
|
+
pathParameters: [],
|
|
15
|
+
pathServers: [],
|
|
16
|
+
isWebhook: false,
|
|
17
|
+
operationId: 'getPet',
|
|
18
|
+
...testDefinition.paths['/test'].get,
|
|
19
|
+
}, undefined, options, '');
|
|
20
|
+
const { result } = renderHook(() => useExampleKey(operation, { key: 'test' }));
|
|
21
|
+
expect(result.current.exampleKey).toBe('key');
|
|
22
|
+
});
|
|
23
|
+
test('should not brake if no operation passed and should take firstKey as exampleKey', () => {
|
|
24
|
+
const { result } = renderHook(() => useExampleKey(undefined, { key: 'test' }));
|
|
25
|
+
expect(result.current.exampleKey).toBe('key');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=use-example-key.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { ClearButton } from '../../common/ClearButton/index.js';
|
|
6
|
+
describe('ClearButton component', () => {
|
|
7
|
+
const handleClear = vi.fn();
|
|
8
|
+
it('render component correctly', () => {
|
|
9
|
+
const { container } = render(_jsx(ClearButton, { handleClear: handleClear }));
|
|
10
|
+
expect(container).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
it('trigger `handleClear` func on click', async () => {
|
|
13
|
+
const { getByRole } = render(_jsx(ClearButton, { handleClear: handleClear }));
|
|
14
|
+
await userEvent.click(getByRole('button'));
|
|
15
|
+
expect(handleClear).toHaveBeenCalled();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=ClearButton.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { Select, SimpleSelect } from '../../common/Select/index.js';
|
|
4
|
+
describe('Select component', () => {
|
|
5
|
+
const onChange = vi.fn();
|
|
6
|
+
const options = [
|
|
7
|
+
{ idx: 0, title: 'First option', value: 'option1' },
|
|
8
|
+
{ idx: 1, title: 'Second option', value: 'option2' },
|
|
9
|
+
];
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
vi.clearAllMocks();
|
|
12
|
+
});
|
|
13
|
+
it('render Select component correctly', () => {
|
|
14
|
+
const { container, getByTestId, getAllByRole } = render(_jsx(Select, { variant: "dark", options: options, value: options[0].value, onChange: onChange }));
|
|
15
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
16
|
+
const dropdown = getByTestId('dropdown');
|
|
17
|
+
const triggerButton = dropdown.querySelector('button');
|
|
18
|
+
expect(triggerButton).toBeInTheDocument();
|
|
19
|
+
if (triggerButton) {
|
|
20
|
+
fireEvent.click(triggerButton);
|
|
21
|
+
}
|
|
22
|
+
const menuItems = getAllByRole('menuitem');
|
|
23
|
+
fireEvent.click(menuItems[1]);
|
|
24
|
+
expect(onChange).toHaveBeenCalled();
|
|
25
|
+
});
|
|
26
|
+
it('render SimpleSelect dark variant correctly', () => {
|
|
27
|
+
const { container, getByTestId, getAllByRole } = render(_jsx(SimpleSelect, { variant: "dark", options: options, value: options[0].value, onChange: onChange }));
|
|
28
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
29
|
+
const dropdown = getByTestId('dropdown');
|
|
30
|
+
const triggerButton = dropdown.querySelector('button');
|
|
31
|
+
expect(triggerButton).toBeInTheDocument();
|
|
32
|
+
if (triggerButton) {
|
|
33
|
+
fireEvent.click(triggerButton);
|
|
34
|
+
}
|
|
35
|
+
const menuItems = getAllByRole('menuitem');
|
|
36
|
+
fireEvent.click(menuItems[1]);
|
|
37
|
+
expect(onChange).toHaveBeenCalled();
|
|
38
|
+
});
|
|
39
|
+
it('render Select with empty init value', () => {
|
|
40
|
+
const { getByTestId, getAllByRole } = render(_jsx(Select, { variant: "dark", options: options, value: "", onChange: onChange }));
|
|
41
|
+
const dropdown = getByTestId('dropdown');
|
|
42
|
+
const triggerButton = dropdown.querySelector('button');
|
|
43
|
+
if (triggerButton) {
|
|
44
|
+
fireEvent.click(triggerButton);
|
|
45
|
+
}
|
|
46
|
+
const menuItems = getAllByRole('menuitem');
|
|
47
|
+
expect(menuItems[0]).toHaveTextContent('First option');
|
|
48
|
+
fireEvent.click(menuItems[1]);
|
|
49
|
+
expect(onChange).toHaveBeenCalled();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=Dropdown.test.js.map
|