@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,191 @@
|
|
|
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 { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
5
|
+
import { FieldDetails } from '../FieldDetails.js';
|
|
6
|
+
import { getField } from '../../../models/index.js';
|
|
7
|
+
import spec from './fixtures/fields.json';
|
|
8
|
+
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
9
|
+
vi.mock('jotai', async () => ({
|
|
10
|
+
...(await vi.importActual('jotai')),
|
|
11
|
+
useAtomValue: vi.fn(),
|
|
12
|
+
}));
|
|
13
|
+
describe('FieldDetails', () => {
|
|
14
|
+
const options = normalizeOptions({});
|
|
15
|
+
const parser = new OpenAPIParser(spec, undefined, options);
|
|
16
|
+
const deps = { operation: { pointer: 'defaultPointer' } };
|
|
17
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(options);
|
|
18
|
+
it('should render FieldDetails with enum', async () => {
|
|
19
|
+
options.showAccessMode = true;
|
|
20
|
+
const field = getField(parser, {
|
|
21
|
+
name: 'test',
|
|
22
|
+
in: 'path',
|
|
23
|
+
content: {
|
|
24
|
+
'application/json': {
|
|
25
|
+
schema: {
|
|
26
|
+
$ref: '#/components/testProperties/fieldWithEnum',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
}, '', options, deps);
|
|
31
|
+
render(_jsx(FieldDetails, { field: field }), { wrapper: TestBrowserRouter });
|
|
32
|
+
expect(screen.getByText('Enum')).toBeInTheDocument();
|
|
33
|
+
expect(screen.getByText('"foo"')).toBeInTheDocument();
|
|
34
|
+
expect(screen.getByText('"bar"')).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
it('should render FieldDetails with enum and x-enumDescriptions', async () => {
|
|
37
|
+
const field = getField(parser, {
|
|
38
|
+
name: 'test',
|
|
39
|
+
in: 'path',
|
|
40
|
+
content: {
|
|
41
|
+
'application/json': {
|
|
42
|
+
schema: {
|
|
43
|
+
$ref: '#/components/testProperties/fieldWithEnumDescription',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
}, '', options, deps);
|
|
48
|
+
render(_jsx(FieldDetails, { field: field }), { wrapper: TestBrowserRouter });
|
|
49
|
+
expect(screen.getByText('Enum Value')).toBeInTheDocument();
|
|
50
|
+
expect(screen.getByText('foo')).toBeInTheDocument();
|
|
51
|
+
expect(screen.getByText('bar')).toBeInTheDocument();
|
|
52
|
+
expect(screen.getByText('Description foo')).toBeInTheDocument();
|
|
53
|
+
expect(screen.getByText('Description bar')).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
it('should render FieldDetails with enum and x-enumDescription with hiding value', async () => {
|
|
56
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({ maxDisplayedEnumValues: 1 }));
|
|
57
|
+
const field = getField(parser, {
|
|
58
|
+
name: 'test',
|
|
59
|
+
in: 'path',
|
|
60
|
+
content: {
|
|
61
|
+
'application/json': {
|
|
62
|
+
schema: {
|
|
63
|
+
$ref: '#/components/testProperties/fieldWithEnumDescription',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
}, '', options, deps);
|
|
68
|
+
render(_jsx(FieldDetails, { field: field }), { wrapper: TestBrowserRouter });
|
|
69
|
+
expect(screen.getByText('Value')).toBeInTheDocument();
|
|
70
|
+
expect(screen.getByText('foo')).toBeInTheDocument();
|
|
71
|
+
expect(screen.getByText('Description foo')).toBeInTheDocument();
|
|
72
|
+
expect(screen.getByText('+1 more')).toBeInTheDocument();
|
|
73
|
+
});
|
|
74
|
+
it('should not render duplicate descriptions for anyOf schemas', async () => {
|
|
75
|
+
const field = getField(parser, {
|
|
76
|
+
name: 'testAnyOf',
|
|
77
|
+
content: {
|
|
78
|
+
'application/json': {
|
|
79
|
+
schema: {
|
|
80
|
+
$ref: '#/components/anyOfSchemaWithDescription',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
}, '', options, deps);
|
|
85
|
+
render(_jsx(FieldDetails, { field: field }), { wrapper: TestBrowserRouter });
|
|
86
|
+
const descriptions = screen.queryAllByText('This is a test anyOf schema with description');
|
|
87
|
+
expect(descriptions).toHaveLength(0);
|
|
88
|
+
const plainTextDescriptions = screen.queryAllByText('A plain text value');
|
|
89
|
+
expect(plainTextDescriptions).toHaveLength(0);
|
|
90
|
+
const numberDescriptions = screen.queryAllByText('A number value');
|
|
91
|
+
expect(numberDescriptions).toHaveLength(0);
|
|
92
|
+
});
|
|
93
|
+
it('should keep only array-level info on the array field row when items have their own documentation', () => {
|
|
94
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(options);
|
|
95
|
+
const field = getField(parser, {
|
|
96
|
+
name: 'owners',
|
|
97
|
+
required: true,
|
|
98
|
+
schema: {
|
|
99
|
+
type: 'array',
|
|
100
|
+
minItems: 1,
|
|
101
|
+
maxItems: 20,
|
|
102
|
+
description: 'List of ACL groups.',
|
|
103
|
+
items: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
format: 'email',
|
|
106
|
+
maxLength: 256,
|
|
107
|
+
pattern: '^\\S+@\\S+$',
|
|
108
|
+
description: 'ACL group formatted as an email.',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
}, '', options, deps);
|
|
112
|
+
render(_jsx(FieldDetails, { field: field }), { wrapper: TestBrowserRouter });
|
|
113
|
+
expect(screen.getByText('owners')).toBeInTheDocument();
|
|
114
|
+
expect(screen.getByText('Array of strings')).toBeInTheDocument();
|
|
115
|
+
expect(screen.getByText('[ 1 .. 20 ] items')).toBeInTheDocument();
|
|
116
|
+
expect(screen.getByText('List of ACL groups.')).toBeInTheDocument();
|
|
117
|
+
// the items info is rendered in the nested items row instead
|
|
118
|
+
expect(screen.queryByText('(email)')).not.toBeInTheDocument();
|
|
119
|
+
expect(screen.queryByText('<= 256 characters')).not.toBeInTheDocument();
|
|
120
|
+
expect(screen.queryByText('^\\S+@\\S+$')).not.toBeInTheDocument();
|
|
121
|
+
expect(screen.queryByText('ACL group formatted as an email.')).not.toBeInTheDocument();
|
|
122
|
+
});
|
|
123
|
+
it('should hoist format of trivial items on the array field row', () => {
|
|
124
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(options);
|
|
125
|
+
const field = getField(parser, {
|
|
126
|
+
name: 'emails',
|
|
127
|
+
schema: {
|
|
128
|
+
type: 'array',
|
|
129
|
+
items: {
|
|
130
|
+
type: 'string',
|
|
131
|
+
format: 'email',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
}, '', options, deps);
|
|
135
|
+
render(_jsx(FieldDetails, { field: field }), { wrapper: TestBrowserRouter });
|
|
136
|
+
expect(screen.getByText('Array of strings')).toBeInTheDocument();
|
|
137
|
+
expect(screen.getByText('(email)')).toBeInTheDocument();
|
|
138
|
+
});
|
|
139
|
+
it('should render object property example pretty-printed with JSON highlighting', () => {
|
|
140
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(options);
|
|
141
|
+
const field = getField(parser, {
|
|
142
|
+
name: 'postal_address',
|
|
143
|
+
schema: {
|
|
144
|
+
type: 'object',
|
|
145
|
+
example: {
|
|
146
|
+
name: 'John Alfred Smith',
|
|
147
|
+
street: '123 Main Street',
|
|
148
|
+
city: 'San Francisco',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
}, '', options, deps);
|
|
152
|
+
render(_jsx(FieldDetails, { field: field }), { wrapper: TestBrowserRouter });
|
|
153
|
+
expect(screen.getByText('Example:')).toBeInTheDocument();
|
|
154
|
+
const viewer = screen.getByTestId('json-viewer');
|
|
155
|
+
// pretty-printed on multiple lines instead of a single-line JSON.stringify blob
|
|
156
|
+
expect(viewer.textContent).toContain('"John Alfred Smith"');
|
|
157
|
+
expect(viewer.textContent).toContain('\n');
|
|
158
|
+
expect(screen.queryByText(JSON.stringify(field.example))).not.toBeInTheDocument();
|
|
159
|
+
// syntax highlighting via code theme token spans
|
|
160
|
+
expect(viewer.querySelector('.token.string')).not.toBeNull();
|
|
161
|
+
});
|
|
162
|
+
it('should keep scalar property example inline without JSON viewer', () => {
|
|
163
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(options);
|
|
164
|
+
const field = getField(parser, {
|
|
165
|
+
name: 'custom_id',
|
|
166
|
+
schema: { type: 'string', example: 'HRIS-27' },
|
|
167
|
+
}, '', options, deps);
|
|
168
|
+
render(_jsx(FieldDetails, { field: field }), { wrapper: TestBrowserRouter });
|
|
169
|
+
expect(screen.getByText('"HRIS-27"')).toBeInTheDocument();
|
|
170
|
+
expect(screen.queryByTestId('json-viewer')).toBeNull();
|
|
171
|
+
});
|
|
172
|
+
it('should render x-badges with before position, no position, and after position', () => {
|
|
173
|
+
const field = getField(parser, {
|
|
174
|
+
name: 'experimentalFlag',
|
|
175
|
+
in: 'query',
|
|
176
|
+
required: false,
|
|
177
|
+
schema: { type: 'boolean' },
|
|
178
|
+
'x-badges': [
|
|
179
|
+
{ name: 'Beta', position: 'before' },
|
|
180
|
+
{ name: 'Experimental default' },
|
|
181
|
+
{ name: 'Experimental', position: 'after' },
|
|
182
|
+
],
|
|
183
|
+
}, '#/components/parameters/paramWithBadges', options, deps);
|
|
184
|
+
render(_jsx(FieldDetails, { field: field }), { wrapper: TestBrowserRouter });
|
|
185
|
+
expect(screen.getByText('Beta')).toBeInTheDocument();
|
|
186
|
+
expect(screen.getByText('Experimental default')).toBeInTheDocument();
|
|
187
|
+
expect(screen.getByText('Experimental')).toBeInTheDocument();
|
|
188
|
+
expect(screen.getByText('experimentalFlag')).toBeInTheDocument();
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
//# sourceMappingURL=FieldDetails.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, fireEvent, screen, act } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai';
|
|
4
|
+
import { PropertyDetails } from '../PropertyDetails.js';
|
|
5
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
6
|
+
import { getField } from '../../../models/index.js';
|
|
7
|
+
import spec from './fixtures/fields.json';
|
|
8
|
+
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
9
|
+
vi.mock('jotai', async () => ({
|
|
10
|
+
...(await vi.importActual('jotai')),
|
|
11
|
+
useAtomValue: vi.fn(),
|
|
12
|
+
}));
|
|
13
|
+
describe('Components', () => {
|
|
14
|
+
const options = normalizeOptions({});
|
|
15
|
+
const parser = new OpenAPIParser(spec, undefined, options);
|
|
16
|
+
const deps = { operation: { pointer: 'defaultPointer' } };
|
|
17
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(options);
|
|
18
|
+
it('should render FieldDetails without duplicate content', () => {
|
|
19
|
+
const field = getField(parser, {
|
|
20
|
+
$ref: '#/components/schemas/primitiveSchema',
|
|
21
|
+
}, '', options, deps);
|
|
22
|
+
render(_jsx(PropertyDetails, { field: field }), {
|
|
23
|
+
wrapper: TestBrowserRouter,
|
|
24
|
+
});
|
|
25
|
+
const occurrences = screen.getAllByText('any');
|
|
26
|
+
expect(occurrences.length).toBe(1);
|
|
27
|
+
});
|
|
28
|
+
it('should render FieldDetails with object schema', () => {
|
|
29
|
+
const field = getField(parser, {
|
|
30
|
+
$ref: '#/components/objectSchema',
|
|
31
|
+
}, '', options, deps);
|
|
32
|
+
const { getAllByText, queryByText, getByText } = render(_jsx(PropertyDetails, { field: field }), {
|
|
33
|
+
wrapper: TestBrowserRouter,
|
|
34
|
+
});
|
|
35
|
+
expect(queryByText('Show 2 properties')).not.toBeNull();
|
|
36
|
+
act(() => {
|
|
37
|
+
queryByText('Show 2 properties')?.click();
|
|
38
|
+
});
|
|
39
|
+
expect(getByText('status')).toBeInTheDocument();
|
|
40
|
+
expect(getByText('name')).toBeInTheDocument();
|
|
41
|
+
expect(getAllByText('string').length).toBe(2);
|
|
42
|
+
act(() => {
|
|
43
|
+
fireEvent.click(getByText('-'));
|
|
44
|
+
});
|
|
45
|
+
expect(getAllByText('Show 2 properties').length).toBe(1);
|
|
46
|
+
});
|
|
47
|
+
it('should render FieldDetails with Array of string schema', () => {
|
|
48
|
+
const field = getField(parser, {
|
|
49
|
+
$ref: '#/components/arraySchema',
|
|
50
|
+
name: 'test',
|
|
51
|
+
}, '', options, deps);
|
|
52
|
+
const { getByText } = render(_jsx(PropertyDetails, { field: field }), {
|
|
53
|
+
wrapper: TestBrowserRouter,
|
|
54
|
+
});
|
|
55
|
+
expect(getByText('Array of strings')).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
it('should render FieldDetails with Array of object schema', () => {
|
|
58
|
+
const field = getField(parser, {
|
|
59
|
+
$ref: '#/components/arrayOfObjectsSchema',
|
|
60
|
+
name: 'test',
|
|
61
|
+
}, '', options, deps);
|
|
62
|
+
const { getByText, container } = render(_jsx(PropertyDetails, { field: field, level: 2 }), {
|
|
63
|
+
wrapper: TestBrowserRouter,
|
|
64
|
+
});
|
|
65
|
+
expect(getByText('Array of objects')).toBeInTheDocument();
|
|
66
|
+
expect(getByText('Show 2 array properties')).toBeInTheDocument();
|
|
67
|
+
act(() => {
|
|
68
|
+
fireEvent.click(getByText('Show 2 array properties'));
|
|
69
|
+
});
|
|
70
|
+
expect(getByText('status')).toBeInTheDocument();
|
|
71
|
+
expect(getByText('name')).toBeInTheDocument();
|
|
72
|
+
expect(container.textContent.includes('test[].\u200Bname')).toBe(true);
|
|
73
|
+
expect(container.textContent.includes('test[].\u200Bstatus')).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
it('should render array of primitive items with own documentation as a nested items row', () => {
|
|
76
|
+
const field = getField(parser, {
|
|
77
|
+
name: 'owners',
|
|
78
|
+
schema: {
|
|
79
|
+
type: 'array',
|
|
80
|
+
minItems: 1,
|
|
81
|
+
maxItems: 20,
|
|
82
|
+
description: 'List of ACL groups.',
|
|
83
|
+
items: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
format: 'email',
|
|
86
|
+
maxLength: 256,
|
|
87
|
+
pattern: '^\\S+@\\S+$',
|
|
88
|
+
description: 'ACL group formatted as an email.',
|
|
89
|
+
example: 'john@example.com',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
}, '', options, deps);
|
|
93
|
+
const { getByText, queryByText, container } = render(_jsx(PropertyDetails, { field: field, level: 2 }), {
|
|
94
|
+
wrapper: TestBrowserRouter,
|
|
95
|
+
});
|
|
96
|
+
expect(getByText('Array of strings')).toBeInTheDocument();
|
|
97
|
+
expect(getByText('[ 1 .. 20 ] items')).toBeInTheDocument();
|
|
98
|
+
expect(getByText('List of ACL groups.')).toBeInTheDocument();
|
|
99
|
+
// items info is collapsed into the nested items row, including the items example
|
|
100
|
+
expect(queryByText('ACL group formatted as an email.')).not.toBeInTheDocument();
|
|
101
|
+
expect(queryByText('Example:')).not.toBeInTheDocument();
|
|
102
|
+
expect(getByText('Show array items')).toBeInTheDocument();
|
|
103
|
+
act(() => {
|
|
104
|
+
fireEvent.click(getByText('Show array items'));
|
|
105
|
+
});
|
|
106
|
+
expect(getByText('ACL group formatted as an email.')).toBeInTheDocument();
|
|
107
|
+
expect(getByText('<= 256 characters')).toBeInTheDocument();
|
|
108
|
+
expect(getByText('(email)')).toBeInTheDocument();
|
|
109
|
+
expect(getByText('"john@example.com"')).toBeInTheDocument();
|
|
110
|
+
// the items row is labeled `owners.[i]`, not `owners[].[i]`
|
|
111
|
+
expect(container.textContent.includes('owners.\u200B[i]')).toBe(true);
|
|
112
|
+
expect(container.textContent.includes('owners[]')).toBe(false);
|
|
113
|
+
});
|
|
114
|
+
it('should render a single deprecated badge for a deprecated primitive oneOf variant', () => {
|
|
115
|
+
const field = getField(parser, {
|
|
116
|
+
name: 'value',
|
|
117
|
+
schema: {
|
|
118
|
+
oneOf: [
|
|
119
|
+
{ type: 'string', deprecated: true, description: 'Legacy plain text value.' },
|
|
120
|
+
{ type: 'number' },
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
}, '', options, deps);
|
|
124
|
+
const { getAllByText } = render(_jsx(PropertyDetails, { field: field, level: 2 }), {
|
|
125
|
+
wrapper: TestBrowserRouter,
|
|
126
|
+
});
|
|
127
|
+
// OneOfSchema renders the badge for the active variant; the fallback row must not repeat it
|
|
128
|
+
expect(getAllByText('Deprecated')).toHaveLength(1);
|
|
129
|
+
});
|
|
130
|
+
it('should keep the items docs on the nested items row inside a oneOf variant', () => {
|
|
131
|
+
const field = getField(parser, {
|
|
132
|
+
name: 'value',
|
|
133
|
+
schema: {
|
|
134
|
+
oneOf: [
|
|
135
|
+
{
|
|
136
|
+
type: 'array',
|
|
137
|
+
items: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
maxLength: 256,
|
|
140
|
+
description: 'ACL group formatted as an email.',
|
|
141
|
+
example: 'john@example.com',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{ type: 'string' },
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
}, '', options, deps);
|
|
148
|
+
const { getByText } = render(_jsx(PropertyDetails, { field: field, level: 2 }), {
|
|
149
|
+
wrapper: TestBrowserRouter,
|
|
150
|
+
});
|
|
151
|
+
act(() => {
|
|
152
|
+
fireEvent.click(getByText('Show array items'));
|
|
153
|
+
});
|
|
154
|
+
expect(getByText('ACL group formatted as an email.')).toBeInTheDocument();
|
|
155
|
+
expect(getByText('"john@example.com"')).toBeInTheDocument();
|
|
156
|
+
});
|
|
157
|
+
it('should index prefixItems rows without the [] marker on the parent name', () => {
|
|
158
|
+
const tupleParser = new OpenAPIParser({
|
|
159
|
+
openapi: '3.1.0',
|
|
160
|
+
components: {
|
|
161
|
+
schemas: {
|
|
162
|
+
AclGroup: {
|
|
163
|
+
type: 'string',
|
|
164
|
+
maxLength: 256,
|
|
165
|
+
description: 'OSDU Access Control List (ACL) group that controls data access.',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
}, undefined, options);
|
|
170
|
+
const field = getField(tupleParser, {
|
|
171
|
+
name: 'owners',
|
|
172
|
+
schema: {
|
|
173
|
+
type: 'array',
|
|
174
|
+
minItems: 1,
|
|
175
|
+
maxItems: 20,
|
|
176
|
+
description: 'Description for property.',
|
|
177
|
+
example: ['data.default.owners@opendes.testing.slb.com'],
|
|
178
|
+
prefixItems: [
|
|
179
|
+
{
|
|
180
|
+
$ref: '#/components/schemas/AclGroup',
|
|
181
|
+
description: 'Sibling description for items 111.',
|
|
182
|
+
},
|
|
183
|
+
{ type: 'number', description: 'Description for second item. 222.' },
|
|
184
|
+
],
|
|
185
|
+
items: {
|
|
186
|
+
type: 'array',
|
|
187
|
+
description: 'Description for additional items.',
|
|
188
|
+
minItems: 2,
|
|
189
|
+
prefixItems: [
|
|
190
|
+
{ type: 'number', description: 'Description for first item. 111.' },
|
|
191
|
+
{ type: 'string', description: 'Description for second item. 222.' },
|
|
192
|
+
],
|
|
193
|
+
items: {
|
|
194
|
+
type: 'string',
|
|
195
|
+
description: 'Description for first item 333.',
|
|
196
|
+
maxLength: 256,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
}, '', options, deps);
|
|
201
|
+
const { getByText, queryByText, container } = render(_jsx(PropertyDetails, { field: field, level: 2 }), {
|
|
202
|
+
wrapper: TestBrowserRouter,
|
|
203
|
+
});
|
|
204
|
+
expect(getByText('Array of items')).toBeInTheDocument();
|
|
205
|
+
expect(getByText('[ 1 .. 20 ] items')).toBeInTheDocument();
|
|
206
|
+
expect(getByText('Description for property.')).toBeInTheDocument();
|
|
207
|
+
// the array example is distributed across the item rows, not repeated on the array row
|
|
208
|
+
expect(screen.queryByTestId('json-viewer')).toBeNull();
|
|
209
|
+
act(() => {
|
|
210
|
+
fireEvent.click(getByText('Show 3 properties'));
|
|
211
|
+
});
|
|
212
|
+
expect(getByText('"data.default.owners@opendes.testing.slb.com"')).toBeInTheDocument();
|
|
213
|
+
// tuple members are indexed on the parent name without the [] marker
|
|
214
|
+
expect(container.textContent.includes('owners.\u200B[0]')).toBe(true);
|
|
215
|
+
expect(container.textContent.includes('owners.\u200B[1]')).toBe(true);
|
|
216
|
+
expect(container.textContent.includes('owners.\u200B[2...]')).toBe(true);
|
|
217
|
+
expect(container.textContent.includes('owners[]')).toBe(false);
|
|
218
|
+
// the $ref sibling description wins on the prefix item row
|
|
219
|
+
expect(getByText('Sibling description for items 111.')).toBeInTheDocument();
|
|
220
|
+
expect(queryByText('OSDU Access Control List (ACL) group that controls data access.')).not.toBeInTheDocument();
|
|
221
|
+
expect(getByText('(AclGroup)')).toBeInTheDocument();
|
|
222
|
+
expect(getByText('<= 256 characters')).toBeInTheDocument();
|
|
223
|
+
expect(getByText('Description for additional items.')).toBeInTheDocument();
|
|
224
|
+
// the additional items schema is a tuple itself; its rows are indexed the same way
|
|
225
|
+
act(() => {
|
|
226
|
+
fireEvent.click(getByText('Show 3 properties'));
|
|
227
|
+
});
|
|
228
|
+
expect(container.textContent.includes('owners.\u200B[2...].\u200B[0]')).toBe(true);
|
|
229
|
+
expect(container.textContent.includes('owners.\u200B[2...].\u200B[1]')).toBe(true);
|
|
230
|
+
expect(container.textContent.includes('owners.\u200B[2...].\u200B[2...]')).toBe(true);
|
|
231
|
+
expect(getByText('Description for first item 333.')).toBeInTheDocument();
|
|
232
|
+
});
|
|
233
|
+
it('should render nested tuples with empty and items-less member schemas', () => {
|
|
234
|
+
// mirrors the OpenAPI 3.2 nested multipart/mixed example
|
|
235
|
+
const field = getField(parser, {
|
|
236
|
+
name: 'parts',
|
|
237
|
+
schema: {
|
|
238
|
+
type: 'array',
|
|
239
|
+
prefixItems: [
|
|
240
|
+
{ type: 'array' },
|
|
241
|
+
{
|
|
242
|
+
type: 'array',
|
|
243
|
+
prefixItems: [{ type: 'object' }, { type: 'string' }, {}],
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
}, '', options, deps);
|
|
248
|
+
const { getByText, container } = render(_jsx(PropertyDetails, { field: field, level: 2 }), {
|
|
249
|
+
wrapper: TestBrowserRouter,
|
|
250
|
+
});
|
|
251
|
+
expect(getByText('Array of items')).toBeInTheDocument();
|
|
252
|
+
act(() => {
|
|
253
|
+
fireEvent.click(getByText('Show 2 properties'));
|
|
254
|
+
});
|
|
255
|
+
// an items-less array member accepts any items
|
|
256
|
+
expect(container.textContent.includes('parts.\u200B[0]')).toBe(true);
|
|
257
|
+
expect(getByText('Array of any')).toBeInTheDocument();
|
|
258
|
+
expect(container.textContent.includes('parts.\u200B[1]')).toBe(true);
|
|
259
|
+
act(() => {
|
|
260
|
+
fireEvent.click(getByText('Show 3 properties'));
|
|
261
|
+
});
|
|
262
|
+
expect(container.textContent.includes('parts.\u200B[1].\u200B[0]')).toBe(true);
|
|
263
|
+
expect(getByText('object')).toBeInTheDocument();
|
|
264
|
+
expect(container.textContent.includes('parts.\u200B[1].\u200B[1]')).toBe(true);
|
|
265
|
+
expect(getByText('string')).toBeInTheDocument();
|
|
266
|
+
// an empty {} member schema accepts anything
|
|
267
|
+
expect(container.textContent.includes('parts.\u200B[1].\u200B[2]')).toBe(true);
|
|
268
|
+
expect(getByText('any')).toBeInTheDocument();
|
|
269
|
+
expect(container.textContent.includes('parts[]')).toBe(false);
|
|
270
|
+
});
|
|
271
|
+
it('should render FieldDetails with oneOf schema with object schema', () => {
|
|
272
|
+
const field = getField(parser, {
|
|
273
|
+
$ref: '#/components/oneOfSchemaWithObjectSchema',
|
|
274
|
+
name: 'test',
|
|
275
|
+
}, '', options, deps);
|
|
276
|
+
const { getByText, container } = render(_jsx(PropertyDetails, { field: field, level: 2 }), {
|
|
277
|
+
wrapper: TestBrowserRouter,
|
|
278
|
+
});
|
|
279
|
+
expect(getByText('Show 2 properties')).toBeInTheDocument();
|
|
280
|
+
act(() => {
|
|
281
|
+
fireEvent.click(getByText('Show 2 properties'));
|
|
282
|
+
});
|
|
283
|
+
expect(getByText('status')).toBeInTheDocument();
|
|
284
|
+
expect(getByText('name')).toBeInTheDocument();
|
|
285
|
+
expect(container.textContent.includes('test.\u200Bname')).toBe(true);
|
|
286
|
+
expect(container.textContent.includes('test.\u200Bstatus')).toBe(true);
|
|
287
|
+
});
|
|
288
|
+
it('should render FieldDetails with a oneOf schema at the first level without nesting', () => {
|
|
289
|
+
const field = getField(parser, {
|
|
290
|
+
$ref: '#/components/oneOfSchemaWithObjectSchema',
|
|
291
|
+
name: 'test',
|
|
292
|
+
}, '', options, deps);
|
|
293
|
+
const { getByText, container } = render(_jsx(PropertyDetails, { field: field, level: 2 }), {
|
|
294
|
+
wrapper: TestBrowserRouter,
|
|
295
|
+
});
|
|
296
|
+
expect(getByText('Show 2 properties')).toBeInTheDocument();
|
|
297
|
+
act(() => {
|
|
298
|
+
fireEvent.click(getByText('Show 2 properties'));
|
|
299
|
+
});
|
|
300
|
+
expect(getByText('status')).toBeInTheDocument();
|
|
301
|
+
expect(getByText('name')).toBeInTheDocument();
|
|
302
|
+
expect(container.textContent.includes('test.\u200Bname')).toBe(true);
|
|
303
|
+
expect(container.textContent.includes('test.\u200Bstatus')).toBe(true);
|
|
304
|
+
});
|
|
305
|
+
it('the read-only field should be displayed', () => {
|
|
306
|
+
const field = getField(parser, {
|
|
307
|
+
$ref: '#/components/testProperties/readOnlyInSchema',
|
|
308
|
+
}, '', options, deps);
|
|
309
|
+
const { container } = render(_jsx(PropertyDetails, { field: field }), {
|
|
310
|
+
wrapper: TestBrowserRouter,
|
|
311
|
+
});
|
|
312
|
+
expect(container).toHaveTextContent(/read-only/);
|
|
313
|
+
});
|
|
314
|
+
it('the write-only field should be displayed', () => {
|
|
315
|
+
const field = getField(parser, {
|
|
316
|
+
$ref: '#/components/testProperties/writeOnlyInSchema',
|
|
317
|
+
}, '', options, deps);
|
|
318
|
+
const { container } = render(_jsx(PropertyDetails, { field: field }), {
|
|
319
|
+
wrapper: TestBrowserRouter,
|
|
320
|
+
});
|
|
321
|
+
expect(container).toHaveTextContent(/write-only/);
|
|
322
|
+
});
|
|
323
|
+
describe('PropertyDetails', () => {
|
|
324
|
+
it('PropertyDetails with read-only should renders correctly', () => {
|
|
325
|
+
options.showAccessMode = true;
|
|
326
|
+
const field = getField(parser, {
|
|
327
|
+
$ref: '#/components/testProperties/readOnlyInSchema',
|
|
328
|
+
}, '', options, deps);
|
|
329
|
+
const { container } = render(_jsx(PropertyDetails, { field: field }), {
|
|
330
|
+
wrapper: TestBrowserRouter,
|
|
331
|
+
});
|
|
332
|
+
expect(container).toHaveTextContent(/read-only/);
|
|
333
|
+
});
|
|
334
|
+
it('Field with write-only should renders correctly', () => {
|
|
335
|
+
options.showAccessMode = true;
|
|
336
|
+
const field = getField(parser, {
|
|
337
|
+
$ref: '#/components/testProperties/writeOnlyInSchema',
|
|
338
|
+
}, '', options, deps);
|
|
339
|
+
const { container } = render(_jsx(PropertyDetails, { field: field }), {
|
|
340
|
+
wrapper: TestBrowserRouter,
|
|
341
|
+
});
|
|
342
|
+
expect(container).toHaveTextContent(/write-only/);
|
|
343
|
+
});
|
|
344
|
+
it('Fields with read-only and write-only in content should renders correctly', async () => {
|
|
345
|
+
options.showAccessMode = true;
|
|
346
|
+
const field = getField(parser, {
|
|
347
|
+
name: 'test',
|
|
348
|
+
in: 'path',
|
|
349
|
+
content: {
|
|
350
|
+
'application/json': {
|
|
351
|
+
schema: {
|
|
352
|
+
$ref: '#/components/testProperties/readOnlyInContent',
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
}, '', options, deps);
|
|
357
|
+
const { container } = render(_jsx(PropertyDetails, { field: field }), {
|
|
358
|
+
wrapper: TestBrowserRouter,
|
|
359
|
+
});
|
|
360
|
+
fireEvent.click(await screen.getByText('Show 2 properties'));
|
|
361
|
+
expect(container).toHaveTextContent(/read-only/);
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
//# sourceMappingURL=PropertyDetails.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cycleColorsByLevel } from '../cycleColorsByLevel.js';
|
|
2
|
+
describe('fieldColorByLevel', () => {
|
|
3
|
+
it('returns the correct color for a given level', () => {
|
|
4
|
+
const levelColors = [
|
|
5
|
+
'#9D00FF',
|
|
6
|
+
'#615CEA',
|
|
7
|
+
'#147DF5',
|
|
8
|
+
'#08BFCC',
|
|
9
|
+
'#08CC7A',
|
|
10
|
+
'#81CC08',
|
|
11
|
+
'#E5BE00',
|
|
12
|
+
'#FF8700',
|
|
13
|
+
'#FF00B8',
|
|
14
|
+
];
|
|
15
|
+
for (let i = 0; i < levelColors.length; i++) {
|
|
16
|
+
expect(cycleColorsByLevel(i)).toBe(levelColors[i]);
|
|
17
|
+
}
|
|
18
|
+
expect(cycleColorsByLevel(levelColors.length)).toBe(levelColors[0]);
|
|
19
|
+
expect(cycleColorsByLevel(levelColors.length + 1)).toBe(levelColors[1]);
|
|
20
|
+
expect(cycleColorsByLevel(levelColors.length * 2)).toBe(levelColors[0]);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=cycleColorsByLevel.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { StoreProvider } from '../Providers.js';
|
|
4
|
+
describe('ProStoreProvider', () => {
|
|
5
|
+
test('StoreProvider should run onInit hook', async () => {
|
|
6
|
+
const { findByTestId } = render(_jsx(StoreProvider, { options: {}, definition: {
|
|
7
|
+
openapi: '3.0.0',
|
|
8
|
+
info: {
|
|
9
|
+
version: '1.0',
|
|
10
|
+
title: 'Foo',
|
|
11
|
+
},
|
|
12
|
+
}, children: _jsx("div", { "data-testid": "test" }) }));
|
|
13
|
+
expect(await findByTestId('test')).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=AppProvider.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|