@upendra19/swagger-ui-custom 1.0.0
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/.agignore +1 -0
- package/.browserslistrc +29 -0
- package/.dockerignore +8 -0
- package/.editorconfig +10 -0
- package/.eslintrc.js +78 -0
- package/.lintstagedrc +4 -0
- package/.nvmrc +1 -0
- package/.prettierrc.yaml +5 -0
- package/.releaserc +26 -0
- package/AUTHORIZATION_CONFIG.md +350 -0
- package/Dockerfile +39 -0
- package/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +117 -0
- package/babel.config.js +140 -0
- package/composer.json +40 -0
- package/dist/favicon-16x16.png +0 -0
- package/dist/favicon-32x32.png +0 -0
- package/dist/index.css +16 -0
- package/dist/index.html +19 -0
- package/dist/log.bundle-sizes.swagger-ui.txt +114 -0
- package/dist/log.es-bundle-core-sizes.swagger-ui.txt +14 -0
- package/dist/log.es-bundle-sizes.swagger-ui.txt +114 -0
- package/dist/oauth2-redirect.html +6 -0
- package/dist/oauth2-redirect.js +1 -0
- package/dist/swagger-initializer.js +20 -0
- package/dist/swagger-ui-bundle.js +2 -0
- package/dist/swagger-ui-bundle.js.LICENSE.txt +106 -0
- package/dist/swagger-ui-bundle.js.map +1 -0
- package/dist/swagger-ui-es-bundle-core.js +3 -0
- package/dist/swagger-ui-es-bundle-core.js.LICENSE.txt +35 -0
- package/dist/swagger-ui-es-bundle-core.js.map +1 -0
- package/dist/swagger-ui-es-bundle.js +2 -0
- package/dist/swagger-ui-es-bundle.js.LICENSE.txt +106 -0
- package/dist/swagger-ui-es-bundle.js.map +1 -0
- package/dist/swagger-ui-standalone-preset.js +2 -0
- package/dist/swagger-ui-standalone-preset.js.LICENSE.txt +22 -0
- package/dist/swagger-ui-standalone-preset.js.map +1 -0
- package/dist/swagger-ui.css +3 -0
- package/dist/swagger-ui.css.map +1 -0
- package/dist/swagger-ui.js +2 -0
- package/dist/swagger-ui.js.map +1 -0
- package/docker/configurator/helpers.js +13 -0
- package/docker/configurator/index.js +52 -0
- package/docker/configurator/oauth.js +55 -0
- package/docker/configurator/translator.js +111 -0
- package/docker/configurator/variables.js +125 -0
- package/docker/cors.conf +14 -0
- package/docker/default.conf.template +43 -0
- package/docker/docker-entrypoint.d/40-swagger-ui.sh +52 -0
- package/docker/embedding.conf +5 -0
- package/package.json +224 -0
- package/snapcraft.yaml +28 -0
- package/src/core/assets/rolling-load.svg +1 -0
- package/src/core/components/app.jsx +30 -0
- package/src/core/components/auth/api-key-auth.jsx +93 -0
- package/src/core/components/auth/auth-item.jsx +60 -0
- package/src/core/components/auth/authorization-popup.jsx +59 -0
- package/src/core/components/auth/authorize-btn.jsx +30 -0
- package/src/core/components/auth/authorize-operation-btn.jsx +35 -0
- package/src/core/components/auth/auths.jsx +124 -0
- package/src/core/components/auth/basic-auth.jsx +110 -0
- package/src/core/components/auth/error.jsx +24 -0
- package/src/core/components/auth/oauth2.jsx +283 -0
- package/src/core/components/clear.jsx +25 -0
- package/src/core/components/contact.jsx +44 -0
- package/src/core/components/content-type.jsx +64 -0
- package/src/core/components/copy-to-clipboard-btn.jsx +29 -0
- package/src/core/components/curl.jsx +38 -0
- package/src/core/components/debug.jsx +50 -0
- package/src/core/components/deep-link.jsx +20 -0
- package/src/core/components/errors.jsx +132 -0
- package/src/core/components/example.jsx +43 -0
- package/src/core/components/examples-select-value-retainer.jsx +254 -0
- package/src/core/components/examples-select.jsx +139 -0
- package/src/core/components/execute.jsx +103 -0
- package/src/core/components/footer.jsx +9 -0
- package/src/core/components/headers.jsx +58 -0
- package/src/core/components/info.jsx +169 -0
- package/src/core/components/initialized-input.jsx +36 -0
- package/src/core/components/jump-to-path.jsx +9 -0
- package/src/core/components/layout-utils.jsx +265 -0
- package/src/core/components/layouts/base.jsx +156 -0
- package/src/core/components/layouts/xpane.jsx +73 -0
- package/src/core/components/license.jsx +40 -0
- package/src/core/components/live-response.jsx +133 -0
- package/src/core/components/online-validator-badge.jsx +120 -0
- package/src/core/components/openapi-version.jsx +15 -0
- package/src/core/components/operation-extension-row.jsx +17 -0
- package/src/core/components/operation-extensions.jsx +35 -0
- package/src/core/components/operation-summary-method.jsx +25 -0
- package/src/core/components/operation-summary-path.jsx +54 -0
- package/src/core/components/operation-summary.jsx +102 -0
- package/src/core/components/operation-tag.jsx +121 -0
- package/src/core/components/operation.jsx +259 -0
- package/src/core/components/operations.jsx +100 -0
- package/src/core/components/overview.jsx +119 -0
- package/src/core/components/param-body.jsx +156 -0
- package/src/core/components/parameter-extension.jsx +12 -0
- package/src/core/components/parameter-include-empty.jsx +59 -0
- package/src/core/components/parameter-row.jsx +438 -0
- package/src/core/components/parameters/index.js +1 -0
- package/src/core/components/parameters/parameters.jsx +287 -0
- package/src/core/components/property.jsx +17 -0
- package/src/core/components/providers/README.md +6 -0
- package/src/core/components/providers/markdown.jsx +72 -0
- package/src/core/components/response-body.jsx +170 -0
- package/src/core/components/response-extension.jsx +12 -0
- package/src/core/components/response.jsx +276 -0
- package/src/core/components/responses.jsx +170 -0
- package/src/core/components/svg-assets.jsx +48 -0
- package/src/core/components/system-wrapper.jsx +0 -0
- package/src/core/components/try-it-out-button.jsx +41 -0
- package/src/core/components/version-pragma-filter.jsx +54 -0
- package/src/core/components/version-stamp.jsx +12 -0
- package/src/core/containers/OperationContainer.jsx +267 -0
- package/src/core/containers/authorize-btn.jsx +31 -0
- package/src/core/containers/filter.jsx +44 -0
- package/src/core/containers/info.jsx +35 -0
- package/src/core/index.js +174 -0
- package/src/core/oauth2-authorize.js +137 -0
- package/src/core/plugins/auth/actions.js +286 -0
- package/src/core/plugins/auth/components/lock-auth-icon.jsx +27 -0
- package/src/core/plugins/auth/components/unlock-auth-icon.jsx +27 -0
- package/src/core/plugins/auth/configs-extensions/wrap-actions.js +19 -0
- package/src/core/plugins/auth/index.js +94 -0
- package/src/core/plugins/auth/reducers.js +77 -0
- package/src/core/plugins/auth/selectors.js +121 -0
- package/src/core/plugins/auth/spec-extensions/wrap-actions.js +10 -0
- package/src/core/plugins/auth/wrap-actions.js +66 -0
- package/src/core/plugins/configs/actions.js +58 -0
- package/src/core/plugins/configs/fn.js +12 -0
- package/src/core/plugins/configs/index.js +16 -0
- package/src/core/plugins/configs/reducers.js +20 -0
- package/src/core/plugins/configs/selectors.js +4 -0
- package/src/core/plugins/deep-linking/README.md +1 -0
- package/src/core/plugins/deep-linking/helpers.js +7 -0
- package/src/core/plugins/deep-linking/index.js +24 -0
- package/src/core/plugins/deep-linking/layout.js +209 -0
- package/src/core/plugins/deep-linking/operation-tag-wrapper.jsx +25 -0
- package/src/core/plugins/deep-linking/operation-wrapper.jsx +27 -0
- package/src/core/plugins/download-url/index.js +126 -0
- package/src/core/plugins/err/actions.js +60 -0
- package/src/core/plugins/err/error-transformers/README.md +31 -0
- package/src/core/plugins/err/error-transformers/hook.js +38 -0
- package/src/core/plugins/err/error-transformers/transformers/not-of-type.js +29 -0
- package/src/core/plugins/err/error-transformers/transformers/parameter-oneof.js +59 -0
- package/src/core/plugins/err/index.js +15 -0
- package/src/core/plugins/err/reducers.js +100 -0
- package/src/core/plugins/err/selectors.js +15 -0
- package/src/core/plugins/filter/index.js +9 -0
- package/src/core/plugins/filter/opsFilter.js +3 -0
- package/src/core/plugins/icons/components/arrow-down.jsx +28 -0
- package/src/core/plugins/icons/components/arrow-up.jsx +28 -0
- package/src/core/plugins/icons/components/arrow.jsx +28 -0
- package/src/core/plugins/icons/components/close.jsx +28 -0
- package/src/core/plugins/icons/components/copy.jsx +34 -0
- package/src/core/plugins/icons/components/lock.jsx +28 -0
- package/src/core/plugins/icons/components/unlock.jsx +28 -0
- package/src/core/plugins/icons/index.js +24 -0
- package/src/core/plugins/json-schema-2020-12/components/Accordion/Accordion.jsx +45 -0
- package/src/core/plugins/json-schema-2020-12/components/Accordion/_accordion.scss +33 -0
- package/src/core/plugins/json-schema-2020-12/components/ExpandDeepButton/ExpandDeepButton.jsx +31 -0
- package/src/core/plugins/json-schema-2020-12/components/ExpandDeepButton/_expand-deep-button.scss +10 -0
- package/src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx +227 -0
- package/src/core/plugins/json-schema-2020-12/components/JSONSchema/_json-schema.scss +34 -0
- package/src/core/plugins/json-schema-2020-12/components/JSONViewer/JSONViewer.jsx +153 -0
- package/src/core/plugins/json-schema-2020-12/components/JSONViewer/_json-viewer.scss +11 -0
- package/src/core/plugins/json-schema-2020-12/components/_all.scss +4 -0
- package/src/core/plugins/json-schema-2020-12/components/_mixins.scss +82 -0
- package/src/core/plugins/json-schema-2020-12/components/icons/ChevronRight.jsx +17 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/$anchor.jsx +27 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/$comment.jsx +27 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/$defs.jsx +93 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/$dynamicAnchor.jsx +27 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/$dynamicRef.jsx +27 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/$id.jsx +27 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/$ref.jsx +27 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/$schema.jsx +27 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/$vocabulary/$vocabulary.jsx +66 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/$vocabulary/_$vocabulary.scss +17 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/AdditionalProperties.jsx +55 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/AllOf.jsx +105 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/AnyOf.jsx +105 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Const/Const.jsx +28 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Const/_const.scss +11 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Constraint/Constraint.jsx +38 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Constraint/_constraint.scss +16 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Contains.jsx +35 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/ContentSchema.jsx +39 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Default/Default.jsx +28 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Default/_default.scss +11 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/DependentRequired/DependentRequired.jsx +37 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/DependentRequired/_dependent-required.scss +12 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/DependentSchemas.jsx +97 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Deprecated.jsx +22 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Description/Description.jsx +24 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Description/_description.scss +9 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Else.jsx +35 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Enum/Enum.jsx +27 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Enum/_enum.scss +11 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Examples/Examples.jsx +30 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Examples/_examples.scss +11 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/ExtensionKeywords/ExtensionKeywords.jsx +103 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/ExtensionKeywords/_extension-keywords.scss +11 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/If.jsx +35 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Items.jsx +35 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Not.jsx +35 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/OneOf.jsx +105 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/PatternProperties/PatternProperties.jsx +41 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/PatternProperties/_pattern-properties.scss +21 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/PrefixItems.jsx +105 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Properties/Properties.jsx +61 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Properties/_properties.scss +24 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/PropertyNames.jsx +38 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/ReadOnly.jsx +22 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Then.jsx +35 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Title/Title.jsx +24 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Title/_title.scss +26 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/Type.jsx +27 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/UnevaluatedItems.jsx +39 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/UnevaluatedProperties.jsx +39 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/WriteOnly.jsx +22 -0
- package/src/core/plugins/json-schema-2020-12/components/keywords/_all.scss +43 -0
- package/src/core/plugins/json-schema-2020-12/context.js +14 -0
- package/src/core/plugins/json-schema-2020-12/enum.js +10 -0
- package/src/core/plugins/json-schema-2020-12/fn.js +527 -0
- package/src/core/plugins/json-schema-2020-12/hoc.jsx +296 -0
- package/src/core/plugins/json-schema-2020-12/hooks.js +144 -0
- package/src/core/plugins/json-schema-2020-12/index.js +153 -0
- package/src/core/plugins/json-schema-2020-12/prop-types.js +10 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/api/encoderAPI.js +20 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/api/formatAPI.js +20 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/api/mediaTypeAPI.js +27 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/api/optionAPI.js +17 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/class/EncoderRegistry.js +33 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/class/FormatRegistry.js +65 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/class/MediaTypeRegistry.js +27 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/class/OptionRegistry.js +16 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/class/Registry.js +24 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/constants.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/example.js +57 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/merge.js +83 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/predicates.js +16 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/random.js +46 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/type.js +156 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/utils.js +23 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/7bit.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/8bit.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/base16.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/base32.js +34 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/base64.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/base64url.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/binary.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/quoted-printable.js +38 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/date-time.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/date.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/double.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/duration.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/email.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/float.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/hostname.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/idn-email.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/idn-hostname.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/int32.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/int64.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/ipv4.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/ipv6.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/iri-reference.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/iri.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/json-pointer.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/media-types/application.js +17 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/media-types/audio.js +10 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/media-types/image.js +10 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/media-types/text.js +17 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/media-types/video.js +10 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/password.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/regex.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/relative-json-pointer.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/time.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/uri-reference.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/uri-template.js +7 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/uri.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/uuid.js +6 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/get-json-sample-schema.js +36 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/get-sample-schema.js +39 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/get-xml-sample-schema.js +35 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/get-yaml-sample-schema.js +34 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/index.js +16 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/main.js +562 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/array.js +52 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/boolean.js +9 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/index.js +30 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/integer.js +43 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/null.js +9 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/number.js +65 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/object.js +9 -0
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/string.js +80 -0
- package/src/core/plugins/json-schema-2020-12-samples/index.js +51 -0
- package/src/core/plugins/json-schema-5/components/array-model.jsx +80 -0
- package/src/core/plugins/json-schema-5/components/enum-model.jsx +19 -0
- package/src/core/plugins/json-schema-5/components/json-schema-components.jsx +441 -0
- package/src/core/plugins/json-schema-5/components/model-collapse.jsx +99 -0
- package/src/core/plugins/json-schema-5/components/model-example.jsx +160 -0
- package/src/core/plugins/json-schema-5/components/model-extensions.jsx +28 -0
- package/src/core/plugins/json-schema-5/components/model-wrapper.jsx +44 -0
- package/src/core/plugins/json-schema-5/components/model.jsx +136 -0
- package/src/core/plugins/json-schema-5/components/models.jsx +139 -0
- package/src/core/plugins/json-schema-5/components/object-model.jsx +340 -0
- package/src/core/plugins/json-schema-5/components/primitive-model.jsx +137 -0
- package/src/core/plugins/json-schema-5/components/schemes.jsx +53 -0
- package/src/core/plugins/json-schema-5/containers/schemes.jsx +30 -0
- package/src/core/plugins/json-schema-5/fn.js +51 -0
- package/src/core/plugins/json-schema-5/index.js +41 -0
- package/src/core/plugins/json-schema-5-samples/fn/get-json-sample-schema.js +32 -0
- package/src/core/plugins/json-schema-5-samples/fn/get-sample-schema.js +30 -0
- package/src/core/plugins/json-schema-5-samples/fn/get-xml-sample-schema.js +31 -0
- package/src/core/plugins/json-schema-5-samples/fn/get-yaml-sample-schema.js +34 -0
- package/src/core/plugins/json-schema-5-samples/fn/index.js +653 -0
- package/src/core/plugins/json-schema-5-samples/index.js +56 -0
- package/src/core/plugins/layout/actions.js +39 -0
- package/src/core/plugins/layout/index.js +19 -0
- package/src/core/plugins/layout/reducers.js +32 -0
- package/src/core/plugins/layout/selectors.js +24 -0
- package/src/core/plugins/layout/spec-extensions/wrap-selector.js +22 -0
- package/src/core/plugins/logs/index.js +28 -0
- package/src/core/plugins/oas3/actions.js +99 -0
- package/src/core/plugins/oas3/auth-extensions/wrap-selectors.js +92 -0
- package/src/core/plugins/oas3/components/auth/http-auth.jsx +157 -0
- package/src/core/plugins/oas3/components/callbacks.jsx +51 -0
- package/src/core/plugins/oas3/components/index.js +19 -0
- package/src/core/plugins/oas3/components/operation-link.jsx +43 -0
- package/src/core/plugins/oas3/components/operation-servers.jsx +102 -0
- package/src/core/plugins/oas3/components/request-body-editor.jsx +103 -0
- package/src/core/plugins/oas3/components/request-body.jsx +338 -0
- package/src/core/plugins/oas3/components/servers-container.jsx +33 -0
- package/src/core/plugins/oas3/components/servers.jsx +153 -0
- package/src/core/plugins/oas3/fn.js +35 -0
- package/src/core/plugins/oas3/helpers.jsx +48 -0
- package/src/core/plugins/oas3/index.js +39 -0
- package/src/core/plugins/oas3/reducers.js +111 -0
- package/src/core/plugins/oas3/selectors.js +308 -0
- package/src/core/plugins/oas3/spec-extensions/selectors.js +100 -0
- package/src/core/plugins/oas3/spec-extensions/wrap-selectors.js +71 -0
- package/src/core/plugins/oas3/wrap-components/auth/auth-item.jsx +25 -0
- package/src/core/plugins/oas3/wrap-components/index.js +15 -0
- package/src/core/plugins/oas3/wrap-components/json-schema-string.jsx +27 -0
- package/src/core/plugins/oas3/wrap-components/markdown.jsx +45 -0
- package/src/core/plugins/oas3/wrap-components/model.jsx +40 -0
- package/src/core/plugins/oas3/wrap-components/online-validator-badge.js +5 -0
- package/src/core/plugins/oas3/wrap-components/openapi-version.jsx +7 -0
- package/src/core/plugins/oas31/after-load.js +72 -0
- package/src/core/plugins/oas31/auth-extensions/wrap-selectors.js +28 -0
- package/src/core/plugins/oas31/components/_all.scss +2 -0
- package/src/core/plugins/oas31/components/auth/auths.jsx +186 -0
- package/src/core/plugins/oas31/components/auth/mutual-tls-auth.jsx +32 -0
- package/src/core/plugins/oas31/components/contact.jsx +43 -0
- package/src/core/plugins/oas31/components/info.jsx +99 -0
- package/src/core/plugins/oas31/components/json-schema-dialect.jsx +60 -0
- package/src/core/plugins/oas31/components/license.jsx +38 -0
- package/src/core/plugins/oas31/components/model/_model.scss +23 -0
- package/src/core/plugins/oas31/components/model/model.jsx +54 -0
- package/src/core/plugins/oas31/components/models/_models.scss +11 -0
- package/src/core/plugins/oas31/components/models/models.jsx +141 -0
- package/src/core/plugins/oas31/components/version-pragma-filter.jsx +73 -0
- package/src/core/plugins/oas31/components/webhooks.jsx +49 -0
- package/src/core/plugins/oas31/fn.js +124 -0
- package/src/core/plugins/oas31/index.js +166 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Description.jsx +27 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Discriminator/Discriminator.jsx +118 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Discriminator/DiscriminatorMapping.jsx +32 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Example.jsx +28 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/ExternalDocs.jsx +143 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/OpenAPIExtensions.jsx +33 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Properties.jsx +60 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Xml.jsx +162 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/fn.js +57 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Description.jsx +9 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Examples.jsx +31 -0
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Properties.jsx +9 -0
- package/src/core/plugins/oas31/oas3-extensions/fn.js +46 -0
- package/src/core/plugins/oas31/selectors.js +26 -0
- package/src/core/plugins/oas31/spec-extensions/selectors.js +198 -0
- package/src/core/plugins/oas31/spec-extensions/wrap-selectors.js +18 -0
- package/src/core/plugins/oas31/wrap-components/auth/auth-item.jsx +22 -0
- package/src/core/plugins/oas31/wrap-components/auths.jsx +17 -0
- package/src/core/plugins/oas31/wrap-components/contact.jsx +15 -0
- package/src/core/plugins/oas31/wrap-components/info.jsx +15 -0
- package/src/core/plugins/oas31/wrap-components/license.jsx +15 -0
- package/src/core/plugins/oas31/wrap-components/model.jsx +44 -0
- package/src/core/plugins/oas31/wrap-components/models.jsx +47 -0
- package/src/core/plugins/oas31/wrap-components/version-pragma-filter.jsx +16 -0
- package/src/core/plugins/on-complete/index.js +28 -0
- package/src/core/plugins/request-snippets/fn.js +169 -0
- package/src/core/plugins/request-snippets/index.js +21 -0
- package/src/core/plugins/request-snippets/request-snippets.jsx +163 -0
- package/src/core/plugins/request-snippets/selectors.js +45 -0
- package/src/core/plugins/safe-render/components/error-boundary.jsx +52 -0
- package/src/core/plugins/safe-render/components/fallback.jsx +13 -0
- package/src/core/plugins/safe-render/fn.jsx +32 -0
- package/src/core/plugins/safe-render/index.js +42 -0
- package/src/core/plugins/spec/actions.js +531 -0
- package/src/core/plugins/spec/index.js +20 -0
- package/src/core/plugins/spec/reducers.js +176 -0
- package/src/core/plugins/spec/selectors.js +575 -0
- package/src/core/plugins/spec/wrap-actions.js +39 -0
- package/src/core/plugins/swagger-client/configs-wrap-actions.js +6 -0
- package/src/core/plugins/swagger-client/index.js +54 -0
- package/src/core/plugins/syntax-highlighting/after-load.js +25 -0
- package/src/core/plugins/syntax-highlighting/components/HighlightCode.jsx +107 -0
- package/src/core/plugins/syntax-highlighting/components/PlainTextViewer.jsx +17 -0
- package/src/core/plugins/syntax-highlighting/components/SyntaxHighlighter.jsx +42 -0
- package/src/core/plugins/syntax-highlighting/index.js +34 -0
- package/src/core/plugins/syntax-highlighting/root-injects.js +22 -0
- package/src/core/plugins/syntax-highlighting/wrap-components/SyntaxHighlighter.jsx +31 -0
- package/src/core/plugins/util/index.js +11 -0
- package/src/core/plugins/versions/after-load.js +19 -0
- package/src/core/plugins/versions/index.js +10 -0
- package/src/core/plugins/view/fn.js +1 -0
- package/src/core/plugins/view/index.js +34 -0
- package/src/core/plugins/view/root-injects.jsx +118 -0
- package/src/core/plugins/view-legacy/index.js +25 -0
- package/src/core/plugins/view-legacy/root-injects.jsx +12 -0
- package/src/core/presets/apis/index.js +18 -0
- package/src/core/presets/base/index.js +55 -0
- package/src/core/presets/base/plugins/core-components/index.js +130 -0
- package/src/core/presets/base/plugins/form-components/index.js +10 -0
- package/src/core/system.js +511 -0
- package/src/core/utils/create-html-ready-id.js +10 -0
- package/src/core/utils/get-parameter-schema.js +94 -0
- package/src/core/utils/index.js +847 -0
- package/src/core/utils/jsonParse.js +15 -0
- package/src/core/utils/memoizeN.js +48 -0
- package/src/core/utils/url.js +79 -0
- package/src/core/window.js +30 -0
- package/src/index.js +3 -0
- package/src/standalone/plugins/stadalone-layout/components/StandaloneLayout.jsx +40 -0
- package/src/standalone/plugins/stadalone-layout/index.js +12 -0
- package/src/standalone/plugins/top-bar/assets/lightbulb-off.svg +1 -0
- package/src/standalone/plugins/top-bar/assets/lightbulb.svg +1 -0
- package/src/standalone/plugins/top-bar/assets/logo_small.svg +60 -0
- package/src/standalone/plugins/top-bar/components/DarkModeToggle.jsx +47 -0
- package/src/standalone/plugins/top-bar/components/Logo.jsx +9 -0
- package/src/standalone/plugins/top-bar/components/TopBar.jsx +183 -0
- package/src/standalone/plugins/top-bar/index.js +12 -0
- package/src/standalone/presets/standalone/index.js +19 -0
- package/src/style/_authorize.scss +96 -0
- package/src/style/_buttons.scss +199 -0
- package/src/style/_dark-mode.scss +664 -0
- package/src/style/_errors.scss +72 -0
- package/src/style/_form.scss +214 -0
- package/src/style/_information.scss +99 -0
- package/src/style/_layout.scss +941 -0
- package/src/style/_markdown.scss +34 -0
- package/src/style/_mixins.scss +159 -0
- package/src/style/_modal.scss +95 -0
- package/src/style/_models.scss +330 -0
- package/src/style/_servers.scss +66 -0
- package/src/style/_split-pane-mode.scss +3 -0
- package/src/style/_table.scss +191 -0
- package/src/style/_topbar.scss +126 -0
- package/src/style/_type.scss +21 -0
- package/src/style/_variables.scss +230 -0
- package/src/style/main.scss +28 -0
- package/stylelint.config.js +11 -0
- package/swagger-ui-dist-package/absolute-path.js +14 -0
- package/swagger-ui-dist-package/index.js +17 -0
- package/swagger-ui-dist-package/package.json +20 -0
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
import { createSelector } from "reselect"
|
|
2
|
+
import constant from "lodash/constant"
|
|
3
|
+
import { sorters, paramToIdentifier } from "core/utils"
|
|
4
|
+
import { fromJS, Set, Map, OrderedMap, List } from "immutable"
|
|
5
|
+
|
|
6
|
+
const DEFAULT_TAG = "default"
|
|
7
|
+
|
|
8
|
+
const OPERATION_METHODS = [
|
|
9
|
+
"get", "put", "post", "delete", "options", "head", "patch", "trace"
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
const state = state => {
|
|
13
|
+
return state || Map()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const lastError = createSelector(
|
|
17
|
+
state,
|
|
18
|
+
spec => spec.get("lastError")
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export const url = createSelector(
|
|
22
|
+
state,
|
|
23
|
+
spec => spec.get("url")
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
export const specStr = createSelector(
|
|
27
|
+
state,
|
|
28
|
+
spec => spec.get("spec") || ""
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
export const specSource = createSelector(
|
|
32
|
+
state,
|
|
33
|
+
spec => spec.get("specSource") || "not-editor"
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
export const specJson = createSelector(
|
|
37
|
+
state,
|
|
38
|
+
spec => spec.get("json", Map())
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
export const specJS = createSelector(
|
|
42
|
+
specJson,
|
|
43
|
+
(spec) => spec.toJS()
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
export const specResolved = createSelector(
|
|
47
|
+
state,
|
|
48
|
+
spec => spec.get("resolved", Map())
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
export const specResolvedSubtree = (state, path) => {
|
|
52
|
+
return state.getIn(["resolvedSubtrees", ...path], undefined)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const mergerFn = (oldVal, newVal) => {
|
|
56
|
+
if(Map.isMap(oldVal) && Map.isMap(newVal)) {
|
|
57
|
+
if(newVal.get("$$ref")) {
|
|
58
|
+
// resolver artifacts indicated that this key was directly resolved
|
|
59
|
+
// so we should drop the old value entirely
|
|
60
|
+
return newVal
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return OrderedMap().mergeWith(
|
|
64
|
+
mergerFn,
|
|
65
|
+
oldVal,
|
|
66
|
+
newVal
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return newVal
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const specJsonWithResolvedSubtrees = createSelector(
|
|
74
|
+
state,
|
|
75
|
+
spec => OrderedMap().mergeWith(
|
|
76
|
+
mergerFn,
|
|
77
|
+
spec.get("json"),
|
|
78
|
+
spec.get("resolvedSubtrees")
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
// Default Spec ( as an object )
|
|
83
|
+
export const spec = state => {
|
|
84
|
+
let res = specJson(state)
|
|
85
|
+
return res
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const isOAS3 = createSelector(
|
|
89
|
+
// isOAS3 is stubbed out here to work around an issue with injecting more selectors
|
|
90
|
+
// in the OAS3 plugin, and to ensure that the function is always available.
|
|
91
|
+
// It's not perfect, but our hybrid (core+plugin code) implementation for OAS3
|
|
92
|
+
// needs this. //KS
|
|
93
|
+
spec,
|
|
94
|
+
() => false
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
export const info = createSelector(
|
|
98
|
+
spec,
|
|
99
|
+
spec => returnSelfOrNewMap(spec && spec.get("info"))
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
export const externalDocs = createSelector(
|
|
103
|
+
spec,
|
|
104
|
+
spec => returnSelfOrNewMap(spec && spec.get("externalDocs"))
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
export const version = createSelector(
|
|
108
|
+
info,
|
|
109
|
+
info => info && info.get("version")
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
export const semver = createSelector(
|
|
113
|
+
version,
|
|
114
|
+
version => /v?([0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(version).slice(1)
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
export const paths = createSelector(
|
|
118
|
+
specJsonWithResolvedSubtrees,
|
|
119
|
+
spec => spec.get("paths")
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
export const validOperationMethods = constant(["get", "put", "post", "delete", "options", "head", "patch"])
|
|
123
|
+
|
|
124
|
+
export const operations = createSelector(
|
|
125
|
+
paths,
|
|
126
|
+
paths => {
|
|
127
|
+
let list = List()
|
|
128
|
+
|
|
129
|
+
if (!Map.isMap(paths) || paths.isEmpty()) {
|
|
130
|
+
return list
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
paths.forEach((path, pathName) => {
|
|
134
|
+
if(!path || !path.forEach) {
|
|
135
|
+
return {}
|
|
136
|
+
}
|
|
137
|
+
path.forEach((operation, method) => {
|
|
138
|
+
if(OPERATION_METHODS.indexOf(method) < 0) {
|
|
139
|
+
return
|
|
140
|
+
}
|
|
141
|
+
list = list.push(fromJS({
|
|
142
|
+
path: pathName,
|
|
143
|
+
method,
|
|
144
|
+
operation,
|
|
145
|
+
id: `${method}-${pathName}`
|
|
146
|
+
}))
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
return list
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
export const consumes = createSelector(
|
|
155
|
+
spec,
|
|
156
|
+
spec => Set(spec.get("consumes"))
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
export const produces = createSelector(
|
|
160
|
+
spec,
|
|
161
|
+
spec => Set(spec.get("produces"))
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
export const security = createSelector(
|
|
165
|
+
spec,
|
|
166
|
+
spec => spec.get("security", List())
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
export const securityDefinitions = createSelector(
|
|
170
|
+
spec,
|
|
171
|
+
spec => spec.get("securityDefinitions")
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
export const findDefinition = ( state, name ) => {
|
|
176
|
+
const resolvedRes = state.getIn(["resolvedSubtrees", "definitions", name], null)
|
|
177
|
+
const unresolvedRes = state.getIn(["json", "definitions", name], null)
|
|
178
|
+
return resolvedRes || unresolvedRes || null
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export const definitions = createSelector(
|
|
182
|
+
spec,
|
|
183
|
+
spec => {
|
|
184
|
+
const res = spec.get("definitions")
|
|
185
|
+
return Map.isMap(res) ? res : Map()
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
export const basePath = createSelector(
|
|
190
|
+
spec,
|
|
191
|
+
spec => spec.get("basePath")
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
export const host = createSelector(
|
|
195
|
+
spec,
|
|
196
|
+
spec => spec.get("host")
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
export const schemes = createSelector(
|
|
200
|
+
spec,
|
|
201
|
+
spec => spec.get("schemes", Map())
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
export const operationsWithRootInherited = createSelector(
|
|
205
|
+
[
|
|
206
|
+
operations,
|
|
207
|
+
consumes,
|
|
208
|
+
produces
|
|
209
|
+
],
|
|
210
|
+
(operations, consumes, produces) => {
|
|
211
|
+
return operations.map( ops => ops.update("operation", op => {
|
|
212
|
+
if (Map.isMap(op)) {
|
|
213
|
+
return op.withMutations( op => {
|
|
214
|
+
if ( !op.get("consumes") ) {
|
|
215
|
+
op.update("consumes", a => Set(a).merge(consumes))
|
|
216
|
+
}
|
|
217
|
+
if ( !op.get("produces") ) {
|
|
218
|
+
op.update("produces", a => Set(a).merge(produces))
|
|
219
|
+
}
|
|
220
|
+
return op
|
|
221
|
+
})
|
|
222
|
+
} else {
|
|
223
|
+
// return something with Immutable methods
|
|
224
|
+
return Map()
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
}))
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
export const tags = createSelector(
|
|
232
|
+
spec,
|
|
233
|
+
json => {
|
|
234
|
+
const tags = json.get("tags", List())
|
|
235
|
+
return List.isList(tags) ? tags.filter(tag => Map.isMap(tag)) : List()
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
export const tagDetails = (state, tag) => {
|
|
240
|
+
let currentTags = tags(state) || List()
|
|
241
|
+
return currentTags.filter(Map.isMap).find(t => t.get("name") === tag, Map())
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export const operationsWithTags = createSelector(
|
|
245
|
+
operationsWithRootInherited,
|
|
246
|
+
tags,
|
|
247
|
+
(operations, tags) => {
|
|
248
|
+
return operations.reduce( (taggedMap, op) => {
|
|
249
|
+
let tags = Set(op.getIn(["operation","tags"]))
|
|
250
|
+
if(tags.count() < 1)
|
|
251
|
+
return taggedMap.update(DEFAULT_TAG, List(), ar => ar.push(op))
|
|
252
|
+
return tags.reduce( (res, tag) => res.update(tag, List(), (ar) => ar.push(op)), taggedMap )
|
|
253
|
+
}, tags.reduce( (taggedMap, tag) => {
|
|
254
|
+
return taggedMap.set(tag.get("name"), List())
|
|
255
|
+
} , OrderedMap()))
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
export const taggedOperations = (state) => ({ getConfigs }) => {
|
|
260
|
+
let { tagsSorter, operationsSorter } = getConfigs()
|
|
261
|
+
return operationsWithTags(state)
|
|
262
|
+
.sortBy(
|
|
263
|
+
(val, key) => key, // get the name of the tag to be passed to the sorter
|
|
264
|
+
(tagA, tagB) => {
|
|
265
|
+
let sortFn = (typeof tagsSorter === "function" ? tagsSorter : sorters.tagsSorter[ tagsSorter ])
|
|
266
|
+
return (!sortFn ? null : sortFn(tagA, tagB))
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
.map((ops, tag) => {
|
|
270
|
+
let sortFn = (typeof operationsSorter === "function" ? operationsSorter : sorters.operationsSorter[ operationsSorter ])
|
|
271
|
+
let operations = (!sortFn ? ops : ops.sort(sortFn))
|
|
272
|
+
|
|
273
|
+
return Map({ tagDetails: tagDetails(state, tag), operations: operations })
|
|
274
|
+
})
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export const responses = createSelector(
|
|
278
|
+
state,
|
|
279
|
+
state => state.get( "responses", Map() )
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
export const requests = createSelector(
|
|
283
|
+
state,
|
|
284
|
+
state => state.get( "requests", Map() )
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
export const mutatedRequests = createSelector(
|
|
288
|
+
state,
|
|
289
|
+
state => state.get( "mutatedRequests", Map() )
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
export const responseFor = (state, path, method) => {
|
|
293
|
+
return responses(state).getIn([path, method], null)
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export const requestFor = (state, path, method) => {
|
|
297
|
+
return requests(state).getIn([path, method], null)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export const mutatedRequestFor = (state, path, method) => {
|
|
301
|
+
return mutatedRequests(state).getIn([path, method], null)
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export const allowTryItOutFor = () => {
|
|
305
|
+
// This is just a hook for now.
|
|
306
|
+
return true
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export const parameterWithMetaByIdentity = (state, pathMethod, param) => {
|
|
310
|
+
const opParams = specJsonWithResolvedSubtrees(state).getIn(["paths", ...pathMethod, "parameters"], OrderedMap())
|
|
311
|
+
const metaParams = state.getIn(["meta", "paths", ...pathMethod, "parameters"], OrderedMap())
|
|
312
|
+
|
|
313
|
+
const mergedParams = opParams.map((currentParam) => {
|
|
314
|
+
const inNameKeyedMeta = metaParams.get(`${param.get("in")}.${param.get("name")}`)
|
|
315
|
+
const hashKeyedMeta = metaParams.get(`${param.get("in")}.${param.get("name")}.hash-${param.hashCode()}`)
|
|
316
|
+
return OrderedMap().merge(
|
|
317
|
+
currentParam,
|
|
318
|
+
inNameKeyedMeta,
|
|
319
|
+
hashKeyedMeta
|
|
320
|
+
)
|
|
321
|
+
})
|
|
322
|
+
return mergedParams.find(curr => curr.get("in") === param.get("in") && curr.get("name") === param.get("name"), OrderedMap())
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export const parameterInclusionSettingFor = (state, pathMethod, paramName, paramIn) => {
|
|
326
|
+
const paramKey = `${paramIn}.${paramName}`
|
|
327
|
+
return state.getIn(["meta", "paths", ...pathMethod, "parameter_inclusions", paramKey], false)
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
export const parameterWithMeta = (state, pathMethod, paramName, paramIn) => {
|
|
332
|
+
const opParams = specJsonWithResolvedSubtrees(state).getIn(["paths", ...pathMethod, "parameters"], OrderedMap())
|
|
333
|
+
const currentParam = opParams.find(param => param.get("in") === paramIn && param.get("name") === paramName, OrderedMap())
|
|
334
|
+
return parameterWithMetaByIdentity(state, pathMethod, currentParam)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export const operationWithMeta = (state, path, method) => {
|
|
338
|
+
const op = specJsonWithResolvedSubtrees(state).getIn(["paths", path, method], OrderedMap())
|
|
339
|
+
const meta = state.getIn(["meta", "paths", path, method], OrderedMap())
|
|
340
|
+
|
|
341
|
+
const mergedParams = op.get("parameters", List()).map((param) => {
|
|
342
|
+
return parameterWithMetaByIdentity(state, [path, method], param)
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
return OrderedMap()
|
|
346
|
+
.merge(op, meta)
|
|
347
|
+
.set("parameters", mergedParams)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Get the parameter value by parameter name
|
|
351
|
+
export function getParameter(state, pathMethod, name, inType) {
|
|
352
|
+
pathMethod = pathMethod || []
|
|
353
|
+
let params = state.getIn(["meta", "paths", ...pathMethod, "parameters"], fromJS([]))
|
|
354
|
+
return params.find( (p) => {
|
|
355
|
+
return Map.isMap(p) && p.get("name") === name && p.get("in") === inType
|
|
356
|
+
}) || Map() // Always return a map
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export const hasHost = createSelector(
|
|
360
|
+
spec,
|
|
361
|
+
spec => {
|
|
362
|
+
const host = spec.get("host")
|
|
363
|
+
return typeof host === "string" && host.length > 0 && host[0] !== "/"
|
|
364
|
+
}
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
// Get the parameter values, that the user filled out
|
|
368
|
+
export function parameterValues(state, pathMethod, isXml) {
|
|
369
|
+
pathMethod = pathMethod || []
|
|
370
|
+
let paramValues = operationWithMeta(state, ...pathMethod).get("parameters", List())
|
|
371
|
+
return paramValues.reduce( (hash, p) => {
|
|
372
|
+
let value = isXml && p.get("in") === "body" ? p.get("value_xml") : p.get("value")
|
|
373
|
+
if (List.isList(value)) {
|
|
374
|
+
value = value.filter(v => v !== "")
|
|
375
|
+
}
|
|
376
|
+
return hash.set(paramToIdentifier(p, { allowHashes: false }), value)
|
|
377
|
+
}, fromJS({}))
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// True if any parameter includes `in: ?`
|
|
381
|
+
export function parametersIncludeIn(parameters, inValue="") {
|
|
382
|
+
if(List.isList(parameters)) {
|
|
383
|
+
return parameters.some( p => Map.isMap(p) && p.get("in") === inValue )
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// True if any parameter includes `type: ?`
|
|
388
|
+
export function parametersIncludeType(parameters, typeValue="") {
|
|
389
|
+
if(List.isList(parameters)) {
|
|
390
|
+
return parameters.some( p => Map.isMap(p) && p.get("type") === typeValue )
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Get the consumes/produces value that the user selected
|
|
395
|
+
export function contentTypeValues(state, pathMethod) {
|
|
396
|
+
pathMethod = pathMethod || []
|
|
397
|
+
let op = specJsonWithResolvedSubtrees(state).getIn(["paths", ...pathMethod], fromJS({}))
|
|
398
|
+
let meta = state.getIn(["meta", "paths", ...pathMethod], fromJS({}))
|
|
399
|
+
let producesValue = currentProducesFor(state, pathMethod)
|
|
400
|
+
|
|
401
|
+
const parameters = op.get("parameters") || new List()
|
|
402
|
+
|
|
403
|
+
const requestContentType = (
|
|
404
|
+
meta.get("consumes_value") ? meta.get("consumes_value")
|
|
405
|
+
: parametersIncludeType(parameters, "file") ? "multipart/form-data"
|
|
406
|
+
: parametersIncludeType(parameters, "formData") ? "application/x-www-form-urlencoded"
|
|
407
|
+
: undefined
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
return fromJS({
|
|
411
|
+
requestContentType,
|
|
412
|
+
responseContentType: producesValue
|
|
413
|
+
})
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Get the currently selected produces value for an operation
|
|
417
|
+
export function currentProducesFor(state, pathMethod) {
|
|
418
|
+
pathMethod = pathMethod || []
|
|
419
|
+
|
|
420
|
+
const operation = specJsonWithResolvedSubtrees(state).getIn([ "paths", ...pathMethod], null)
|
|
421
|
+
|
|
422
|
+
if(operation === null) {
|
|
423
|
+
// return nothing if the operation does not exist
|
|
424
|
+
return
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const currentProducesValue = state.getIn(["meta", "paths", ...pathMethod, "produces_value"], null)
|
|
428
|
+
const firstProducesArrayItem = operation.getIn(["produces", 0], null)
|
|
429
|
+
|
|
430
|
+
return currentProducesValue || firstProducesArrayItem || "application/json"
|
|
431
|
+
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Get the produces options for an operation
|
|
435
|
+
export function producesOptionsFor(state, pathMethod) {
|
|
436
|
+
pathMethod = pathMethod || []
|
|
437
|
+
|
|
438
|
+
const spec = specJsonWithResolvedSubtrees(state)
|
|
439
|
+
const operation = spec.getIn([ "paths", ...pathMethod], null)
|
|
440
|
+
|
|
441
|
+
if(operation === null) {
|
|
442
|
+
// return nothing if the operation does not exist
|
|
443
|
+
return
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const [path] = pathMethod
|
|
447
|
+
|
|
448
|
+
const operationProduces = operation.get("produces", null)
|
|
449
|
+
const pathItemProduces = spec.getIn(["paths", path, "produces"], null)
|
|
450
|
+
const globalProduces = spec.getIn(["produces"], null)
|
|
451
|
+
|
|
452
|
+
return operationProduces || pathItemProduces || globalProduces
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// Get the consumes options for an operation
|
|
456
|
+
export function consumesOptionsFor(state, pathMethod) {
|
|
457
|
+
pathMethod = pathMethod || []
|
|
458
|
+
|
|
459
|
+
const spec = specJsonWithResolvedSubtrees(state)
|
|
460
|
+
const operation = spec.getIn(["paths", ...pathMethod], null)
|
|
461
|
+
|
|
462
|
+
if (operation === null) {
|
|
463
|
+
// return nothing if the operation does not exist
|
|
464
|
+
return
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const [path] = pathMethod
|
|
468
|
+
|
|
469
|
+
const operationConsumes = operation.get("consumes", null)
|
|
470
|
+
const pathItemConsumes = spec.getIn(["paths", path, "consumes"], null)
|
|
471
|
+
const globalConsumes = spec.getIn(["consumes"], null)
|
|
472
|
+
|
|
473
|
+
return operationConsumes || pathItemConsumes || globalConsumes
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export const operationScheme = ( state, path, method ) => {
|
|
477
|
+
let url = state.get("url")
|
|
478
|
+
let matchResult = url.match(/^([a-z][a-z0-9+\-.]*):/)
|
|
479
|
+
let urlScheme = Array.isArray(matchResult) ? matchResult[1] : null
|
|
480
|
+
|
|
481
|
+
return state.getIn(["scheme", path, method]) || state.getIn(["scheme", "_defaultScheme"]) || urlScheme || ""
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export const canExecuteScheme = ( state, path, method ) => {
|
|
485
|
+
return ["http", "https"].indexOf(operationScheme(state, path, method)) > -1
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export const validationErrors = (state, pathMethod) => {
|
|
489
|
+
pathMethod = pathMethod || []
|
|
490
|
+
const paramValues = state.getIn(["meta", "paths", ...pathMethod, "parameters"], fromJS([]))
|
|
491
|
+
const result = []
|
|
492
|
+
|
|
493
|
+
if (paramValues.length === 0) return result
|
|
494
|
+
|
|
495
|
+
const getErrorsWithPaths = (errors, path = []) => {
|
|
496
|
+
const getNestedErrorsWithPaths = (e, path) => {
|
|
497
|
+
const currPath = [...path, e.get("propKey") || e.get("index")]
|
|
498
|
+
return Map.isMap(e.get("error"))
|
|
499
|
+
? getErrorsWithPaths(e.get("error"), currPath)
|
|
500
|
+
: { error: e.get("error"), path: currPath }
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
return List.isList(errors)
|
|
504
|
+
? errors.map((e) => (Map.isMap(e) ? getNestedErrorsWithPaths(e, path) : { error: e, path }))
|
|
505
|
+
: getNestedErrorsWithPaths(errors, path)
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
const formatError = (error, path, paramName) => {
|
|
509
|
+
path = path.reduce((acc, curr) => {
|
|
510
|
+
return typeof curr === "number"
|
|
511
|
+
? `${acc}[${curr}]`
|
|
512
|
+
: acc
|
|
513
|
+
? `${acc}.${curr}`
|
|
514
|
+
: curr
|
|
515
|
+
}, "")
|
|
516
|
+
return `For '${paramName}'${path ? ` at path '${path}'` : ""}: ${error}.`
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
paramValues.forEach( (p, key) => {
|
|
520
|
+
const paramName = key.split(".").slice(1, -1).join(".")
|
|
521
|
+
const errors = p.get("errors")
|
|
522
|
+
if (errors && errors.count()) {
|
|
523
|
+
const errorsWithPaths = getErrorsWithPaths(errors)
|
|
524
|
+
errorsWithPaths.forEach(({error, path}) => {
|
|
525
|
+
result.push(formatError(error, path, paramName))
|
|
526
|
+
})
|
|
527
|
+
}
|
|
528
|
+
})
|
|
529
|
+
return result
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export const validateBeforeExecute = (state, pathMethod) => {
|
|
533
|
+
return validationErrors(state, pathMethod).length === 0
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export const getOAS3RequiredRequestBodyContentType = (state, pathMethod) => {
|
|
537
|
+
let requiredObj = {
|
|
538
|
+
requestBody: false,
|
|
539
|
+
requestContentType: {}
|
|
540
|
+
}
|
|
541
|
+
let requestBody = state.getIn(["resolvedSubtrees", "paths", ...pathMethod, "requestBody"], fromJS([]))
|
|
542
|
+
if (requestBody.size < 1) {
|
|
543
|
+
return requiredObj
|
|
544
|
+
}
|
|
545
|
+
if (requestBody.getIn(["required"])) {
|
|
546
|
+
requiredObj.requestBody = requestBody.getIn(["required"])
|
|
547
|
+
}
|
|
548
|
+
requestBody.getIn(["content"]).entrySeq().forEach((contentType) => { // e.g application/json
|
|
549
|
+
const key = contentType[0]
|
|
550
|
+
if (contentType[1].getIn(["schema", "required"])) {
|
|
551
|
+
const val = contentType[1].getIn(["schema", "required"]).toJS()
|
|
552
|
+
requiredObj.requestContentType[key] = val
|
|
553
|
+
}
|
|
554
|
+
})
|
|
555
|
+
return requiredObj
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export const isMediaTypeSchemaPropertiesEqual = ( state, pathMethod, currentMediaType, targetMediaType) => {
|
|
559
|
+
if((currentMediaType || targetMediaType) && currentMediaType === targetMediaType ) {
|
|
560
|
+
return true
|
|
561
|
+
}
|
|
562
|
+
let requestBodyContent = state.getIn(["resolvedSubtrees", "paths", ...pathMethod, "requestBody", "content"], fromJS([]))
|
|
563
|
+
if (requestBodyContent.size < 2 || !currentMediaType || !targetMediaType) {
|
|
564
|
+
// nothing to compare
|
|
565
|
+
return false
|
|
566
|
+
}
|
|
567
|
+
let currentMediaTypeSchemaProperties = requestBodyContent.getIn([currentMediaType, "schema", "properties"], fromJS([]))
|
|
568
|
+
let targetMediaTypeSchemaProperties = requestBodyContent.getIn([targetMediaType, "schema", "properties"], fromJS([]))
|
|
569
|
+
return !!currentMediaTypeSchemaProperties.equals(targetMediaTypeSchemaProperties)
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
function returnSelfOrNewMap(obj) {
|
|
573
|
+
// returns obj if obj is an Immutable map, else returns a new Map
|
|
574
|
+
return Map.isMap(obj) ? obj : new Map()
|
|
575
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import get from "lodash/get"
|
|
2
|
+
import isPlainObject from "lodash/isPlainObject"
|
|
3
|
+
|
|
4
|
+
export const updateSpec = (ori, {specActions}) => (...args) => {
|
|
5
|
+
ori(...args)
|
|
6
|
+
specActions.parseToJson(...args)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const updateJsonSpec = (ori, {specActions}) => (...args) => {
|
|
10
|
+
ori(...args)
|
|
11
|
+
|
|
12
|
+
specActions.invalidateResolvedSubtreeCache()
|
|
13
|
+
|
|
14
|
+
// Trigger resolution of any path-level $refs.
|
|
15
|
+
const [json] = args
|
|
16
|
+
const pathItems = get(json, ["paths"]) || {}
|
|
17
|
+
const pathItemKeys = Object.keys(pathItems)
|
|
18
|
+
|
|
19
|
+
pathItemKeys.forEach(k => {
|
|
20
|
+
const val = get(pathItems, [k])
|
|
21
|
+
|
|
22
|
+
if (isPlainObject(val) && val.$ref) {
|
|
23
|
+
specActions.requestResolvedSubtree(["paths", k])
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Trigger resolution of any securitySchemes-level $refs.
|
|
28
|
+
specActions.requestResolvedSubtree(["components", "securitySchemes"])
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Log the request ( just for debugging, shouldn't affect prod )
|
|
32
|
+
export const executeRequest = (ori, { specActions }) => (req) => {
|
|
33
|
+
specActions.logRequest(req)
|
|
34
|
+
return ori(req)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const validateParams = (ori, { specSelectors }) => (req) => {
|
|
38
|
+
return ori(req, specSelectors.isOAS3())
|
|
39
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import genericResolveStrategy from "swagger-client/es/resolver/strategies/generic"
|
|
2
|
+
import openApi2ResolveStrategy from "swagger-client/es/resolver/strategies/openapi-2"
|
|
3
|
+
import openApi30ResolveStrategy from "swagger-client/es/resolver/strategies/openapi-3-0"
|
|
4
|
+
import openApi31ApiDOMResolveStrategy from "swagger-client/es/resolver/strategies/openapi-3-1-apidom"
|
|
5
|
+
import { makeResolve } from "swagger-client/es/resolver"
|
|
6
|
+
import { execute, buildRequest } from "swagger-client/es/execute"
|
|
7
|
+
import Http, { makeHttp, serializeRes } from "swagger-client/es/http"
|
|
8
|
+
import { makeResolveSubtree } from "swagger-client/es/subtree-resolver"
|
|
9
|
+
import { opId } from "swagger-client/es/helpers"
|
|
10
|
+
import { loaded } from "./configs-wrap-actions"
|
|
11
|
+
|
|
12
|
+
export default function({ configs, getConfigs }) {
|
|
13
|
+
return {
|
|
14
|
+
fn: {
|
|
15
|
+
fetch: makeHttp(Http, configs.preFetch, configs.postFetch),
|
|
16
|
+
buildRequest,
|
|
17
|
+
execute,
|
|
18
|
+
resolve: makeResolve({
|
|
19
|
+
strategies: [
|
|
20
|
+
openApi31ApiDOMResolveStrategy,
|
|
21
|
+
openApi30ResolveStrategy,
|
|
22
|
+
openApi2ResolveStrategy,
|
|
23
|
+
genericResolveStrategy,
|
|
24
|
+
],
|
|
25
|
+
}),
|
|
26
|
+
resolveSubtree: async (obj, path, options = {}) => {
|
|
27
|
+
const freshConfigs = getConfigs()
|
|
28
|
+
const defaultOptions = {
|
|
29
|
+
modelPropertyMacro: freshConfigs.modelPropertyMacro,
|
|
30
|
+
parameterMacro: freshConfigs.parameterMacro,
|
|
31
|
+
requestInterceptor: freshConfigs.requestInterceptor,
|
|
32
|
+
responseInterceptor: freshConfigs.responseInterceptor,
|
|
33
|
+
strategies: [
|
|
34
|
+
openApi31ApiDOMResolveStrategy,
|
|
35
|
+
openApi30ResolveStrategy,
|
|
36
|
+
openApi2ResolveStrategy,
|
|
37
|
+
genericResolveStrategy,
|
|
38
|
+
],
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return makeResolveSubtree(defaultOptions)(obj, path, options)
|
|
42
|
+
},
|
|
43
|
+
serializeRes,
|
|
44
|
+
opId
|
|
45
|
+
},
|
|
46
|
+
statePlugins: {
|
|
47
|
+
configs: {
|
|
48
|
+
wrapActions: {
|
|
49
|
+
loaded,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @prettier
|
|
3
|
+
*/
|
|
4
|
+
import SyntaxHighlighter from "react-syntax-highlighter/dist/esm/light"
|
|
5
|
+
import js from "react-syntax-highlighter/dist/esm/languages/hljs/javascript"
|
|
6
|
+
import json from "react-syntax-highlighter/dist/esm/languages/hljs/json"
|
|
7
|
+
import xml from "react-syntax-highlighter/dist/esm/languages/hljs/xml"
|
|
8
|
+
import bash from "react-syntax-highlighter/dist/esm/languages/hljs/bash"
|
|
9
|
+
import yaml from "react-syntax-highlighter/dist/esm/languages/hljs/yaml"
|
|
10
|
+
import http from "react-syntax-highlighter/dist/esm/languages/hljs/http"
|
|
11
|
+
import powershell from "react-syntax-highlighter/dist/esm/languages/hljs/powershell"
|
|
12
|
+
import javascript from "react-syntax-highlighter/dist/esm/languages/hljs/javascript"
|
|
13
|
+
|
|
14
|
+
const afterLoad = () => {
|
|
15
|
+
SyntaxHighlighter.registerLanguage("json", json)
|
|
16
|
+
SyntaxHighlighter.registerLanguage("js", js)
|
|
17
|
+
SyntaxHighlighter.registerLanguage("xml", xml)
|
|
18
|
+
SyntaxHighlighter.registerLanguage("yaml", yaml)
|
|
19
|
+
SyntaxHighlighter.registerLanguage("http", http)
|
|
20
|
+
SyntaxHighlighter.registerLanguage("bash", bash)
|
|
21
|
+
SyntaxHighlighter.registerLanguage("powershell", powershell)
|
|
22
|
+
SyntaxHighlighter.registerLanguage("javascript", javascript)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default afterLoad
|