@redocly/openapi-docs 3.24.0 → 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-CIrPFbvX.js → redocly-openapi-docs.min.AiChatProvider-j-VDfFJ9.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-eAy3scC4.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiPanel-C6CGDyzy.js → redocly-openapi-docs.min.AiPanel-DTzHqAiI.js} +1 -1
- package/dist/{redocly-openapi-docs.min.FileWatcher-dIKl80Ec.js → redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js} +1 -1
- package/dist/{redocly-openapi-docs.min.SemanticSearchService-D4V6-td8.js → redocly-openapi-docs.min.SemanticSearchService-DNFOPBZK.js} +1 -1
- package/dist/{redocly-openapi-docs.min.SqliteDBStorage-D9-Rb-N7.js → redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js} +1 -1
- package/dist/{redocly-openapi-docs.min.TauriFileSystemAdapter-CHW6hO3z.js → redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js} +1 -1
- package/dist/{redocly-openapi-docs.min.TauriRootStorage-CHiKNUn2.js → redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js} +1 -1
- package/dist/{redocly-openapi-docs.min.ai-chat-mappers-C19k85fj.js → redocly-openapi-docs.min.ai-chat-mappers-CmX-8902.js} +1 -1
- package/dist/{redocly-openapi-docs.min.external-resolver-BH7DBWU-.js → redocly-openapi-docs.min.external-resolver-BkceRyB4.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-BQp5pipW.js → redocly-openapi-docs.min.index-BCcol5vU.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-dirYvuKs.js → redocly-openapi-docs.min.index-C6uU_v-b.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-BuFUmOUm.js → redocly-openapi-docs.min.index-CmXZfuiZ.js} +11 -11
- package/dist/{redocly-openapi-docs.min.index-DLlCa16R.js → redocly-openapi-docs.min.index-DVWw0ICA.js} +1 -1
- package/dist/redocly-openapi-docs.min.js +1 -1
- package/dist/{redocly-openapi-docs.min.lint-Xu623Q1T.js → redocly-openapi-docs.min.lint-2YpbCz3r.js} +2 -2
- package/dist/{redocly-openapi-docs.min.lint-graphql-D-Nm5P1M.js → redocly-openapi-docs.min.lint-graphql-Bgfcu2tP.js} +1 -1
- package/dist/{redocly-openapi-docs.min.respect-run-CWNqYysq.js → redocly-openapi-docs.min.respect-run-Ct8taisL.js} +1 -1
- package/dist/{redocly-openapi-docs.min.standalone-CRo0Sa5b.js → redocly-openapi-docs.min.standalone-BPCdJgtH.js} +3 -3
- package/dist/{redocly-openapi-docs.min.tauri-path-BUSVirPk.js → redocly-openapi-docs.min.tauri-path-CmqBCxGb.js} +1 -1
- package/dist/{redocly-openapi-docs.min.useAiChatQueries-CXyQzME7.js → redocly-openapi-docs.min.useAiChatQueries-t8oy8jik.js} +2 -2
- 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/__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/ContentItem/__tests__/useIsExpanded.test.d.ts +1 -0
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +123 -0
- 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/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/__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/__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/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/Tabs/__tests__/Tabs.test.d.ts +1 -0
- package/lib/components/Tabs/__tests__/Tabs.test.js +27 -0
- 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/__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/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/package.json +4 -4
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { vi } from 'vitest';
|
|
4
|
+
import * as Jotai from 'jotai';
|
|
5
|
+
import { ExampleValue } from '../ExampleValue.js';
|
|
6
|
+
import { globalOptionsAtom } from '../../../jotai/store.js';
|
|
7
|
+
import { normalizeOptions } from '../../../services/index.js';
|
|
8
|
+
vi.mock('@redocly/theme/components/JsonViewer/JsonViewer', () => ({
|
|
9
|
+
JsonViewer: vi.fn(({ data, expandLevel, onCopyClick, onPanelToggle }) => (_jsxs("div", { "data-testid": "json-viewer", "data-expand-level": expandLevel, children: [_jsx("pre", { "data-testid": "json-viewer-data", children: JSON.stringify(data, null, 2) }), onCopyClick && _jsx("button", { "data-testid": "copy-button", onClick: onCopyClick }), onPanelToggle && _jsx("button", { "data-testid": "panel-toggle", onClick: () => onPanelToggle(true) })] }))),
|
|
10
|
+
}));
|
|
11
|
+
vi.mock('../styled.js', () => ({
|
|
12
|
+
StyledCodeBlock: vi.fn(({ source, lang, header }) => (_jsxs("div", { "data-testid": "code-block", "data-lang": lang, children: [_jsx("pre", { children: source }), header?.controls?.copy && (_jsx("button", { "data-testid": "code-block-copy", onClick: header.controls.copy.onClick }))] }))),
|
|
13
|
+
}));
|
|
14
|
+
vi.mock('jotai', async () => {
|
|
15
|
+
const actual = await vi.importActual('jotai');
|
|
16
|
+
return {
|
|
17
|
+
...actual,
|
|
18
|
+
useAtomValue: vi.fn(),
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
describe('ExampleValue', () => {
|
|
22
|
+
const mockUseAtomValue = Jotai.useAtomValue;
|
|
23
|
+
const options = normalizeOptions({});
|
|
24
|
+
beforeEach(async () => {
|
|
25
|
+
vi.clearAllMocks();
|
|
26
|
+
const actualJotai = await vi.importActual('jotai');
|
|
27
|
+
mockUseAtomValue.mockImplementation((atom) => {
|
|
28
|
+
if (atom === globalOptionsAtom) {
|
|
29
|
+
return {
|
|
30
|
+
...options,
|
|
31
|
+
jsonSamplesExpandLevel: 2,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return actualJotai.useAtomValue(atom);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
describe('JSON parsing for application/json', () => {
|
|
38
|
+
it('should parse valid JSON string and pass parsed object to JsonViewer', () => {
|
|
39
|
+
const validJsonString = '{"name":"Test User","value":"premium","count":5}';
|
|
40
|
+
const props = {
|
|
41
|
+
value: validJsonString,
|
|
42
|
+
mimeType: 'application/json',
|
|
43
|
+
onCopyClick: vi.fn(),
|
|
44
|
+
};
|
|
45
|
+
const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
|
|
46
|
+
const jsonData = getByTestId('json-viewer-data');
|
|
47
|
+
const parsedData = JSON.parse(jsonData.textContent || '{}');
|
|
48
|
+
expect(parsedData).toEqual({
|
|
49
|
+
name: 'Test User',
|
|
50
|
+
value: 'premium',
|
|
51
|
+
count: 5,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
it('should use value as-is when it is already an object (not a string)', () => {
|
|
55
|
+
const objectValue = { name: 'Test User', value: 'premium', count: 5 };
|
|
56
|
+
const props = {
|
|
57
|
+
value: objectValue,
|
|
58
|
+
mimeType: 'application/json',
|
|
59
|
+
onCopyClick: vi.fn(),
|
|
60
|
+
};
|
|
61
|
+
const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
|
|
62
|
+
const jsonData = getByTestId('json-viewer-data');
|
|
63
|
+
const parsedData = JSON.parse(jsonData.textContent || '{}');
|
|
64
|
+
expect(parsedData).toEqual(objectValue);
|
|
65
|
+
});
|
|
66
|
+
it('should fallback to original value when JSON string is invalid', () => {
|
|
67
|
+
const invalidJsonString = '{"name":"Test User",invalid json}';
|
|
68
|
+
const props = {
|
|
69
|
+
value: invalidJsonString,
|
|
70
|
+
mimeType: 'application/json',
|
|
71
|
+
onCopyClick: vi.fn(),
|
|
72
|
+
};
|
|
73
|
+
const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
|
|
74
|
+
const jsonData = getByTestId('json-viewer-data');
|
|
75
|
+
const parsedData = JSON.parse(jsonData.textContent || '');
|
|
76
|
+
expect(parsedData).toBe(invalidJsonString);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
describe('XML handling for application/xml', () => {
|
|
80
|
+
it('should wrap object in root tag and convert to XML (dataValue case)', () => {
|
|
81
|
+
const objectValue = { name: 'Test User', value: 'premium' };
|
|
82
|
+
const props = {
|
|
83
|
+
value: objectValue,
|
|
84
|
+
mimeType: 'application/xml',
|
|
85
|
+
onCopyClick: vi.fn(),
|
|
86
|
+
};
|
|
87
|
+
const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
|
|
88
|
+
const codeBlock = getByTestId('code-block');
|
|
89
|
+
const source = codeBlock.querySelector('pre')?.textContent || '';
|
|
90
|
+
expect(source).toContain('<root>');
|
|
91
|
+
expect(source).toContain('<name>Test User</name>');
|
|
92
|
+
expect(source).toContain('<value>premium</value>');
|
|
93
|
+
expect(source).toContain('</root>');
|
|
94
|
+
});
|
|
95
|
+
it('should not wrap array in root tag for XML', () => {
|
|
96
|
+
const arrayValue = [{ item: 'one' }, { item: 'two' }];
|
|
97
|
+
const props = {
|
|
98
|
+
value: arrayValue,
|
|
99
|
+
mimeType: 'application/xml',
|
|
100
|
+
onCopyClick: vi.fn(),
|
|
101
|
+
};
|
|
102
|
+
const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
|
|
103
|
+
const codeBlock = getByTestId('code-block');
|
|
104
|
+
const source = codeBlock.querySelector('pre')?.textContent || '';
|
|
105
|
+
expect(source).not.toContain('<root>');
|
|
106
|
+
expect(source).toContain('<item>one</item>');
|
|
107
|
+
expect(source).toContain('<item>two</item>');
|
|
108
|
+
});
|
|
109
|
+
it('should render pre-built XML string from sampler with attributes (nodeType: attribute)', () => {
|
|
110
|
+
const xmlString = '<Artifact catalogId="ART-2024-001">\n <title>Mona Lisa</title>\n</Artifact>';
|
|
111
|
+
const props = {
|
|
112
|
+
value: xmlString,
|
|
113
|
+
mimeType: 'application/xml',
|
|
114
|
+
onCopyClick: vi.fn(),
|
|
115
|
+
};
|
|
116
|
+
const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
|
|
117
|
+
const codeBlock = getByTestId('code-block');
|
|
118
|
+
const source = codeBlock.querySelector('pre')?.textContent || '';
|
|
119
|
+
expect(source).toContain('catalogId="ART-2024-001"');
|
|
120
|
+
expect(source).toContain('<title>Mona Lisa</title>');
|
|
121
|
+
});
|
|
122
|
+
it('should render pre-built XML string with text nodes (nodeType: text)', () => {
|
|
123
|
+
const xmlString = '<Artifact>\n <title>Mona Lisa</title>\nPortrait painting by Leonardo da Vinci</Artifact>';
|
|
124
|
+
const props = {
|
|
125
|
+
value: xmlString,
|
|
126
|
+
mimeType: 'application/xml',
|
|
127
|
+
onCopyClick: vi.fn(),
|
|
128
|
+
};
|
|
129
|
+
const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
|
|
130
|
+
const codeBlock = getByTestId('code-block');
|
|
131
|
+
const source = codeBlock.querySelector('pre')?.textContent || '';
|
|
132
|
+
expect(source).toContain('Portrait painting by Leonardo da Vinci');
|
|
133
|
+
expect(source).toContain('<title>Mona Lisa</title>');
|
|
134
|
+
});
|
|
135
|
+
it('should render pre-built XML string with CDATA (nodeType: cdata)', () => {
|
|
136
|
+
const xmlString = '<Documentation>\n <![CDATA[<html><head><title>Docs</title></head></html>]]>\n</Documentation>';
|
|
137
|
+
const props = {
|
|
138
|
+
value: xmlString,
|
|
139
|
+
mimeType: 'application/xml',
|
|
140
|
+
onCopyClick: vi.fn(),
|
|
141
|
+
};
|
|
142
|
+
const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
|
|
143
|
+
const codeBlock = getByTestId('code-block');
|
|
144
|
+
const source = codeBlock.querySelector('pre')?.textContent || '';
|
|
145
|
+
expect(source).toContain('<![CDATA[');
|
|
146
|
+
expect(source).toContain('<html><head><title>Docs</title></head></html>');
|
|
147
|
+
expect(source).toContain(']]>');
|
|
148
|
+
});
|
|
149
|
+
it('should render pre-built XML string with all nodeTypes combined (sampler output)', () => {
|
|
150
|
+
const xmlString = [
|
|
151
|
+
'<Artifact catalogId="ART-2024-001" era="Renaissance">',
|
|
152
|
+
' <title>Mona Lisa</title>',
|
|
153
|
+
'Portrait painting by Leonardo da Vinci',
|
|
154
|
+
' <![CDATA[<note>Handle with <b>extreme</b> care</note>]]>',
|
|
155
|
+
' <artists>',
|
|
156
|
+
' <Artist role="painter">',
|
|
157
|
+
' <name>Leonardo da Vinci</name>',
|
|
158
|
+
' </Artist>',
|
|
159
|
+
' </artists>',
|
|
160
|
+
'</Artifact>',
|
|
161
|
+
].join('\n');
|
|
162
|
+
const props = {
|
|
163
|
+
value: xmlString,
|
|
164
|
+
mimeType: 'application/xml',
|
|
165
|
+
onCopyClick: vi.fn(),
|
|
166
|
+
};
|
|
167
|
+
const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
|
|
168
|
+
const codeBlock = getByTestId('code-block');
|
|
169
|
+
const source = codeBlock.querySelector('pre')?.textContent || '';
|
|
170
|
+
expect(source).toContain('catalogId="ART-2024-001"');
|
|
171
|
+
expect(source).toContain('era="Renaissance"');
|
|
172
|
+
expect(source).toContain('<title>Mona Lisa</title>');
|
|
173
|
+
expect(source).toContain('Portrait painting by Leonardo da Vinci');
|
|
174
|
+
expect(source).toContain('<![CDATA[<note>Handle with <b>extreme</b> care</note>]]>');
|
|
175
|
+
expect(source).not.toContain('internalCode');
|
|
176
|
+
expect(source).not.toContain('INT-7742-X');
|
|
177
|
+
});
|
|
178
|
+
it('should convert JS object to XML with CDATA support via xmlBuilder', () => {
|
|
179
|
+
const objectValue = {
|
|
180
|
+
Documentation: {
|
|
181
|
+
'#cdata': '<html><head><title>Docs</title></head></html>',
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
const props = {
|
|
185
|
+
value: objectValue,
|
|
186
|
+
mimeType: 'application/xml',
|
|
187
|
+
onCopyClick: vi.fn(),
|
|
188
|
+
};
|
|
189
|
+
const { getByTestId } = render(_jsx(Jotai.Provider, { children: _jsx(ExampleValue, { ...props }) }));
|
|
190
|
+
const codeBlock = getByTestId('code-block');
|
|
191
|
+
const source = codeBlock.querySelector('pre')?.textContent || '';
|
|
192
|
+
expect(source).toContain('<![CDATA[');
|
|
193
|
+
expect(source).toContain(']]>');
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
//# sourceMappingURL=ExampleValue.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
4
|
+
import { getMediaContent, getOperation } from '../../../models/index.js';
|
|
5
|
+
import { withTestProviders } from '../../../testProviders.js';
|
|
6
|
+
import { PayloadSamples } from '../PayloadSamples.js';
|
|
7
|
+
import testDefinition from './fixtures/mediaTypeUrlencoded.json';
|
|
8
|
+
describe('PayloadSamples', () => {
|
|
9
|
+
let operation;
|
|
10
|
+
const options = normalizeOptions({});
|
|
11
|
+
const parser = new OpenAPIParser(testDefinition, undefined, options);
|
|
12
|
+
test('should renders correctly without example to application/x-www-form-urlencoded', async () => {
|
|
13
|
+
operation = getOperation(parser, {
|
|
14
|
+
pointer: '#/paths/~1test/get',
|
|
15
|
+
pathName: '/test',
|
|
16
|
+
httpVerb: 'GET',
|
|
17
|
+
pathParameters: [],
|
|
18
|
+
pathServers: [],
|
|
19
|
+
isWebhook: false,
|
|
20
|
+
isAdditionalOperation: false,
|
|
21
|
+
...testDefinition.paths['/test'].get,
|
|
22
|
+
}, undefined, options, 'tests');
|
|
23
|
+
const props = {
|
|
24
|
+
operation,
|
|
25
|
+
content: getMediaContent({
|
|
26
|
+
parser,
|
|
27
|
+
info: testDefinition.paths['/test'].get.requestBody.content,
|
|
28
|
+
isRequestType: true,
|
|
29
|
+
options,
|
|
30
|
+
data: { operation },
|
|
31
|
+
}),
|
|
32
|
+
onCopyClick: vi.fn(),
|
|
33
|
+
};
|
|
34
|
+
const { container } = render(withTestProviders(_jsx(PayloadSamples, { ...props }), { definition: parser.definition }));
|
|
35
|
+
expect(container).toHaveTextContent(/name=string&status=string/);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=PayloadSamples.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai';
|
|
4
|
+
import { Extensions } from '../Extensions.js';
|
|
5
|
+
import { normalizeOptions } from '../../../services/index.js';
|
|
6
|
+
vi.mock('jotai', async () => ({
|
|
7
|
+
...(await vi.importActual('jotai')),
|
|
8
|
+
useAtomValue: vi.fn(),
|
|
9
|
+
}));
|
|
10
|
+
describe('Components', () => {
|
|
11
|
+
describe('Extensions', () => {
|
|
12
|
+
it('Extensions label renders correctly', () => {
|
|
13
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({
|
|
14
|
+
showExtensions: true,
|
|
15
|
+
}));
|
|
16
|
+
const { container } = render(_jsx(Extensions, { extensions: { 'x-test': 'Add new pet to the store inventory' } }));
|
|
17
|
+
expect(container).toHaveTextContent(/test: Add new pet to the store inventory/);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=Extensions.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { FieldDetail } from '../FieldDetail.js';
|
|
4
|
+
describe('FieldDetail', () => {
|
|
5
|
+
const wrapper = (label, value) => render(_jsx(FieldDetail, { label: label, value: value }));
|
|
6
|
+
it('should render with DefaultValue component', () => {
|
|
7
|
+
const { getByText } = wrapper('Default', 'value');
|
|
8
|
+
expect(getByText('"value"')).toBeInTheDocument();
|
|
9
|
+
expect(getByText('Default')).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
it('should render with ExampleValue component', () => {
|
|
12
|
+
const { getByText } = wrapper('Example:', 'value');
|
|
13
|
+
expect(getByText('"value"')).toBeInTheDocument();
|
|
14
|
+
expect(getByText('Example:')).toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
it('should render FieldValueLabel in all other cases', () => {
|
|
17
|
+
const { getByText } = wrapper('Deprecated', 'value');
|
|
18
|
+
expect(getByText('"value"')).toBeInTheDocument();
|
|
19
|
+
expect(getByText('Deprecated')).toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
describe('example type with structured values', () => {
|
|
22
|
+
const objectValue = {
|
|
23
|
+
name: 'John Alfred Smith',
|
|
24
|
+
street: '123 Main Street',
|
|
25
|
+
city: 'San Francisco',
|
|
26
|
+
};
|
|
27
|
+
it('should render object example pretty-printed with JSON highlighting', () => {
|
|
28
|
+
const { getByTestId, getByText } = render(_jsx(FieldDetail, { label: "Example:", value: objectValue, type: "example" }));
|
|
29
|
+
expect(getByText('Example:')).toBeInTheDocument();
|
|
30
|
+
const viewer = getByTestId('json-viewer');
|
|
31
|
+
// pretty-printed: keys and values are separate tokens on multiple lines,
|
|
32
|
+
// not a single-line JSON.stringify blob
|
|
33
|
+
expect(viewer.textContent).toContain('"name"');
|
|
34
|
+
expect(viewer.textContent).toContain('"John Alfred Smith"');
|
|
35
|
+
expect(viewer.textContent).toContain('\n');
|
|
36
|
+
// syntax highlighting: token spans styled by the code theme
|
|
37
|
+
expect(viewer.querySelector('.token.string')).not.toBeNull();
|
|
38
|
+
});
|
|
39
|
+
it('should render array example pretty-printed with JSON highlighting', () => {
|
|
40
|
+
const { getByTestId } = render(_jsx(FieldDetail, { label: "Example:", value: ['79f943e212cce7de21c054a8'], type: "example" }));
|
|
41
|
+
const viewer = getByTestId('json-viewer');
|
|
42
|
+
expect(viewer.textContent).toContain('"79f943e212cce7de21c054a8"');
|
|
43
|
+
expect(viewer.querySelector('.token.string')).not.toBeNull();
|
|
44
|
+
});
|
|
45
|
+
it('should keep scalar example values inline without JSON viewer', () => {
|
|
46
|
+
const { getByText, queryByTestId } = render(_jsx(FieldDetail, { label: "Example:", value: "HRIS-27", type: "example" }));
|
|
47
|
+
expect(getByText('"HRIS-27"')).toBeInTheDocument();
|
|
48
|
+
expect(queryByTestId('json-viewer')).toBeNull();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=FieldDetail.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 {};
|