@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,226 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, waitFor,
|
|
3
|
+
// @community-ignore
|
|
4
|
+
fireEvent,
|
|
5
|
+
// @community-ignore-end
|
|
6
|
+
} from '@testing-library/react';
|
|
7
|
+
import * as Jotai from 'jotai/index';
|
|
8
|
+
import * as useCodeSamplesModule from '../useCodeSamples.js';
|
|
9
|
+
import { RequestSamples } from '../RequestSamples.js';
|
|
10
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
11
|
+
import { getMediaContent, getOperation } from '../../../models/index.js';
|
|
12
|
+
import { withTestProviders } from '../../../testProviders.js';
|
|
13
|
+
import petStore from './fixtures/petstore.json';
|
|
14
|
+
import definition from './fixtures/operationDefinition.json';
|
|
15
|
+
import {
|
|
16
|
+
// @community-ignore
|
|
17
|
+
environmentAtom,
|
|
18
|
+
// @community-ignore-end
|
|
19
|
+
languageAtom, } from '../../../jotai/app.js';
|
|
20
|
+
import { globalStoreAtom } from '../../../jotai/store.js';
|
|
21
|
+
// @community-ignore
|
|
22
|
+
vi.mock('../../Replay', () => ({
|
|
23
|
+
Replay: () => _jsx("div", { children: "Replay" }),
|
|
24
|
+
}));
|
|
25
|
+
// @community-ignore-end
|
|
26
|
+
vi.mock('jotai', async () => {
|
|
27
|
+
const actual = await vi.importActual('jotai');
|
|
28
|
+
return {
|
|
29
|
+
...actual,
|
|
30
|
+
useAtomValue: vi.fn((atom) => {
|
|
31
|
+
if (atom === languageAtom) {
|
|
32
|
+
return {
|
|
33
|
+
activeLanguage: 'python',
|
|
34
|
+
languages: ['python', 'javascript'],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return actual.useAtomValue(atom);
|
|
38
|
+
}),
|
|
39
|
+
useAtom: vi.fn((atom) => {
|
|
40
|
+
if (atom === languageAtom) {
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
activeLanguage: 'python',
|
|
44
|
+
languages: ['python', 'javascript'],
|
|
45
|
+
},
|
|
46
|
+
vi.fn(),
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
return actual.useAtom(atom);
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
vi.mock('@redocly/theme/core/openapi', async () => ({
|
|
54
|
+
...(await vi.importActual('@redocly/theme/core/openapi')),
|
|
55
|
+
getOperationColor: vi.fn(() => 'blue'),
|
|
56
|
+
}));
|
|
57
|
+
describe('Components', () => {
|
|
58
|
+
describe('RequestSamples', () => {
|
|
59
|
+
let operation;
|
|
60
|
+
const options = normalizeOptions({});
|
|
61
|
+
const parser = new OpenAPIParser(petStore, undefined, options);
|
|
62
|
+
const info = {
|
|
63
|
+
'application/json': {
|
|
64
|
+
schema: {
|
|
65
|
+
additionalProperties: {
|
|
66
|
+
format: 'int32',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
examples: {
|
|
70
|
+
bee: {
|
|
71
|
+
mime: 'application/json',
|
|
72
|
+
value: {
|
|
73
|
+
category: {
|
|
74
|
+
id: 0,
|
|
75
|
+
name: 'string',
|
|
76
|
+
},
|
|
77
|
+
honeyPerDay: 3.14,
|
|
78
|
+
id: 0,
|
|
79
|
+
petType: 'bee',
|
|
80
|
+
status: 'available',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
cat: {
|
|
84
|
+
mime: 'application/json',
|
|
85
|
+
value: {
|
|
86
|
+
category: {
|
|
87
|
+
id: 0,
|
|
88
|
+
name: 'string',
|
|
89
|
+
},
|
|
90
|
+
huntingSkill: 'adventurous',
|
|
91
|
+
id: 0,
|
|
92
|
+
petType: 'cat',
|
|
93
|
+
status: 'available',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
'application/xml': {
|
|
99
|
+
schema: {
|
|
100
|
+
additionalProperties: {
|
|
101
|
+
format: 'int32',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
// @community-ignore
|
|
107
|
+
test('should renders correctly with mimeType and Example Dropdowns', async () => {
|
|
108
|
+
operation = getOperation(parser, definition, undefined, options, '');
|
|
109
|
+
const PROPS = {
|
|
110
|
+
operation,
|
|
111
|
+
content: getMediaContent({
|
|
112
|
+
parser,
|
|
113
|
+
info,
|
|
114
|
+
isRequestType: true,
|
|
115
|
+
options,
|
|
116
|
+
data: { operation },
|
|
117
|
+
}),
|
|
118
|
+
};
|
|
119
|
+
const { getAllByTestId, getAllByRole, getAllByText } = render(withTestProviders(_jsx(RequestSamples, { ...PROPS }), {
|
|
120
|
+
definition: parser.definition,
|
|
121
|
+
}));
|
|
122
|
+
await waitFor(() => {
|
|
123
|
+
const dropdowns = getAllByTestId('dropdown');
|
|
124
|
+
expect(dropdowns.length).toBeGreaterThanOrEqual(2);
|
|
125
|
+
expect(getAllByText('cat').length).toBeGreaterThanOrEqual(1);
|
|
126
|
+
expect(getAllByText('application/json').length).toBeGreaterThanOrEqual(1);
|
|
127
|
+
});
|
|
128
|
+
const dropdowns = getAllByTestId('dropdown');
|
|
129
|
+
for (const dropdown of dropdowns) {
|
|
130
|
+
const trigger = dropdown.querySelector('button');
|
|
131
|
+
if (trigger) {
|
|
132
|
+
fireEvent.click(trigger);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
await waitFor(() => {
|
|
136
|
+
const menuItems = getAllByRole('menuitem');
|
|
137
|
+
expect(menuItems.length).toBeGreaterThanOrEqual(4);
|
|
138
|
+
expect(getAllByText('bee').length).toBeGreaterThanOrEqual(1);
|
|
139
|
+
expect(getAllByText('application/xml').length).toBeGreaterThanOrEqual(1);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
// @community-ignore-end
|
|
143
|
+
test('should renders correctly without mimeType selector', () => {
|
|
144
|
+
operation = getOperation(parser, definition, undefined, options, '');
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
operation.requestBody.content.mediaTypes = operation.requestBody?.content?.mediaTypes.filter((m) => m.name === 'application/json');
|
|
147
|
+
const PROPS = {
|
|
148
|
+
onlyDefaultMimeType: true,
|
|
149
|
+
operation,
|
|
150
|
+
content: getMediaContent({
|
|
151
|
+
parser,
|
|
152
|
+
info,
|
|
153
|
+
isRequestType: true,
|
|
154
|
+
options,
|
|
155
|
+
data: { operation },
|
|
156
|
+
}),
|
|
157
|
+
};
|
|
158
|
+
const { queryByText } = render(withTestProviders(_jsx(RequestSamples, { ...PROPS }), {
|
|
159
|
+
definition: parser.definition,
|
|
160
|
+
}));
|
|
161
|
+
expect(queryByText('application/json', { selector: 'label' })).not.toBeInTheDocument();
|
|
162
|
+
});
|
|
163
|
+
test('should renders correctly with empty languages', async () => {
|
|
164
|
+
vi.spyOn(Jotai, 'useAtom').mockImplementation((atom) => {
|
|
165
|
+
if (atom === languageAtom) {
|
|
166
|
+
return [
|
|
167
|
+
{
|
|
168
|
+
activeLanguage: undefined,
|
|
169
|
+
languages: [],
|
|
170
|
+
},
|
|
171
|
+
vi.fn(),
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
// @community-ignore
|
|
175
|
+
// For environmentAtom, return [[environment], setEnvironment] format
|
|
176
|
+
if (atom === environmentAtom) {
|
|
177
|
+
return [[{}], vi.fn()];
|
|
178
|
+
}
|
|
179
|
+
// @community-ignore-end
|
|
180
|
+
return [{}, vi.fn()];
|
|
181
|
+
});
|
|
182
|
+
vi.spyOn(Jotai, 'useAtomValue').mockImplementation((atom) => {
|
|
183
|
+
if (atom === languageAtom) {
|
|
184
|
+
return {
|
|
185
|
+
activeLanguage: undefined,
|
|
186
|
+
languages: [],
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
if (atom === globalStoreAtom)
|
|
190
|
+
return { options, parser };
|
|
191
|
+
// @community-ignore
|
|
192
|
+
if (atom === environmentAtom)
|
|
193
|
+
return [{}];
|
|
194
|
+
// @community-ignore-end
|
|
195
|
+
return {};
|
|
196
|
+
});
|
|
197
|
+
vi.spyOn(useCodeSamplesModule, 'useCodeSamples').mockReturnValue({
|
|
198
|
+
samples: [], // Empty samples array
|
|
199
|
+
});
|
|
200
|
+
const optionsWithEmptyLanguages = normalizeOptions({
|
|
201
|
+
codeSamples: {
|
|
202
|
+
languages: [],
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
operation = getOperation(parser, definition, undefined, optionsWithEmptyLanguages, '');
|
|
206
|
+
const PROPS = {
|
|
207
|
+
operation,
|
|
208
|
+
content: getMediaContent({
|
|
209
|
+
parser,
|
|
210
|
+
info,
|
|
211
|
+
isRequestType: true,
|
|
212
|
+
options: optionsWithEmptyLanguages,
|
|
213
|
+
data: { operation },
|
|
214
|
+
}),
|
|
215
|
+
};
|
|
216
|
+
const { container } = render(withTestProviders(_jsx(RequestSamples, { ...PROPS }), {
|
|
217
|
+
definition: parser.definition,
|
|
218
|
+
}));
|
|
219
|
+
await waitFor(() => {
|
|
220
|
+
expect(container.getElementsByClassName('dropdown-wrapper').length).toBe(0);
|
|
221
|
+
expect(container.getElementsByClassName('dropdown-option').length).toBe(0);
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
//# sourceMappingURL=RequestSamples.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
import * as Jotai from 'jotai/index';
|
|
3
|
+
import { getOperation } from '../../../models/index.js';
|
|
4
|
+
import definition from './fixtures/operationDefinition.json';
|
|
5
|
+
import { useCodeSamples } from '../useCodeSamples.js';
|
|
6
|
+
import { replaceCircularJson } from '../../../models/__tests__/helpers.js';
|
|
7
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
8
|
+
import petStore from './fixtures/petstore.json';
|
|
9
|
+
import { globalStoreAtom } from '../../../jotai/store.js';
|
|
10
|
+
// @community-ignore
|
|
11
|
+
import { environmentAtom } from '../../../jotai/app.js';
|
|
12
|
+
// @community-ignore-end
|
|
13
|
+
vi.mock('jotai', async () => ({
|
|
14
|
+
...(await vi.importActual('jotai')),
|
|
15
|
+
useAtomValue: vi.fn(),
|
|
16
|
+
}));
|
|
17
|
+
vi.mock('../../../hooks/useTranslate', () => ({
|
|
18
|
+
useTranslate: vi.fn(),
|
|
19
|
+
}));
|
|
20
|
+
vi.mock('@redocly/theme/ext/configure', async (importOriginal) => {
|
|
21
|
+
const actual = await importOriginal();
|
|
22
|
+
return {
|
|
23
|
+
...actual,
|
|
24
|
+
configure: vi.fn(),
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
describe('useCodeSamples', () => {
|
|
28
|
+
const options = normalizeOptions({});
|
|
29
|
+
const parser = new OpenAPIParser(petStore, undefined, options);
|
|
30
|
+
test('should return all codeSamples', () => {
|
|
31
|
+
const operation = getOperation(parser, definition, undefined, options, '');
|
|
32
|
+
vi.spyOn(Jotai, 'useAtomValue').mockImplementation((atom) => {
|
|
33
|
+
if (atom === globalStoreAtom)
|
|
34
|
+
return { options, parser };
|
|
35
|
+
// @community-ignore
|
|
36
|
+
if (atom === environmentAtom)
|
|
37
|
+
return [{}, ''];
|
|
38
|
+
// @community-ignore-end
|
|
39
|
+
return {};
|
|
40
|
+
});
|
|
41
|
+
const { samples } = useCodeSamples(operation);
|
|
42
|
+
expect(JSON.stringify([samples], replaceCircularJson)).toEqual(JSON.stringify([operation.payload, ...definition['x-codeSamples']], replaceCircularJson));
|
|
43
|
+
});
|
|
44
|
+
test('should return just payload and cURL', () => {
|
|
45
|
+
const options = normalizeOptions({
|
|
46
|
+
codeSamples: {
|
|
47
|
+
languages: [{ lang: 'curl' }, { lang: 'Payload', label: 'customPayloadLabel' }],
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
const operation = getOperation(parser, definition, undefined, options, '');
|
|
51
|
+
vi.spyOn(Jotai, 'useAtomValue').mockImplementation((atom) => {
|
|
52
|
+
if (atom === globalStoreAtom)
|
|
53
|
+
return { options, parser };
|
|
54
|
+
// @community-ignore
|
|
55
|
+
if (atom === environmentAtom)
|
|
56
|
+
return [{}, ''];
|
|
57
|
+
// @community-ignore-end
|
|
58
|
+
return {};
|
|
59
|
+
});
|
|
60
|
+
const { samples } = useCodeSamples(operation);
|
|
61
|
+
expect(JSON.stringify([samples], replaceCircularJson)).toEqual(JSON.stringify([operation.payload, ...definition['x-codeSamples']], replaceCircularJson));
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=useCodeSamples.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { ResponseSamples } from '../ResponseSamples.js';
|
|
4
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
5
|
+
import { getOperation } from '../../../models/index.js';
|
|
6
|
+
import { withTestProviders } from '../../../testProviders.js';
|
|
7
|
+
import museum from './fixtures/museum.json';
|
|
8
|
+
import definitionWithContent from './fixtures/operationDefinitionWithContent.json';
|
|
9
|
+
import definitionWithoutContent from './fixtures/operationDefinitionWithoutContent.json';
|
|
10
|
+
describe('ResponseSamples', () => {
|
|
11
|
+
let operation;
|
|
12
|
+
const options = normalizeOptions({});
|
|
13
|
+
const parser = new OpenAPIParser(museum, undefined, options);
|
|
14
|
+
it('renders PayloadSamples when response has a sample', () => {
|
|
15
|
+
operation = getOperation(parser, definitionWithContent, undefined, options, '');
|
|
16
|
+
const { container } = render(withTestProviders(_jsx(ResponseSamples, { operation: operation, activeResponseTab: "200", onTabChange: vi.fn() }), {
|
|
17
|
+
definition: parser.definition,
|
|
18
|
+
}));
|
|
19
|
+
expect(container).toHaveTextContent('2023-09-11');
|
|
20
|
+
});
|
|
21
|
+
it('renders StyledCodeBlock when response does not have a sample', () => {
|
|
22
|
+
operation = getOperation(parser, definitionWithoutContent, undefined, options, '');
|
|
23
|
+
const { container } = render(withTestProviders(_jsx(ResponseSamples, { operation: operation, activeResponseTab: "200", onTabChange: vi.fn() }), {
|
|
24
|
+
definition: parser.definition,
|
|
25
|
+
}));
|
|
26
|
+
expect(container).toHaveTextContent('No content');
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=ResponseSamples.test.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Fragment as w,jsx as o,jsxs as i}from"react/jsx-runtime";import{memo as C,useMemo as f}from"react";import{useLocation as E}from"react-router
|
|
1
|
+
import{Fragment as w,jsx as o,jsxs as i}from"react/jsx-runtime";import{memo as C,useMemo as f}from"react";import{useLocation as E}from"react-router";import{useAtomValue as u}from"jotai";import{Tabs as F,useTabsState as M}from"../Tabs/index.js";import{ResponseDetails as P}from"./ResponseDetails.js";import{makeDeepLink as N}from"../../services/index.js";import{Row as R,StyledTitle as S}from"./styled.js";import{LinkToField as _}from"../common/LinkToField.js";import{pathIncludesLink as h,hasNestedFields as B}from"../../utils/index.js";import{ExpandAllButton as $}from"../ExpandAllButton/index.js";import{computeExpandAllDepth as I}from"../ExpandAllButton/helpers.js";import{ExpandAllDepthContext as O}from"../../contexts/expand-all-depth.js";import{useTranslate as V}from"../../hooks/index.js";import{getActiveMediaType as W}from"../../models/index.js";import{activeMimeNameAtom as q}from"../../jotai/app.js";import{globalParserAtom as z}from"../../jotai/store.js";import{styled as G}from"../../styled-components.js";const ce=C(({responses:m,renderTitle:g,operationId:a,operationPointer:x,activeResponseTab:p,onTabChange:T,callbackId:b,onPanelToggle:v})=>{const l=E(),k=V(),c=u(q),d=u(z),r=m.map(({code:e})=>({key:e,title:e})),A=r.find(({key:e})=>e===p||h(l,a)&&h(l,`c=${e}`)),{activeTab:y,handleTabChange:D}=M({tabs:r,defaultTab:A?.key,onChange:T}),n=r.find(e=>e.key===(p||y)),t=m.find(e=>e.code===n?.key),s=f(()=>{if(!t?.content)return;const{schema:e}=W(t?.content,c)||{};return e},[c,t?.content]),L=B(s),j=f(()=>I(d,[s]),[d,s]);return n?i(w,{children:[i(H,{children:[g?.(n)||i(S,{children:[o(_,{to:N(a,`response&c=${n.key}`)}),k("openapi.responses","Responses")]}),o(F,{tabs:r,activeTab:n,onChange:D}),L&&o($,{type:"response",operationPointer:x,onPanelToggle:v})]}),t?o(O.Provider,{value:j,children:o("div",{children:o(P,{response:t,operationId:a,callbackId:b})},t.code)}):null]}):null}),H=G(R)`
|
|
2
2
|
flex-wrap: wrap;
|
|
3
3
|
gap: var(--spacing-unit);
|
|
4
4
|
margin-top: var(--spacing-xl);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { OperationResponseList } from '../OperationResponseList.js';
|
|
4
|
+
import { getMediaContent } from '../../../models/index.js';
|
|
5
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
6
|
+
import { withTestProviders, TestMemoryRouter } from '../../../testProviders.js';
|
|
7
|
+
const OPERATION_POINTER = '#/paths/~1pets/get';
|
|
8
|
+
// Wide enough that the second expansion level (45 * 45 = 2025 rows) blows the
|
|
9
|
+
// 2000-row budget, so computeExpandAllDepth returns 1 for this schema.
|
|
10
|
+
const WIDTH = 45;
|
|
11
|
+
function makeWideProperties(prefix, value) {
|
|
12
|
+
return Object.fromEntries(Array.from({ length: WIDTH }, (_, i) => [`${prefix}_${i}`, { ...value }]));
|
|
13
|
+
}
|
|
14
|
+
const definition = {
|
|
15
|
+
openapi: '3.0.0',
|
|
16
|
+
info: { title: 'test', version: '0' },
|
|
17
|
+
paths: {},
|
|
18
|
+
components: {
|
|
19
|
+
schemas: {
|
|
20
|
+
Small: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
nested: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: { leaf: { type: 'string' } },
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
Big: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: makeWideProperties('big', { $ref: '#/components/schemas/BigLeaf' }),
|
|
32
|
+
},
|
|
33
|
+
BigLeaf: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: makeWideProperties('leaf', { type: 'string' }),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
// The probe replaces the heavy ResponseDetails tree: it renders a real SubSchema
|
|
41
|
+
// (like the schema tree does) so the test observes the depth actually applied to
|
|
42
|
+
// nested nodes after the active response tab changes.
|
|
43
|
+
vi.mock('../ResponseDetails.js', async () => {
|
|
44
|
+
const { SubSchema } = await import('../../Schema/SubSchema.js');
|
|
45
|
+
return {
|
|
46
|
+
ResponseDetails: () => (_jsx(SubSchema, { expandByDefault: false, expandable: true, level: 2, propertyLength: WIDTH, deepLink: `${OPERATION_POINTER}/t=response`, operationPointer: OPERATION_POINTER, children: _jsx("div", { "data-testid": "nested-content" }) })),
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
const options = normalizeOptions({});
|
|
50
|
+
const parser = new OpenAPIParser(definition, undefined, options);
|
|
51
|
+
function makeResponse(code, schemaRef) {
|
|
52
|
+
return {
|
|
53
|
+
code,
|
|
54
|
+
expanded: false,
|
|
55
|
+
type: 'GET',
|
|
56
|
+
summary: '',
|
|
57
|
+
description: '',
|
|
58
|
+
headers: [],
|
|
59
|
+
toggle: vi.fn(),
|
|
60
|
+
expand: vi.fn(),
|
|
61
|
+
content: getMediaContent({
|
|
62
|
+
parser,
|
|
63
|
+
info: { 'application/json': { schema: { $ref: schemaRef } } },
|
|
64
|
+
isRequestType: false,
|
|
65
|
+
options,
|
|
66
|
+
data: { operation: { pointer: OPERATION_POINTER } },
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
describe('OperationResponseList expand-all depth', () => {
|
|
71
|
+
it('recomputes the expand-all depth when the active response tab changes', () => {
|
|
72
|
+
const responses = [
|
|
73
|
+
makeResponse('200', '#/components/schemas/Small'),
|
|
74
|
+
makeResponse('500', '#/components/schemas/Big'),
|
|
75
|
+
];
|
|
76
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(OperationResponseList, { responses: responses, operationId: "getPets", operationPointer: OPERATION_POINTER, callbackId: "" }) }), { definition }));
|
|
77
|
+
// Expand all while the small 200 schema is active: its depth is the ceiling,
|
|
78
|
+
// so the level-2 probe node expands.
|
|
79
|
+
fireEvent.click(screen.getByRole('button', { name: /expand all/i }));
|
|
80
|
+
expect(screen.getByTestId('nested-content')).toBeInTheDocument();
|
|
81
|
+
// Switch to the 500 tab with the DAG-shaped schema. The budgeted depth for it
|
|
82
|
+
// is 1, so the level-2 node must NOT auto-expand even though expandedAll is
|
|
83
|
+
// still on — otherwise the stale depth reintroduces the page freeze.
|
|
84
|
+
fireEvent.click(screen.getByText('500'));
|
|
85
|
+
expect(screen.getByRole('button', { name: /collapse all/i })).toBeInTheDocument();
|
|
86
|
+
expect(screen.queryByTestId('nested-content')).not.toBeInTheDocument();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=OperationResponseList.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai';
|
|
4
|
+
import { ResponseDetails } from '../ResponseDetails.js';
|
|
5
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
6
|
+
import { getField, getMediaContent } from '../../../models/index.js';
|
|
7
|
+
import { globalOptionsAtom, globalStoreAtom } from '../../../jotai/store.js';
|
|
8
|
+
import { activeMimeNameAtom } from '../../../jotai/app.js';
|
|
9
|
+
import { TestMemoryRouter } from '../../../testProviders.js';
|
|
10
|
+
const info = {
|
|
11
|
+
'application/json': {
|
|
12
|
+
schema: {
|
|
13
|
+
additionalProperties: {
|
|
14
|
+
format: 'int32',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
examples: {
|
|
18
|
+
bee: {
|
|
19
|
+
mime: 'application/json',
|
|
20
|
+
value: {
|
|
21
|
+
category: {
|
|
22
|
+
id: 0,
|
|
23
|
+
name: 'string',
|
|
24
|
+
},
|
|
25
|
+
honeyPerDay: 3.14,
|
|
26
|
+
id: 0,
|
|
27
|
+
petType: 'bee',
|
|
28
|
+
status: 'available',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
cat: {
|
|
32
|
+
mime: 'application/json',
|
|
33
|
+
value: {
|
|
34
|
+
category: {
|
|
35
|
+
id: 0,
|
|
36
|
+
name: 'string',
|
|
37
|
+
},
|
|
38
|
+
huntingSkill: 'adventurous',
|
|
39
|
+
id: 0,
|
|
40
|
+
petType: 'cat',
|
|
41
|
+
status: 'available',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
'application/xml': {
|
|
47
|
+
schema: {
|
|
48
|
+
additionalProperties: {
|
|
49
|
+
format: 'int32',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
const options = normalizeOptions({});
|
|
55
|
+
const parser = new OpenAPIParser({ openapi: '3.0', info: { title: 'test', version: '0' }, paths: {} }, undefined, options);
|
|
56
|
+
const response = {
|
|
57
|
+
expanded: false,
|
|
58
|
+
code: '200',
|
|
59
|
+
summary: `summary`,
|
|
60
|
+
description: `***\n**su*mm*ary**\n[link](/link)`,
|
|
61
|
+
type: 'GET',
|
|
62
|
+
headers: [
|
|
63
|
+
getField(parser, {
|
|
64
|
+
name: 'test',
|
|
65
|
+
in: 'path',
|
|
66
|
+
content: {
|
|
67
|
+
'application/json': {
|
|
68
|
+
schema: {
|
|
69
|
+
$ref: '#/components/testProperties/readOnlyInContent',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
}, '', options, { operation: {} }),
|
|
74
|
+
],
|
|
75
|
+
toggle: vi.fn(),
|
|
76
|
+
expand: vi.fn(),
|
|
77
|
+
content: getMediaContent({
|
|
78
|
+
parser,
|
|
79
|
+
info,
|
|
80
|
+
isRequestType: true,
|
|
81
|
+
options,
|
|
82
|
+
data: { operation: {} },
|
|
83
|
+
}),
|
|
84
|
+
};
|
|
85
|
+
vi.mock('jotai', async () => ({
|
|
86
|
+
...(await vi.importActual('jotai')),
|
|
87
|
+
useAtomValue: vi.fn(),
|
|
88
|
+
}));
|
|
89
|
+
describe('ResponseDetails component', () => {
|
|
90
|
+
vi.spyOn(Jotai, 'useAtomValue').mockImplementation((atom) => {
|
|
91
|
+
if (atom === globalOptionsAtom) {
|
|
92
|
+
return options;
|
|
93
|
+
}
|
|
94
|
+
if (atom === globalStoreAtom)
|
|
95
|
+
return { options, parser };
|
|
96
|
+
if (atom === activeMimeNameAtom)
|
|
97
|
+
return ['application/json', vi.fn()];
|
|
98
|
+
return {};
|
|
99
|
+
});
|
|
100
|
+
it('should renders correctly', () => {
|
|
101
|
+
const { container } = render(_jsx(TestMemoryRouter, { children: _jsx(ResponseDetails, { response: response, operationId: " " }) }));
|
|
102
|
+
expect(container.childNodes.length).toEqual(5);
|
|
103
|
+
});
|
|
104
|
+
it('should render description as markdown', () => {
|
|
105
|
+
const expectedTags = ['p'];
|
|
106
|
+
const { container } = render(_jsx(TestMemoryRouter, { children: _jsx(ResponseDetails, { response: { ...response, headers: [] }, operationId: "" }) }));
|
|
107
|
+
const markdownContainer = container.querySelector('.redoc-markdown');
|
|
108
|
+
expect(markdownContainer?.querySelectorAll(expectedTags.join(','))).toHaveLength(expectedTags.length);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=ResponseDetails.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { ResponseHeaders } from '../ResponseHeaders.js';
|
|
4
|
+
import { PropertiesTable } from '../../common/index.js';
|
|
5
|
+
vi.mock('../../common', () => ({
|
|
6
|
+
PropertiesTable: vi.fn(() => _jsx("div", { "data-testid": "properties-table" })),
|
|
7
|
+
}));
|
|
8
|
+
vi.mock('../../PropertyDetails', () => ({
|
|
9
|
+
Field: vi.fn(() => _jsx("div", { "data-testid": "property-details" })),
|
|
10
|
+
}));
|
|
11
|
+
describe('ResponseHeaders', () => {
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
vi.clearAllMocks();
|
|
14
|
+
});
|
|
15
|
+
test('renders nothing if headers are not defined', () => {
|
|
16
|
+
const { container } = render(_jsx(ResponseHeaders, { headers: undefined }));
|
|
17
|
+
expect(container.firstChild).toBeNull();
|
|
18
|
+
expect(PropertiesTable).not.toHaveBeenCalled();
|
|
19
|
+
});
|
|
20
|
+
test('renders nothing if headers array is empty', () => {
|
|
21
|
+
const { container } = render(_jsx(ResponseHeaders, { headers: [] }));
|
|
22
|
+
expect(container.firstChild).toBeNull();
|
|
23
|
+
expect(PropertiesTable).not.toHaveBeenCalled();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=ResponsesHeaders.test.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as i}from"react/jsx-runtime";import{memo as y}from"react";import{useAtomValue as S}from"jotai";import{useLocation as g}from"react-router
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{memo as y}from"react";import{useAtomValue as S}from"jotai";import{useLocation as g}from"react-router";import{ArraySchema as I}from"./ArraySchema.js";import{ObjectSchema as p}from"./ObjectSchema.js";import{OneOfSchema as L}from"./OneOfSchema.js";import{RecursiveSchema as u}from"./RecursiveSchema.js";import{operationStore as b}from"../../jotai/operation.js";import{FieldDetails as j}from"../PropertyDetails/index.js";import{pathIncludesLink as A}from"../../utils/index.js";import{styled as C}from"../../styled-components.js";function N({schema:e,onOneOfChange:n,...o}){const{activeOneOf:a}=S(b(e?.operationPointer||"")),s=g();if(!e)return null;const{type:t,oneOf:r,discriminatorProp:f,isCircular:O}=e;if(O)return i(u,{schema:e});if(f!==void 0){if(!r||!r.length)return console.warn(`Looks like you are using discriminator wrong: you don't have any definition inherited from the ${e.title}`),null;const c=r.findIndex(($,h)=>A(s,`d=${h}`)),l=c===-1?0:c,x=a[e.pointer]!==void 0?a[e.pointer]:l,d=r[x];return d?.isCircular?i(u,{schema:d}):i(p,{...o,schema:d,discriminator:{fieldName:f,parentSchema:e,activeOneOfIdx:l},onOneOfChange:n})}if(r!==void 0&&r.length>=1)return i(L,{...o,schema:e,onChange:n});const m=Array.isArray(t)?t:[t];if(m.includes("object")){if(e.fields?.length)return i(p,{...o,schema:e,onOneOfChange:n})}else if(m.includes("array"))return i(I,{...o,schema:e,onOneOfChange:n});const v={schema:e,name:o.fieldName||"",description:o.oneOfLevel?"":e.description,example:o.oneOfLevel?void 0:e.example,required:!1,deprecated:o.oneOfLevel?!1:e.deprecated,const:e.const};return i(P,{$hideBorder:o.hideBottomBorder,children:i(j,{field:v,fieldParentsName:o.fieldParentsName})})}const G=y(N),P=C.div`
|
|
2
2
|
width: 100%;
|
|
3
3
|
padding: var(--spacing-xxs) 0;
|
|
4
4
|
${({$hideBorder:e})=>!e&&"border-bottom: 1px solid var(--border-color-primary)"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as h}from"react/jsx-runtime";import{memo as S}from"react";import{useLocation as A}from"react-router
|
|
1
|
+
import{jsx as h}from"react/jsx-runtime";import{memo as S}from"react";import{useLocation as A}from"react-router";import{useAtomValue as w}from"jotai/index";import{pathIncludesLink as D}from"../../utils/index.js";import{operationStore as $}from"../../jotai/operation.js";import{extractTypeFromDeepLink as b}from"./helpers.js";import{ViewNested as y}from"../ViewNested/index.js";import{useTranslate as T}from"../../hooks/index.js";import{useExpandAllDepth as N}from"../../contexts/expand-all-depth.js";function j({expandByDefault:n,deepLink:e,level:r,expandable:p=!1,isNestedArray:m=!1,isArray:t="",propertyLength:o="",children:s,operationPointer:i}){const a=T(),l=A(),c=D(l,e),x=b(e),d=w($(i||"")),f=N(),u=t&&!o?`${a("openapi.actions.show","Show")} array items`:`${a("openapi.actions.show","Show")} ${Number(o)===1?"":o} ${t&&"array "}${o!==1?"properties":"property"}`;return h(y,{expandByDefault:n||c,level:r,isNestedArray:m,expandable:p,expandText:u,children:s,expandedAll:d[x]?.expandedAll,expandAllDepth:f})}const z=S(j);export{z as SubSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|