@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,694 @@
|
|
|
1
|
+
import outdent from 'outdent';
|
|
2
|
+
import { parseYaml } from '@redocly/openapi-core';
|
|
3
|
+
import { getSchema } from '../schema.js';
|
|
4
|
+
import { normalizeOptions, OpenAPIParser } from '../../services/index.js';
|
|
5
|
+
import { circularDetailsPrinter, printSchema } from './helpers.js';
|
|
6
|
+
const options = normalizeOptions({});
|
|
7
|
+
const deps = { operation: { pointer: 'testSchemaCircular' } };
|
|
8
|
+
describe('Models', () => {
|
|
9
|
+
describe('Schema Circular tracking', () => {
|
|
10
|
+
let parser;
|
|
11
|
+
expect.addSnapshotSerializer({
|
|
12
|
+
test: (val) => typeof val === 'string',
|
|
13
|
+
print: (v) => v,
|
|
14
|
+
});
|
|
15
|
+
test('should detect circular for array nested in allOf', () => {
|
|
16
|
+
const spec = parseYaml(outdent `
|
|
17
|
+
openapi: 3.0.0
|
|
18
|
+
components:
|
|
19
|
+
schemas:
|
|
20
|
+
Schema:
|
|
21
|
+
type: object
|
|
22
|
+
properties:
|
|
23
|
+
a: { $ref: '#/components/schemas/Schema' }
|
|
24
|
+
`);
|
|
25
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
26
|
+
const schema = getSchema({
|
|
27
|
+
parser,
|
|
28
|
+
schemaOrRef: spec.components.schemas.Schema,
|
|
29
|
+
pointer: '#/components/schemas/Schema',
|
|
30
|
+
options,
|
|
31
|
+
deps,
|
|
32
|
+
});
|
|
33
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`a: <object> !circular`);
|
|
34
|
+
});
|
|
35
|
+
test('should not detect circular refs when ref used multiple times across allOf', () => {
|
|
36
|
+
const spec = parseYaml(outdent `
|
|
37
|
+
openapi: 3.0.0
|
|
38
|
+
components:
|
|
39
|
+
schemas:
|
|
40
|
+
Foo:
|
|
41
|
+
type: object
|
|
42
|
+
properties:
|
|
43
|
+
foo: { type: string }
|
|
44
|
+
Schema:
|
|
45
|
+
allOf:
|
|
46
|
+
- $ref: '#/components/schemas/Foo'
|
|
47
|
+
- type: object
|
|
48
|
+
properties:
|
|
49
|
+
foobar: { $ref: '#/components/schemas/Foo' }
|
|
50
|
+
`);
|
|
51
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
52
|
+
const schema = getSchema({
|
|
53
|
+
parser,
|
|
54
|
+
schemaOrRef: spec.components.schemas.Schema,
|
|
55
|
+
pointer: '',
|
|
56
|
+
options,
|
|
57
|
+
deps,
|
|
58
|
+
});
|
|
59
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
60
|
+
foo: <string>
|
|
61
|
+
foobar:
|
|
62
|
+
foo: <string>
|
|
63
|
+
`);
|
|
64
|
+
});
|
|
65
|
+
test('should detect circular for array with self-reference', () => {
|
|
66
|
+
const spec = parseYaml(outdent `
|
|
67
|
+
openapi: 3.0.0
|
|
68
|
+
components:
|
|
69
|
+
schemas:
|
|
70
|
+
Array:
|
|
71
|
+
type: "array"
|
|
72
|
+
items: { "$ref": "#/components/schemas/Array" }
|
|
73
|
+
Schema:
|
|
74
|
+
allOf: [{ "$ref": "#/components/schemas/Array" }]
|
|
75
|
+
`);
|
|
76
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
77
|
+
const schema = getSchema({
|
|
78
|
+
parser,
|
|
79
|
+
schemaOrRef: spec.components.schemas.Schema,
|
|
80
|
+
pointer: '#/components/schemas/Schema',
|
|
81
|
+
options,
|
|
82
|
+
deps,
|
|
83
|
+
});
|
|
84
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`[<array> !circular]`);
|
|
85
|
+
});
|
|
86
|
+
test('should detect circular for object nested in allOf', () => {
|
|
87
|
+
const spec = parseYaml(outdent `
|
|
88
|
+
openapi: 3.0.0
|
|
89
|
+
components:
|
|
90
|
+
schemas:
|
|
91
|
+
Object:
|
|
92
|
+
allOf:
|
|
93
|
+
- $ref: '#/components/schemas/Object'
|
|
94
|
+
- type: "object"
|
|
95
|
+
properties: { "a": { "$ref": "#/components/schemas/Object" } }
|
|
96
|
+
Schema:
|
|
97
|
+
allOf: [{ "$ref": "#/components/schemas/Object" }]
|
|
98
|
+
`);
|
|
99
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
100
|
+
const schema = getSchema({
|
|
101
|
+
parser,
|
|
102
|
+
schemaOrRef: spec.components.schemas.Schema,
|
|
103
|
+
pointer: '#/components/schemas/Schema',
|
|
104
|
+
options,
|
|
105
|
+
deps,
|
|
106
|
+
});
|
|
107
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`a: <any> !circular`);
|
|
108
|
+
});
|
|
109
|
+
test('should not detect circular for base DTO case', () => {
|
|
110
|
+
const spec = parseYaml(outdent `
|
|
111
|
+
openapi: 3.0.0
|
|
112
|
+
components:
|
|
113
|
+
schemas:
|
|
114
|
+
BaseDTO:
|
|
115
|
+
type: object
|
|
116
|
+
properties:
|
|
117
|
+
id: {type: string}
|
|
118
|
+
BaseB:
|
|
119
|
+
type: object
|
|
120
|
+
allOf:
|
|
121
|
+
- $ref: '#/components/schemas/BaseDTO'
|
|
122
|
+
- type: object
|
|
123
|
+
properties:
|
|
124
|
+
fieldB: { type: string }
|
|
125
|
+
BaseA:
|
|
126
|
+
type: object
|
|
127
|
+
allOf:
|
|
128
|
+
- $ref: '#/components/schemas/BaseDTO'
|
|
129
|
+
- type: object
|
|
130
|
+
properties:
|
|
131
|
+
b: { $ref: '#/components/schemas/BaseB' }
|
|
132
|
+
fieldA: { type: string }
|
|
133
|
+
`);
|
|
134
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
135
|
+
const schema = getSchema({
|
|
136
|
+
parser,
|
|
137
|
+
schemaOrRef: spec.components.schemas.BaseA,
|
|
138
|
+
pointer: '',
|
|
139
|
+
options,
|
|
140
|
+
deps,
|
|
141
|
+
});
|
|
142
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
143
|
+
id: <string>
|
|
144
|
+
b:
|
|
145
|
+
id: <string>
|
|
146
|
+
fieldB: <string>
|
|
147
|
+
fieldA: <string>
|
|
148
|
+
`);
|
|
149
|
+
});
|
|
150
|
+
test('should detect circular ref for self referencing discriminator', () => {
|
|
151
|
+
const spec = parseYaml(outdent `
|
|
152
|
+
openapi: 3.0.0
|
|
153
|
+
components:
|
|
154
|
+
schemas:
|
|
155
|
+
SelfComponentDto:
|
|
156
|
+
type: object
|
|
157
|
+
properties:
|
|
158
|
+
self:
|
|
159
|
+
type: object
|
|
160
|
+
discriminator:
|
|
161
|
+
propertyName: schemaId
|
|
162
|
+
mapping:
|
|
163
|
+
title: '#/components/schemas/SelfComponentDto'
|
|
164
|
+
oneOf:
|
|
165
|
+
- $ref: '#/components/schemas/SelfComponentDto'
|
|
166
|
+
`);
|
|
167
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
168
|
+
const schema = getSchema({
|
|
169
|
+
parser,
|
|
170
|
+
schemaOrRef: spec.components.schemas.SelfComponentDto,
|
|
171
|
+
pointer: '',
|
|
172
|
+
options,
|
|
173
|
+
deps,
|
|
174
|
+
});
|
|
175
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
176
|
+
self: oneOf
|
|
177
|
+
title ->
|
|
178
|
+
self: oneOf
|
|
179
|
+
title -> <object> !circular
|
|
180
|
+
`);
|
|
181
|
+
});
|
|
182
|
+
test('should detect circular with nested oneOf hoisting', () => {
|
|
183
|
+
const spec = parseYaml(outdent `
|
|
184
|
+
openapi: 3.0.0
|
|
185
|
+
components:
|
|
186
|
+
schemas:
|
|
187
|
+
Node:
|
|
188
|
+
type: 'object'
|
|
189
|
+
allOf:
|
|
190
|
+
- oneOf:
|
|
191
|
+
- type: object
|
|
192
|
+
properties:
|
|
193
|
+
parent:
|
|
194
|
+
$ref: '#/components/schemas/Node'
|
|
195
|
+
`);
|
|
196
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
197
|
+
const schema = getSchema({
|
|
198
|
+
parser,
|
|
199
|
+
schemaOrRef: spec.components.schemas.Node,
|
|
200
|
+
pointer: '',
|
|
201
|
+
options,
|
|
202
|
+
deps,
|
|
203
|
+
});
|
|
204
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
205
|
+
oneOf
|
|
206
|
+
object ->
|
|
207
|
+
parent: oneOf
|
|
208
|
+
object ->
|
|
209
|
+
parent: <object> !circular
|
|
210
|
+
`);
|
|
211
|
+
});
|
|
212
|
+
test('should detect simple props recursion', () => {
|
|
213
|
+
const spec = parseYaml(outdent `
|
|
214
|
+
openapi: 3.0.0
|
|
215
|
+
components:
|
|
216
|
+
schemas:
|
|
217
|
+
PropRecursion:
|
|
218
|
+
properties:
|
|
219
|
+
children:
|
|
220
|
+
type: object
|
|
221
|
+
properties:
|
|
222
|
+
a:
|
|
223
|
+
$ref: '#/components/schemas/PropRecursion'
|
|
224
|
+
`);
|
|
225
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
226
|
+
const schema = getSchema({
|
|
227
|
+
parser,
|
|
228
|
+
schemaOrRef: spec.components.schemas.PropRecursion,
|
|
229
|
+
pointer: '',
|
|
230
|
+
options,
|
|
231
|
+
deps,
|
|
232
|
+
});
|
|
233
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
234
|
+
children:
|
|
235
|
+
a:
|
|
236
|
+
children:
|
|
237
|
+
a: <object> !circular
|
|
238
|
+
`);
|
|
239
|
+
});
|
|
240
|
+
test('should detect recursion for props with type array', () => {
|
|
241
|
+
const spec = parseYaml(outdent `
|
|
242
|
+
openapi: 3.0.0
|
|
243
|
+
components:
|
|
244
|
+
schemas:
|
|
245
|
+
PropsRecursion:
|
|
246
|
+
properties:
|
|
247
|
+
children:
|
|
248
|
+
type: array
|
|
249
|
+
items:
|
|
250
|
+
$ref: '#/components/schemas/PropsRecursion'
|
|
251
|
+
`);
|
|
252
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
253
|
+
const schema = getSchema({
|
|
254
|
+
parser,
|
|
255
|
+
schemaOrRef: spec.components.schemas.PropsRecursion,
|
|
256
|
+
pointer: '',
|
|
257
|
+
options,
|
|
258
|
+
deps,
|
|
259
|
+
});
|
|
260
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
261
|
+
children: [
|
|
262
|
+
children: [<object> !circular]
|
|
263
|
+
]
|
|
264
|
+
`);
|
|
265
|
+
});
|
|
266
|
+
test('should detect and ignore allOf recursion', () => {
|
|
267
|
+
const spec = parseYaml(outdent `
|
|
268
|
+
openapi: 3.0.0
|
|
269
|
+
components:
|
|
270
|
+
schemas:
|
|
271
|
+
Parent:
|
|
272
|
+
$ref: '#/components/schemas/Child'
|
|
273
|
+
Child:
|
|
274
|
+
allOf:
|
|
275
|
+
- $ref: '#/components/schemas/Parent'
|
|
276
|
+
- type: object
|
|
277
|
+
properties:
|
|
278
|
+
a:
|
|
279
|
+
type: string
|
|
280
|
+
`);
|
|
281
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
282
|
+
const schema = getSchema({
|
|
283
|
+
parser,
|
|
284
|
+
schemaOrRef: spec.components.schemas.Child,
|
|
285
|
+
pointer: '#/components/schemas/Child',
|
|
286
|
+
options,
|
|
287
|
+
deps,
|
|
288
|
+
});
|
|
289
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`a: <string>`);
|
|
290
|
+
});
|
|
291
|
+
test('should detect and ignore allOf recursion in nested prop', () => {
|
|
292
|
+
const spec = parseYaml(outdent `
|
|
293
|
+
openapi: 3.0.0
|
|
294
|
+
components:
|
|
295
|
+
schemas:
|
|
296
|
+
ExternalReference:
|
|
297
|
+
type: object
|
|
298
|
+
allOf:
|
|
299
|
+
- $ref: '#/components/schemas/CompanyReference'
|
|
300
|
+
- type: object
|
|
301
|
+
properties:
|
|
302
|
+
externalId: { type: string }
|
|
303
|
+
CompanyReference:
|
|
304
|
+
type: object
|
|
305
|
+
required: [ guid, externalId ]
|
|
306
|
+
properties:
|
|
307
|
+
guid: { type: string }
|
|
308
|
+
nestedRecursive: { $ref: '#/components/schemas/ExternalReference' }
|
|
309
|
+
Entity:
|
|
310
|
+
type: object
|
|
311
|
+
allOf:
|
|
312
|
+
- $ref: '#/components/schemas/ExternalReference'
|
|
313
|
+
- type: object
|
|
314
|
+
properties:
|
|
315
|
+
directRecursive: { $ref: '#/components/schemas/ExternalReference' }
|
|
316
|
+
selfRecursive: { $ref: '#/components/schemas/Entity' }
|
|
317
|
+
anotherField: { $ref: '#/components/schemas/AnotherEntity' }
|
|
318
|
+
AnotherEntity:
|
|
319
|
+
type: object
|
|
320
|
+
allOf:
|
|
321
|
+
- $ref: '#/components/schemas/CompanyReference'
|
|
322
|
+
- type: object
|
|
323
|
+
properties:
|
|
324
|
+
someField: { type: number }
|
|
325
|
+
anotherSelfRecursive: { $ref: '#/components/schemas/AnotherEntity' }
|
|
326
|
+
`);
|
|
327
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
328
|
+
const schema = getSchema({
|
|
329
|
+
parser,
|
|
330
|
+
schemaOrRef: spec.components.schemas.Entity,
|
|
331
|
+
pointer: '#/components/schemas/Entity',
|
|
332
|
+
options,
|
|
333
|
+
deps,
|
|
334
|
+
});
|
|
335
|
+
// TODO: this has a little issue with too early detection in anotherField -> nestedRecursive
|
|
336
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
337
|
+
guid*: <string>
|
|
338
|
+
nestedRecursive: <object> !circular
|
|
339
|
+
externalId*: <string>
|
|
340
|
+
directRecursive:
|
|
341
|
+
guid*: <string>
|
|
342
|
+
nestedRecursive: <object> !circular
|
|
343
|
+
externalId*: <string>
|
|
344
|
+
selfRecursive: <object> !circular
|
|
345
|
+
anotherField:
|
|
346
|
+
guid*: <string>
|
|
347
|
+
nestedRecursive: <object> !circular
|
|
348
|
+
someField: <number>
|
|
349
|
+
anotherSelfRecursive: <object> !circular
|
|
350
|
+
`);
|
|
351
|
+
});
|
|
352
|
+
test('should detect and ignore allOf with discriminator recursion', () => {
|
|
353
|
+
const spec = parseYaml(outdent `
|
|
354
|
+
openapi: 3.0.0
|
|
355
|
+
components:
|
|
356
|
+
schemas:
|
|
357
|
+
Pet:
|
|
358
|
+
type: object
|
|
359
|
+
required: [ petType ]
|
|
360
|
+
discriminator:
|
|
361
|
+
propertyName: petType
|
|
362
|
+
mapping:
|
|
363
|
+
cat: '#/components/schemas/Cat'
|
|
364
|
+
dog: '#/components/schemas/Dog'
|
|
365
|
+
properties:
|
|
366
|
+
category: { $ref: '#/components/schemas/Category' }
|
|
367
|
+
status: { type: string }
|
|
368
|
+
friend:
|
|
369
|
+
allOf: [{ $ref: '#/components/schemas/Pet' }]
|
|
370
|
+
petType: { type: string }
|
|
371
|
+
Cat:
|
|
372
|
+
description: A representation of a cat
|
|
373
|
+
allOf:
|
|
374
|
+
- $ref: '#/components/schemas/Pet'
|
|
375
|
+
- type: object
|
|
376
|
+
properties:
|
|
377
|
+
huntingSkill: { type: string }
|
|
378
|
+
Dog:
|
|
379
|
+
description: A representation of a dog
|
|
380
|
+
allOf:
|
|
381
|
+
- $ref: '#/components/schemas/Pet'
|
|
382
|
+
- type: object
|
|
383
|
+
properties:
|
|
384
|
+
packSize: { type: integer }
|
|
385
|
+
Category:
|
|
386
|
+
type: object
|
|
387
|
+
properties:
|
|
388
|
+
name: { type: string }
|
|
389
|
+
`);
|
|
390
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
391
|
+
const schema = getSchema({
|
|
392
|
+
parser,
|
|
393
|
+
schemaOrRef: spec.components.schemas.Pet,
|
|
394
|
+
pointer: '#/components/schemas/Pet',
|
|
395
|
+
options,
|
|
396
|
+
deps,
|
|
397
|
+
});
|
|
398
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
399
|
+
oneOf
|
|
400
|
+
cat ->
|
|
401
|
+
category:
|
|
402
|
+
name: <string>
|
|
403
|
+
status: <string>
|
|
404
|
+
friend: <object> !circular
|
|
405
|
+
petType*: <string>
|
|
406
|
+
huntingSkill: <string>
|
|
407
|
+
dog ->
|
|
408
|
+
category:
|
|
409
|
+
name: <string>
|
|
410
|
+
status: <string>
|
|
411
|
+
friend: <object> !circular
|
|
412
|
+
petType*: <string>
|
|
413
|
+
packSize: <integer>
|
|
414
|
+
`);
|
|
415
|
+
});
|
|
416
|
+
test('should detect and recursion on the right level with array of discriminators', () => {
|
|
417
|
+
const spec = parseYaml(outdent `
|
|
418
|
+
openapi: 3.0.0
|
|
419
|
+
components:
|
|
420
|
+
schemas:
|
|
421
|
+
Pet:
|
|
422
|
+
type: object
|
|
423
|
+
required: [ petType ]
|
|
424
|
+
discriminator:
|
|
425
|
+
propertyName: petType
|
|
426
|
+
mapping:
|
|
427
|
+
cat: '#/components/schemas/Cat'
|
|
428
|
+
dog: '#/components/schemas/Dog'
|
|
429
|
+
properties:
|
|
430
|
+
category: { $ref: '#/components/schemas/Category' }
|
|
431
|
+
status: { type: string }
|
|
432
|
+
friend:
|
|
433
|
+
allOf: [{ $ref: '#/components/schemas/Pet' }]
|
|
434
|
+
petType: { type: string }
|
|
435
|
+
Cat:
|
|
436
|
+
description: A representation of a cat
|
|
437
|
+
allOf:
|
|
438
|
+
- $ref: '#/components/schemas/Pet'
|
|
439
|
+
- type: object
|
|
440
|
+
properties:
|
|
441
|
+
huntingSkill: { type: string }
|
|
442
|
+
Dog:
|
|
443
|
+
description: A representation of a dog
|
|
444
|
+
allOf:
|
|
445
|
+
- $ref: '#/components/schemas/Pet'
|
|
446
|
+
- type: object
|
|
447
|
+
properties:
|
|
448
|
+
packSize: { type: integer }
|
|
449
|
+
Category:
|
|
450
|
+
type: object
|
|
451
|
+
properties:
|
|
452
|
+
name: { type: string }
|
|
453
|
+
Response:
|
|
454
|
+
type: array
|
|
455
|
+
items:
|
|
456
|
+
$ref: '#/components/schemas/Pet'
|
|
457
|
+
`);
|
|
458
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
459
|
+
const schema = getSchema({
|
|
460
|
+
parser,
|
|
461
|
+
schemaOrRef: spec.components.schemas.Response,
|
|
462
|
+
pointer: '#/components/schemas/Response',
|
|
463
|
+
options,
|
|
464
|
+
deps,
|
|
465
|
+
});
|
|
466
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
467
|
+
[
|
|
468
|
+
oneOf
|
|
469
|
+
cat ->
|
|
470
|
+
category:
|
|
471
|
+
name: <string>
|
|
472
|
+
status: <string>
|
|
473
|
+
friend: <object> !circular
|
|
474
|
+
petType*: <string>
|
|
475
|
+
huntingSkill: <string>
|
|
476
|
+
dog ->
|
|
477
|
+
category:
|
|
478
|
+
name: <string>
|
|
479
|
+
status: <string>
|
|
480
|
+
friend: <object> !circular
|
|
481
|
+
petType*: <string>
|
|
482
|
+
packSize: <integer>
|
|
483
|
+
]
|
|
484
|
+
`);
|
|
485
|
+
});
|
|
486
|
+
test('should detect and recursion with discriminator and oneOf', () => {
|
|
487
|
+
const spec = parseYaml(outdent `
|
|
488
|
+
openapi: 3.0.0
|
|
489
|
+
components:
|
|
490
|
+
schemas:
|
|
491
|
+
User:
|
|
492
|
+
type: object
|
|
493
|
+
properties:
|
|
494
|
+
pet:
|
|
495
|
+
oneOf:
|
|
496
|
+
- $ref: '#/components/schemas/Pet'
|
|
497
|
+
Pet:
|
|
498
|
+
type: object
|
|
499
|
+
required: [ petType ]
|
|
500
|
+
discriminator:
|
|
501
|
+
propertyName: petType
|
|
502
|
+
mapping:
|
|
503
|
+
cat: '#/components/schemas/Cat'
|
|
504
|
+
dog: '#/components/schemas/Dog'
|
|
505
|
+
properties:
|
|
506
|
+
category: { $ref: '#/components/schemas/Category' }
|
|
507
|
+
status: { type: string }
|
|
508
|
+
friend:
|
|
509
|
+
allOf: [{ $ref: '#/components/schemas/Pet' }]
|
|
510
|
+
petType: { type: string }
|
|
511
|
+
Cat:
|
|
512
|
+
description: A representation of a cat
|
|
513
|
+
allOf:
|
|
514
|
+
- $ref: '#/components/schemas/Pet'
|
|
515
|
+
- type: object
|
|
516
|
+
properties:
|
|
517
|
+
huntingSkill: { type: string }
|
|
518
|
+
Dog:
|
|
519
|
+
description: A representation of a dog
|
|
520
|
+
allOf:
|
|
521
|
+
- $ref: '#/components/schemas/Pet'
|
|
522
|
+
- type: object
|
|
523
|
+
properties:
|
|
524
|
+
packSize: { type: integer }
|
|
525
|
+
Category:
|
|
526
|
+
type: object
|
|
527
|
+
properties:
|
|
528
|
+
name: { type: string }
|
|
529
|
+
`);
|
|
530
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
531
|
+
const schema = getSchema({
|
|
532
|
+
parser,
|
|
533
|
+
schemaOrRef: spec.components.schemas.User,
|
|
534
|
+
pointer: '#/components/schemas/User',
|
|
535
|
+
options,
|
|
536
|
+
deps,
|
|
537
|
+
});
|
|
538
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
539
|
+
pet: oneOf
|
|
540
|
+
Pet -> oneOf
|
|
541
|
+
cat ->
|
|
542
|
+
category:
|
|
543
|
+
name: <string>
|
|
544
|
+
status: <string>
|
|
545
|
+
friend: <object> !circular
|
|
546
|
+
petType*: <string>
|
|
547
|
+
huntingSkill: <string>
|
|
548
|
+
dog ->
|
|
549
|
+
category:
|
|
550
|
+
name: <string>
|
|
551
|
+
status: <string>
|
|
552
|
+
friend: <object> !circular
|
|
553
|
+
petType*: <string>
|
|
554
|
+
packSize: <integer>
|
|
555
|
+
`);
|
|
556
|
+
});
|
|
557
|
+
test('should detect and recursion with nested oneOf', () => {
|
|
558
|
+
const spec = parseYaml(outdent `
|
|
559
|
+
openapi: 3.0.0
|
|
560
|
+
components:
|
|
561
|
+
schemas:
|
|
562
|
+
Tag:
|
|
563
|
+
type: object
|
|
564
|
+
properties:
|
|
565
|
+
name:
|
|
566
|
+
description: Tag name
|
|
567
|
+
type: string
|
|
568
|
+
minLength: 1
|
|
569
|
+
items:
|
|
570
|
+
oneOf:
|
|
571
|
+
- $ref: "#/components/schemas/Tag"
|
|
572
|
+
User:
|
|
573
|
+
type: object
|
|
574
|
+
properties:
|
|
575
|
+
pet:
|
|
576
|
+
oneOf:
|
|
577
|
+
- $ref: '#/components/schemas/Tag'
|
|
578
|
+
`);
|
|
579
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
580
|
+
const schema = getSchema({
|
|
581
|
+
parser,
|
|
582
|
+
schemaOrRef: spec.components.schemas.User,
|
|
583
|
+
pointer: '#/components/schemas/User',
|
|
584
|
+
options,
|
|
585
|
+
deps,
|
|
586
|
+
});
|
|
587
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
588
|
+
pet: oneOf
|
|
589
|
+
Tag ->
|
|
590
|
+
name: <string> (Tag name)
|
|
591
|
+
items: oneOf
|
|
592
|
+
Tag -> <object> !circular
|
|
593
|
+
`);
|
|
594
|
+
});
|
|
595
|
+
test('should not use discriminator for direct schemas refs in oneOf/anyOf', () => {
|
|
596
|
+
const spec = parseYaml(outdent `
|
|
597
|
+
openapi: 3.0.0
|
|
598
|
+
components:
|
|
599
|
+
schemas:
|
|
600
|
+
Parent:
|
|
601
|
+
type: object
|
|
602
|
+
discriminator:
|
|
603
|
+
propertyName: type
|
|
604
|
+
mapping:
|
|
605
|
+
foo: '#/components/schemas/Foo'
|
|
606
|
+
bar: '#/components/schemas/Bar'
|
|
607
|
+
baz: '#/components/schemas/Baz'
|
|
608
|
+
properties:
|
|
609
|
+
type:
|
|
610
|
+
type: string
|
|
611
|
+
Foo:
|
|
612
|
+
allOf:
|
|
613
|
+
- $ref: '#/components/schemas/Parent'
|
|
614
|
+
- type: object
|
|
615
|
+
Bar:
|
|
616
|
+
allOf:
|
|
617
|
+
- $ref: '#/components/schemas/Parent'
|
|
618
|
+
- type: object
|
|
619
|
+
Baz:
|
|
620
|
+
allOf:
|
|
621
|
+
- $ref: '#/components/schemas/Parent'
|
|
622
|
+
- type: object
|
|
623
|
+
properties:
|
|
624
|
+
nested:
|
|
625
|
+
anyOf:
|
|
626
|
+
- $ref: '#/components/schemas/Foo'
|
|
627
|
+
- $ref: '#/components/schemas/Bar'
|
|
628
|
+
`);
|
|
629
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
630
|
+
const schema = getSchema({
|
|
631
|
+
parser,
|
|
632
|
+
schemaOrRef: spec.components.schemas.Parent,
|
|
633
|
+
pointer: '#/components/schemas/Parent',
|
|
634
|
+
options,
|
|
635
|
+
deps,
|
|
636
|
+
});
|
|
637
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
638
|
+
oneOf
|
|
639
|
+
foo ->
|
|
640
|
+
type: <string>
|
|
641
|
+
bar ->
|
|
642
|
+
type: <string>
|
|
643
|
+
baz ->
|
|
644
|
+
type: <string>
|
|
645
|
+
nested: oneOf
|
|
646
|
+
Foo ->
|
|
647
|
+
type: <string>
|
|
648
|
+
Bar ->
|
|
649
|
+
type: <string>
|
|
650
|
+
`);
|
|
651
|
+
});
|
|
652
|
+
test('should use titles in oneOf schemas and should not be recursive', () => {
|
|
653
|
+
const spec = parseYaml(outdent `
|
|
654
|
+
openapi: 3.1.0
|
|
655
|
+
components:
|
|
656
|
+
schemas:
|
|
657
|
+
OneOfTitle:
|
|
658
|
+
oneOf:
|
|
659
|
+
- $ref: "#/components/schemas/Foo"
|
|
660
|
+
- $ref: "#/components/schemas/Bar"
|
|
661
|
+
Foo:
|
|
662
|
+
title: Foo Title
|
|
663
|
+
type: object
|
|
664
|
+
description: test Foo description
|
|
665
|
+
properties:
|
|
666
|
+
type:
|
|
667
|
+
type: string
|
|
668
|
+
Bar:
|
|
669
|
+
title: Bar Title
|
|
670
|
+
type: object
|
|
671
|
+
description: test Bar description
|
|
672
|
+
properties:
|
|
673
|
+
type:
|
|
674
|
+
type: string
|
|
675
|
+
`);
|
|
676
|
+
parser = new OpenAPIParser(spec, undefined, options);
|
|
677
|
+
const schema = getSchema({
|
|
678
|
+
parser,
|
|
679
|
+
schemaOrRef: spec.components.schemas.OneOfTitle,
|
|
680
|
+
pointer: '#/components/schemas/OneOfTitle',
|
|
681
|
+
options,
|
|
682
|
+
deps,
|
|
683
|
+
});
|
|
684
|
+
expect(printSchema(schema, circularDetailsPrinter)).toMatchInlineSnapshot(`
|
|
685
|
+
oneOf
|
|
686
|
+
Foo Title ->
|
|
687
|
+
type: <string>
|
|
688
|
+
Bar Title ->
|
|
689
|
+
type: <string>
|
|
690
|
+
`);
|
|
691
|
+
});
|
|
692
|
+
});
|
|
693
|
+
});
|
|
694
|
+
//# sourceMappingURL=Schema.circular.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|