@upendra19/swagger-ui-custom 1.0.0 → 1.0.3
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/README.md +113 -0
- package/dist/swagger-ui-bundle.js +1 -1
- package/dist/swagger-ui-es-bundle-core.js +1 -1
- package/dist/swagger-ui-es-bundle-core.js.map +1 -1
- package/dist/swagger-ui-es-bundle.js +1 -1
- package/dist/swagger-ui.css +15 -1
- package/dist/swagger-ui.css.map +1 -1
- package/dist/swagger-ui.js +1 -1
- package/dist/swagger-ui.js.map +1 -1
- package/package.json +10 -18
- package/.agignore +0 -1
- package/.browserslistrc +0 -29
- package/.dockerignore +0 -8
- package/.editorconfig +0 -10
- package/.eslintrc.js +0 -78
- package/.lintstagedrc +0 -4
- package/.nvmrc +0 -1
- package/.prettierrc.yaml +0 -5
- package/.releaserc +0 -26
- package/AUTHORIZATION_CONFIG.md +0 -350
- package/Dockerfile +0 -39
- package/babel.config.js +0 -140
- package/composer.json +0 -40
- package/dist/favicon-16x16.png +0 -0
- package/dist/favicon-32x32.png +0 -0
- package/dist/index.css +0 -16
- package/dist/index.html +0 -19
- package/dist/log.bundle-sizes.swagger-ui.txt +0 -114
- package/dist/log.es-bundle-core-sizes.swagger-ui.txt +0 -14
- package/dist/log.es-bundle-sizes.swagger-ui.txt +0 -114
- package/dist/swagger-initializer.js +0 -20
- package/dist/swagger-ui-bundle.js.LICENSE.txt +0 -106
- package/dist/swagger-ui-bundle.js.map +0 -1
- package/dist/swagger-ui-es-bundle-core.js.LICENSE.txt +0 -35
- package/dist/swagger-ui-es-bundle.js.LICENSE.txt +0 -106
- package/dist/swagger-ui-es-bundle.js.map +0 -1
- package/dist/swagger-ui-standalone-preset.js.LICENSE.txt +0 -22
- package/dist/swagger-ui-standalone-preset.js.map +0 -1
- package/docker/configurator/helpers.js +0 -13
- package/docker/configurator/index.js +0 -52
- package/docker/configurator/oauth.js +0 -55
- package/docker/configurator/translator.js +0 -111
- package/docker/configurator/variables.js +0 -125
- package/docker/cors.conf +0 -14
- package/docker/default.conf.template +0 -43
- package/docker/docker-entrypoint.d/40-swagger-ui.sh +0 -52
- package/docker/embedding.conf +0 -5
- package/snapcraft.yaml +0 -28
- package/src/core/assets/rolling-load.svg +0 -1
- package/src/core/components/app.jsx +0 -30
- package/src/core/components/auth/api-key-auth.jsx +0 -93
- package/src/core/components/auth/auth-item.jsx +0 -60
- package/src/core/components/auth/authorization-popup.jsx +0 -59
- package/src/core/components/auth/authorize-btn.jsx +0 -30
- package/src/core/components/auth/authorize-operation-btn.jsx +0 -35
- package/src/core/components/auth/auths.jsx +0 -124
- package/src/core/components/auth/basic-auth.jsx +0 -110
- package/src/core/components/auth/error.jsx +0 -24
- package/src/core/components/auth/oauth2.jsx +0 -283
- package/src/core/components/clear.jsx +0 -25
- package/src/core/components/contact.jsx +0 -44
- package/src/core/components/content-type.jsx +0 -64
- package/src/core/components/copy-to-clipboard-btn.jsx +0 -29
- package/src/core/components/curl.jsx +0 -38
- package/src/core/components/debug.jsx +0 -50
- package/src/core/components/deep-link.jsx +0 -20
- package/src/core/components/errors.jsx +0 -132
- package/src/core/components/example.jsx +0 -43
- package/src/core/components/examples-select-value-retainer.jsx +0 -254
- package/src/core/components/examples-select.jsx +0 -139
- package/src/core/components/execute.jsx +0 -103
- package/src/core/components/footer.jsx +0 -9
- package/src/core/components/headers.jsx +0 -58
- package/src/core/components/info.jsx +0 -169
- package/src/core/components/initialized-input.jsx +0 -36
- package/src/core/components/jump-to-path.jsx +0 -9
- package/src/core/components/layout-utils.jsx +0 -265
- package/src/core/components/layouts/base.jsx +0 -156
- package/src/core/components/layouts/xpane.jsx +0 -73
- package/src/core/components/license.jsx +0 -40
- package/src/core/components/live-response.jsx +0 -133
- package/src/core/components/online-validator-badge.jsx +0 -120
- package/src/core/components/openapi-version.jsx +0 -15
- package/src/core/components/operation-extension-row.jsx +0 -17
- package/src/core/components/operation-extensions.jsx +0 -35
- package/src/core/components/operation-summary-method.jsx +0 -25
- package/src/core/components/operation-summary-path.jsx +0 -54
- package/src/core/components/operation-summary.jsx +0 -102
- package/src/core/components/operation-tag.jsx +0 -121
- package/src/core/components/operation.jsx +0 -259
- package/src/core/components/operations.jsx +0 -100
- package/src/core/components/overview.jsx +0 -119
- package/src/core/components/param-body.jsx +0 -156
- package/src/core/components/parameter-extension.jsx +0 -12
- package/src/core/components/parameter-include-empty.jsx +0 -59
- package/src/core/components/parameter-row.jsx +0 -438
- package/src/core/components/parameters/index.js +0 -1
- package/src/core/components/parameters/parameters.jsx +0 -287
- package/src/core/components/property.jsx +0 -17
- package/src/core/components/providers/README.md +0 -6
- package/src/core/components/providers/markdown.jsx +0 -72
- package/src/core/components/response-body.jsx +0 -170
- package/src/core/components/response-extension.jsx +0 -12
- package/src/core/components/response.jsx +0 -276
- package/src/core/components/responses.jsx +0 -170
- package/src/core/components/svg-assets.jsx +0 -48
- package/src/core/components/system-wrapper.jsx +0 -0
- package/src/core/components/try-it-out-button.jsx +0 -41
- package/src/core/components/version-pragma-filter.jsx +0 -54
- package/src/core/components/version-stamp.jsx +0 -12
- package/src/core/containers/OperationContainer.jsx +0 -267
- package/src/core/containers/authorize-btn.jsx +0 -31
- package/src/core/containers/filter.jsx +0 -44
- package/src/core/containers/info.jsx +0 -35
- package/src/core/index.js +0 -174
- package/src/core/oauth2-authorize.js +0 -137
- package/src/core/plugins/auth/actions.js +0 -286
- package/src/core/plugins/auth/components/lock-auth-icon.jsx +0 -27
- package/src/core/plugins/auth/components/unlock-auth-icon.jsx +0 -27
- package/src/core/plugins/auth/configs-extensions/wrap-actions.js +0 -19
- package/src/core/plugins/auth/index.js +0 -94
- package/src/core/plugins/auth/reducers.js +0 -77
- package/src/core/plugins/auth/selectors.js +0 -121
- package/src/core/plugins/auth/spec-extensions/wrap-actions.js +0 -10
- package/src/core/plugins/auth/wrap-actions.js +0 -66
- package/src/core/plugins/configs/actions.js +0 -58
- package/src/core/plugins/configs/fn.js +0 -12
- package/src/core/plugins/configs/index.js +0 -16
- package/src/core/plugins/configs/reducers.js +0 -20
- package/src/core/plugins/configs/selectors.js +0 -4
- package/src/core/plugins/deep-linking/README.md +0 -1
- package/src/core/plugins/deep-linking/helpers.js +0 -7
- package/src/core/plugins/deep-linking/index.js +0 -24
- package/src/core/plugins/deep-linking/layout.js +0 -209
- package/src/core/plugins/deep-linking/operation-tag-wrapper.jsx +0 -25
- package/src/core/plugins/deep-linking/operation-wrapper.jsx +0 -27
- package/src/core/plugins/download-url/index.js +0 -126
- package/src/core/plugins/err/actions.js +0 -60
- package/src/core/plugins/err/error-transformers/README.md +0 -31
- package/src/core/plugins/err/error-transformers/hook.js +0 -38
- package/src/core/plugins/err/error-transformers/transformers/not-of-type.js +0 -29
- package/src/core/plugins/err/error-transformers/transformers/parameter-oneof.js +0 -59
- package/src/core/plugins/err/index.js +0 -15
- package/src/core/plugins/err/reducers.js +0 -100
- package/src/core/plugins/err/selectors.js +0 -15
- package/src/core/plugins/filter/index.js +0 -9
- package/src/core/plugins/filter/opsFilter.js +0 -3
- package/src/core/plugins/icons/components/arrow-down.jsx +0 -28
- package/src/core/plugins/icons/components/arrow-up.jsx +0 -28
- package/src/core/plugins/icons/components/arrow.jsx +0 -28
- package/src/core/plugins/icons/components/close.jsx +0 -28
- package/src/core/plugins/icons/components/copy.jsx +0 -34
- package/src/core/plugins/icons/components/lock.jsx +0 -28
- package/src/core/plugins/icons/components/unlock.jsx +0 -28
- package/src/core/plugins/icons/index.js +0 -24
- package/src/core/plugins/json-schema-2020-12/components/Accordion/Accordion.jsx +0 -45
- package/src/core/plugins/json-schema-2020-12/components/Accordion/_accordion.scss +0 -33
- package/src/core/plugins/json-schema-2020-12/components/ExpandDeepButton/ExpandDeepButton.jsx +0 -31
- package/src/core/plugins/json-schema-2020-12/components/ExpandDeepButton/_expand-deep-button.scss +0 -10
- package/src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx +0 -227
- package/src/core/plugins/json-schema-2020-12/components/JSONSchema/_json-schema.scss +0 -34
- package/src/core/plugins/json-schema-2020-12/components/JSONViewer/JSONViewer.jsx +0 -153
- package/src/core/plugins/json-schema-2020-12/components/JSONViewer/_json-viewer.scss +0 -11
- package/src/core/plugins/json-schema-2020-12/components/_all.scss +0 -4
- package/src/core/plugins/json-schema-2020-12/components/_mixins.scss +0 -82
- package/src/core/plugins/json-schema-2020-12/components/icons/ChevronRight.jsx +0 -17
- package/src/core/plugins/json-schema-2020-12/components/keywords/$anchor.jsx +0 -27
- package/src/core/plugins/json-schema-2020-12/components/keywords/$comment.jsx +0 -27
- package/src/core/plugins/json-schema-2020-12/components/keywords/$defs.jsx +0 -93
- package/src/core/plugins/json-schema-2020-12/components/keywords/$dynamicAnchor.jsx +0 -27
- package/src/core/plugins/json-schema-2020-12/components/keywords/$dynamicRef.jsx +0 -27
- package/src/core/plugins/json-schema-2020-12/components/keywords/$id.jsx +0 -27
- package/src/core/plugins/json-schema-2020-12/components/keywords/$ref.jsx +0 -27
- package/src/core/plugins/json-schema-2020-12/components/keywords/$schema.jsx +0 -27
- package/src/core/plugins/json-schema-2020-12/components/keywords/$vocabulary/$vocabulary.jsx +0 -66
- package/src/core/plugins/json-schema-2020-12/components/keywords/$vocabulary/_$vocabulary.scss +0 -17
- package/src/core/plugins/json-schema-2020-12/components/keywords/AdditionalProperties.jsx +0 -55
- package/src/core/plugins/json-schema-2020-12/components/keywords/AllOf.jsx +0 -105
- package/src/core/plugins/json-schema-2020-12/components/keywords/AnyOf.jsx +0 -105
- package/src/core/plugins/json-schema-2020-12/components/keywords/Const/Const.jsx +0 -28
- package/src/core/plugins/json-schema-2020-12/components/keywords/Const/_const.scss +0 -11
- package/src/core/plugins/json-schema-2020-12/components/keywords/Constraint/Constraint.jsx +0 -38
- package/src/core/plugins/json-schema-2020-12/components/keywords/Constraint/_constraint.scss +0 -16
- package/src/core/plugins/json-schema-2020-12/components/keywords/Contains.jsx +0 -35
- package/src/core/plugins/json-schema-2020-12/components/keywords/ContentSchema.jsx +0 -39
- package/src/core/plugins/json-schema-2020-12/components/keywords/Default/Default.jsx +0 -28
- package/src/core/plugins/json-schema-2020-12/components/keywords/Default/_default.scss +0 -11
- package/src/core/plugins/json-schema-2020-12/components/keywords/DependentRequired/DependentRequired.jsx +0 -37
- package/src/core/plugins/json-schema-2020-12/components/keywords/DependentRequired/_dependent-required.scss +0 -12
- package/src/core/plugins/json-schema-2020-12/components/keywords/DependentSchemas.jsx +0 -97
- package/src/core/plugins/json-schema-2020-12/components/keywords/Deprecated.jsx +0 -22
- package/src/core/plugins/json-schema-2020-12/components/keywords/Description/Description.jsx +0 -24
- package/src/core/plugins/json-schema-2020-12/components/keywords/Description/_description.scss +0 -9
- package/src/core/plugins/json-schema-2020-12/components/keywords/Else.jsx +0 -35
- package/src/core/plugins/json-schema-2020-12/components/keywords/Enum/Enum.jsx +0 -27
- package/src/core/plugins/json-schema-2020-12/components/keywords/Enum/_enum.scss +0 -11
- package/src/core/plugins/json-schema-2020-12/components/keywords/Examples/Examples.jsx +0 -30
- package/src/core/plugins/json-schema-2020-12/components/keywords/Examples/_examples.scss +0 -11
- package/src/core/plugins/json-schema-2020-12/components/keywords/ExtensionKeywords/ExtensionKeywords.jsx +0 -103
- package/src/core/plugins/json-schema-2020-12/components/keywords/ExtensionKeywords/_extension-keywords.scss +0 -11
- package/src/core/plugins/json-schema-2020-12/components/keywords/If.jsx +0 -35
- package/src/core/plugins/json-schema-2020-12/components/keywords/Items.jsx +0 -35
- package/src/core/plugins/json-schema-2020-12/components/keywords/Not.jsx +0 -35
- package/src/core/plugins/json-schema-2020-12/components/keywords/OneOf.jsx +0 -105
- package/src/core/plugins/json-schema-2020-12/components/keywords/PatternProperties/PatternProperties.jsx +0 -41
- package/src/core/plugins/json-schema-2020-12/components/keywords/PatternProperties/_pattern-properties.scss +0 -21
- package/src/core/plugins/json-schema-2020-12/components/keywords/PrefixItems.jsx +0 -105
- package/src/core/plugins/json-schema-2020-12/components/keywords/Properties/Properties.jsx +0 -61
- package/src/core/plugins/json-schema-2020-12/components/keywords/Properties/_properties.scss +0 -24
- package/src/core/plugins/json-schema-2020-12/components/keywords/PropertyNames.jsx +0 -38
- package/src/core/plugins/json-schema-2020-12/components/keywords/ReadOnly.jsx +0 -22
- package/src/core/plugins/json-schema-2020-12/components/keywords/Then.jsx +0 -35
- package/src/core/plugins/json-schema-2020-12/components/keywords/Title/Title.jsx +0 -24
- package/src/core/plugins/json-schema-2020-12/components/keywords/Title/_title.scss +0 -26
- package/src/core/plugins/json-schema-2020-12/components/keywords/Type.jsx +0 -27
- package/src/core/plugins/json-schema-2020-12/components/keywords/UnevaluatedItems.jsx +0 -39
- package/src/core/plugins/json-schema-2020-12/components/keywords/UnevaluatedProperties.jsx +0 -39
- package/src/core/plugins/json-schema-2020-12/components/keywords/WriteOnly.jsx +0 -22
- package/src/core/plugins/json-schema-2020-12/components/keywords/_all.scss +0 -43
- package/src/core/plugins/json-schema-2020-12/context.js +0 -14
- package/src/core/plugins/json-schema-2020-12/enum.js +0 -10
- package/src/core/plugins/json-schema-2020-12/fn.js +0 -527
- package/src/core/plugins/json-schema-2020-12/hoc.jsx +0 -296
- package/src/core/plugins/json-schema-2020-12/hooks.js +0 -144
- package/src/core/plugins/json-schema-2020-12/index.js +0 -153
- package/src/core/plugins/json-schema-2020-12/prop-types.js +0 -10
- package/src/core/plugins/json-schema-2020-12-samples/fn/api/encoderAPI.js +0 -20
- package/src/core/plugins/json-schema-2020-12-samples/fn/api/formatAPI.js +0 -20
- package/src/core/plugins/json-schema-2020-12-samples/fn/api/mediaTypeAPI.js +0 -27
- package/src/core/plugins/json-schema-2020-12-samples/fn/api/optionAPI.js +0 -17
- package/src/core/plugins/json-schema-2020-12-samples/fn/class/EncoderRegistry.js +0 -33
- package/src/core/plugins/json-schema-2020-12-samples/fn/class/FormatRegistry.js +0 -65
- package/src/core/plugins/json-schema-2020-12-samples/fn/class/MediaTypeRegistry.js +0 -27
- package/src/core/plugins/json-schema-2020-12-samples/fn/class/OptionRegistry.js +0 -16
- package/src/core/plugins/json-schema-2020-12-samples/fn/class/Registry.js +0 -24
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/constants.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/example.js +0 -57
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/merge.js +0 -83
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/predicates.js +0 -16
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/random.js +0 -46
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/type.js +0 -156
- package/src/core/plugins/json-schema-2020-12-samples/fn/core/utils.js +0 -23
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/7bit.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/8bit.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/base16.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/base32.js +0 -34
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/base64.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/base64url.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/binary.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/encoders/quoted-printable.js +0 -38
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/date-time.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/date.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/double.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/duration.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/email.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/float.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/hostname.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/idn-email.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/idn-hostname.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/int32.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/int64.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/ipv4.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/ipv6.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/iri-reference.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/iri.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/json-pointer.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/media-types/application.js +0 -17
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/media-types/audio.js +0 -10
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/media-types/image.js +0 -10
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/media-types/text.js +0 -17
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/media-types/video.js +0 -10
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/password.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/regex.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/relative-json-pointer.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/time.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/uri-reference.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/uri-template.js +0 -7
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/uri.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/generators/uuid.js +0 -6
- package/src/core/plugins/json-schema-2020-12-samples/fn/get-json-sample-schema.js +0 -36
- package/src/core/plugins/json-schema-2020-12-samples/fn/get-sample-schema.js +0 -39
- package/src/core/plugins/json-schema-2020-12-samples/fn/get-xml-sample-schema.js +0 -35
- package/src/core/plugins/json-schema-2020-12-samples/fn/get-yaml-sample-schema.js +0 -34
- package/src/core/plugins/json-schema-2020-12-samples/fn/index.js +0 -16
- package/src/core/plugins/json-schema-2020-12-samples/fn/main.js +0 -562
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/array.js +0 -52
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/boolean.js +0 -9
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/index.js +0 -30
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/integer.js +0 -43
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/null.js +0 -9
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/number.js +0 -65
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/object.js +0 -9
- package/src/core/plugins/json-schema-2020-12-samples/fn/types/string.js +0 -80
- package/src/core/plugins/json-schema-2020-12-samples/index.js +0 -51
- package/src/core/plugins/json-schema-5/components/array-model.jsx +0 -80
- package/src/core/plugins/json-schema-5/components/enum-model.jsx +0 -19
- package/src/core/plugins/json-schema-5/components/json-schema-components.jsx +0 -441
- package/src/core/plugins/json-schema-5/components/model-collapse.jsx +0 -99
- package/src/core/plugins/json-schema-5/components/model-example.jsx +0 -160
- package/src/core/plugins/json-schema-5/components/model-extensions.jsx +0 -28
- package/src/core/plugins/json-schema-5/components/model-wrapper.jsx +0 -44
- package/src/core/plugins/json-schema-5/components/model.jsx +0 -136
- package/src/core/plugins/json-schema-5/components/models.jsx +0 -139
- package/src/core/plugins/json-schema-5/components/object-model.jsx +0 -340
- package/src/core/plugins/json-schema-5/components/primitive-model.jsx +0 -137
- package/src/core/plugins/json-schema-5/components/schemes.jsx +0 -53
- package/src/core/plugins/json-schema-5/containers/schemes.jsx +0 -30
- package/src/core/plugins/json-schema-5/fn.js +0 -51
- package/src/core/plugins/json-schema-5/index.js +0 -41
- package/src/core/plugins/json-schema-5-samples/fn/get-json-sample-schema.js +0 -32
- package/src/core/plugins/json-schema-5-samples/fn/get-sample-schema.js +0 -30
- package/src/core/plugins/json-schema-5-samples/fn/get-xml-sample-schema.js +0 -31
- package/src/core/plugins/json-schema-5-samples/fn/get-yaml-sample-schema.js +0 -34
- package/src/core/plugins/json-schema-5-samples/fn/index.js +0 -653
- package/src/core/plugins/json-schema-5-samples/index.js +0 -56
- package/src/core/plugins/layout/actions.js +0 -39
- package/src/core/plugins/layout/index.js +0 -19
- package/src/core/plugins/layout/reducers.js +0 -32
- package/src/core/plugins/layout/selectors.js +0 -24
- package/src/core/plugins/layout/spec-extensions/wrap-selector.js +0 -22
- package/src/core/plugins/logs/index.js +0 -28
- package/src/core/plugins/oas3/actions.js +0 -99
- package/src/core/plugins/oas3/auth-extensions/wrap-selectors.js +0 -92
- package/src/core/plugins/oas3/components/auth/http-auth.jsx +0 -157
- package/src/core/plugins/oas3/components/callbacks.jsx +0 -51
- package/src/core/plugins/oas3/components/index.js +0 -19
- package/src/core/plugins/oas3/components/operation-link.jsx +0 -43
- package/src/core/plugins/oas3/components/operation-servers.jsx +0 -102
- package/src/core/plugins/oas3/components/request-body-editor.jsx +0 -103
- package/src/core/plugins/oas3/components/request-body.jsx +0 -338
- package/src/core/plugins/oas3/components/servers-container.jsx +0 -33
- package/src/core/plugins/oas3/components/servers.jsx +0 -153
- package/src/core/plugins/oas3/fn.js +0 -35
- package/src/core/plugins/oas3/helpers.jsx +0 -48
- package/src/core/plugins/oas3/index.js +0 -39
- package/src/core/plugins/oas3/reducers.js +0 -111
- package/src/core/plugins/oas3/selectors.js +0 -308
- package/src/core/plugins/oas3/spec-extensions/selectors.js +0 -100
- package/src/core/plugins/oas3/spec-extensions/wrap-selectors.js +0 -71
- package/src/core/plugins/oas3/wrap-components/auth/auth-item.jsx +0 -25
- package/src/core/plugins/oas3/wrap-components/index.js +0 -15
- package/src/core/plugins/oas3/wrap-components/json-schema-string.jsx +0 -27
- package/src/core/plugins/oas3/wrap-components/markdown.jsx +0 -45
- package/src/core/plugins/oas3/wrap-components/model.jsx +0 -40
- package/src/core/plugins/oas3/wrap-components/online-validator-badge.js +0 -5
- package/src/core/plugins/oas3/wrap-components/openapi-version.jsx +0 -7
- package/src/core/plugins/oas31/after-load.js +0 -72
- package/src/core/plugins/oas31/auth-extensions/wrap-selectors.js +0 -28
- package/src/core/plugins/oas31/components/_all.scss +0 -2
- package/src/core/plugins/oas31/components/auth/auths.jsx +0 -186
- package/src/core/plugins/oas31/components/auth/mutual-tls-auth.jsx +0 -32
- package/src/core/plugins/oas31/components/contact.jsx +0 -43
- package/src/core/plugins/oas31/components/info.jsx +0 -99
- package/src/core/plugins/oas31/components/json-schema-dialect.jsx +0 -60
- package/src/core/plugins/oas31/components/license.jsx +0 -38
- package/src/core/plugins/oas31/components/model/_model.scss +0 -23
- package/src/core/plugins/oas31/components/model/model.jsx +0 -54
- package/src/core/plugins/oas31/components/models/_models.scss +0 -11
- package/src/core/plugins/oas31/components/models/models.jsx +0 -141
- package/src/core/plugins/oas31/components/version-pragma-filter.jsx +0 -73
- package/src/core/plugins/oas31/components/webhooks.jsx +0 -49
- package/src/core/plugins/oas31/fn.js +0 -124
- package/src/core/plugins/oas31/index.js +0 -166
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Description.jsx +0 -27
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Discriminator/Discriminator.jsx +0 -118
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Discriminator/DiscriminatorMapping.jsx +0 -32
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Example.jsx +0 -28
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/ExternalDocs.jsx +0 -143
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/OpenAPIExtensions.jsx +0 -33
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Properties.jsx +0 -60
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Xml.jsx +0 -162
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/fn.js +0 -57
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Description.jsx +0 -9
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Examples.jsx +0 -31
- package/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Properties.jsx +0 -9
- package/src/core/plugins/oas31/oas3-extensions/fn.js +0 -46
- package/src/core/plugins/oas31/selectors.js +0 -26
- package/src/core/plugins/oas31/spec-extensions/selectors.js +0 -198
- package/src/core/plugins/oas31/spec-extensions/wrap-selectors.js +0 -18
- package/src/core/plugins/oas31/wrap-components/auth/auth-item.jsx +0 -22
- package/src/core/plugins/oas31/wrap-components/auths.jsx +0 -17
- package/src/core/plugins/oas31/wrap-components/contact.jsx +0 -15
- package/src/core/plugins/oas31/wrap-components/info.jsx +0 -15
- package/src/core/plugins/oas31/wrap-components/license.jsx +0 -15
- package/src/core/plugins/oas31/wrap-components/model.jsx +0 -44
- package/src/core/plugins/oas31/wrap-components/models.jsx +0 -47
- package/src/core/plugins/oas31/wrap-components/version-pragma-filter.jsx +0 -16
- package/src/core/plugins/on-complete/index.js +0 -28
- package/src/core/plugins/request-snippets/fn.js +0 -169
- package/src/core/plugins/request-snippets/index.js +0 -21
- package/src/core/plugins/request-snippets/request-snippets.jsx +0 -163
- package/src/core/plugins/request-snippets/selectors.js +0 -45
- package/src/core/plugins/safe-render/components/error-boundary.jsx +0 -52
- package/src/core/plugins/safe-render/components/fallback.jsx +0 -13
- package/src/core/plugins/safe-render/fn.jsx +0 -32
- package/src/core/plugins/safe-render/index.js +0 -42
- package/src/core/plugins/spec/actions.js +0 -531
- package/src/core/plugins/spec/index.js +0 -20
- package/src/core/plugins/spec/reducers.js +0 -176
- package/src/core/plugins/spec/selectors.js +0 -575
- package/src/core/plugins/spec/wrap-actions.js +0 -39
- package/src/core/plugins/swagger-client/configs-wrap-actions.js +0 -6
- package/src/core/plugins/swagger-client/index.js +0 -54
- package/src/core/plugins/syntax-highlighting/after-load.js +0 -25
- package/src/core/plugins/syntax-highlighting/components/HighlightCode.jsx +0 -107
- package/src/core/plugins/syntax-highlighting/components/PlainTextViewer.jsx +0 -17
- package/src/core/plugins/syntax-highlighting/components/SyntaxHighlighter.jsx +0 -42
- package/src/core/plugins/syntax-highlighting/index.js +0 -34
- package/src/core/plugins/syntax-highlighting/root-injects.js +0 -22
- package/src/core/plugins/syntax-highlighting/wrap-components/SyntaxHighlighter.jsx +0 -31
- package/src/core/plugins/util/index.js +0 -11
- package/src/core/plugins/versions/after-load.js +0 -19
- package/src/core/plugins/versions/index.js +0 -10
- package/src/core/plugins/view/fn.js +0 -1
- package/src/core/plugins/view/index.js +0 -34
- package/src/core/plugins/view/root-injects.jsx +0 -118
- package/src/core/plugins/view-legacy/index.js +0 -25
- package/src/core/plugins/view-legacy/root-injects.jsx +0 -12
- package/src/core/presets/apis/index.js +0 -18
- package/src/core/presets/base/index.js +0 -55
- package/src/core/presets/base/plugins/core-components/index.js +0 -130
- package/src/core/presets/base/plugins/form-components/index.js +0 -10
- package/src/core/system.js +0 -511
- package/src/core/utils/create-html-ready-id.js +0 -10
- package/src/core/utils/get-parameter-schema.js +0 -94
- package/src/core/utils/index.js +0 -847
- package/src/core/utils/jsonParse.js +0 -15
- package/src/core/utils/memoizeN.js +0 -48
- package/src/core/utils/url.js +0 -79
- package/src/core/window.js +0 -30
- package/src/index.js +0 -3
- package/src/standalone/plugins/stadalone-layout/components/StandaloneLayout.jsx +0 -40
- package/src/standalone/plugins/stadalone-layout/index.js +0 -12
- package/src/standalone/plugins/top-bar/assets/lightbulb-off.svg +0 -1
- package/src/standalone/plugins/top-bar/assets/lightbulb.svg +0 -1
- package/src/standalone/plugins/top-bar/assets/logo_small.svg +0 -60
- package/src/standalone/plugins/top-bar/components/DarkModeToggle.jsx +0 -47
- package/src/standalone/plugins/top-bar/components/Logo.jsx +0 -9
- package/src/standalone/plugins/top-bar/components/TopBar.jsx +0 -183
- package/src/standalone/plugins/top-bar/index.js +0 -12
- package/src/standalone/presets/standalone/index.js +0 -19
- package/src/style/_authorize.scss +0 -96
- package/src/style/_buttons.scss +0 -199
- package/src/style/_dark-mode.scss +0 -664
- package/src/style/_errors.scss +0 -72
- package/src/style/_form.scss +0 -214
- package/src/style/_information.scss +0 -99
- package/src/style/_layout.scss +0 -941
- package/src/style/_markdown.scss +0 -34
- package/src/style/_mixins.scss +0 -159
- package/src/style/_modal.scss +0 -95
- package/src/style/_models.scss +0 -330
- package/src/style/_servers.scss +0 -66
- package/src/style/_split-pane-mode.scss +0 -3
- package/src/style/_table.scss +0 -191
- package/src/style/_topbar.scss +0 -126
- package/src/style/_type.scss +0 -21
- package/src/style/_variables.scss +0 -230
- package/src/style/main.scss +0 -28
- package/stylelint.config.js +0 -11
- package/swagger-ui-dist-package/absolute-path.js +0 -14
- package/swagger-ui-dist-package/index.js +0 -17
- package/swagger-ui-dist-package/package.json +0 -20
|
@@ -1,653 +0,0 @@
|
|
|
1
|
-
import XML from "xml"
|
|
2
|
-
import RandExp from "randexp"
|
|
3
|
-
import isEmpty from "lodash/isEmpty"
|
|
4
|
-
import { deeplyStripKey, isFunc, normalizeArray, objectify, immutableToJS } from "core/utils"
|
|
5
|
-
import memoizeN from "core/utils/memoizeN"
|
|
6
|
-
|
|
7
|
-
const generateStringFromRegex = (pattern) => {
|
|
8
|
-
try {
|
|
9
|
-
/**
|
|
10
|
-
* Applying maximum value (100) to numbers from regex patterns to avoid ReDoS:
|
|
11
|
-
* 1. {x}
|
|
12
|
-
* 2. {x,}
|
|
13
|
-
* 3. {,y}
|
|
14
|
-
* 4. {x,y}
|
|
15
|
-
*/
|
|
16
|
-
const patternSanitizer =
|
|
17
|
-
/(?<=(?<!\\)\{)(\d{3,})(?=\})|(?<=(?<!\\)\{\d*,)(\d{3,})(?=\})|(?<=(?<!\\)\{)(\d{3,})(?=,\d*\})/g
|
|
18
|
-
const safePattern = pattern.replace(patternSanitizer, "100")
|
|
19
|
-
const randexpInstance = new RandExp(safePattern)
|
|
20
|
-
randexpInstance.max = 100
|
|
21
|
-
return randexpInstance.gen()
|
|
22
|
-
} catch (e) {
|
|
23
|
-
// Invalid regex should not cause a crash (regex syntax varies across languages)
|
|
24
|
-
return "string"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const primitives = {
|
|
29
|
-
"string": (schema) => schema.pattern ? generateStringFromRegex(schema.pattern) : "string",
|
|
30
|
-
"string_email": () => "user@example.com",
|
|
31
|
-
"string_date-time": () => new Date().toISOString(),
|
|
32
|
-
"string_date": () => new Date().toISOString().substring(0, 10),
|
|
33
|
-
"string_time": () => new Date().toISOString().substring(11),
|
|
34
|
-
"string_uuid": () => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
|
35
|
-
"string_hostname": () => "example.com",
|
|
36
|
-
"string_ipv4": () => "198.51.100.42",
|
|
37
|
-
"string_ipv6": () => "2001:0db8:5b96:0000:0000:426f:8e17:642a",
|
|
38
|
-
"number": () => 0,
|
|
39
|
-
"number_float": () => 0.0,
|
|
40
|
-
"integer": () => 0,
|
|
41
|
-
"boolean": (schema) => typeof schema.default === "boolean" ? schema.default : true
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const primitive = (schema) => {
|
|
45
|
-
schema = objectify(schema)
|
|
46
|
-
let { type, format } = schema
|
|
47
|
-
|
|
48
|
-
let fn = primitives[`${type}_${format}`] || primitives[type]
|
|
49
|
-
|
|
50
|
-
if(isFunc(fn))
|
|
51
|
-
return fn(schema)
|
|
52
|
-
|
|
53
|
-
return "Unknown Type: " + schema.type
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// do a couple of quick sanity tests to ensure the value
|
|
57
|
-
// looks like a $$ref that swagger-client generates.
|
|
58
|
-
const sanitizeRef = (value) => deeplyStripKey(value, "$$ref", (val) =>
|
|
59
|
-
typeof val === "string" && val.indexOf("#") > -1)
|
|
60
|
-
|
|
61
|
-
const objectContracts = ["maxProperties", "minProperties"]
|
|
62
|
-
const arrayContracts = ["minItems", "maxItems"]
|
|
63
|
-
const numberContracts = [
|
|
64
|
-
"minimum",
|
|
65
|
-
"maximum",
|
|
66
|
-
"exclusiveMinimum",
|
|
67
|
-
"exclusiveMaximum"
|
|
68
|
-
]
|
|
69
|
-
const stringContracts = ["minLength", "maxLength"]
|
|
70
|
-
|
|
71
|
-
export const mergeJsonSchema = (target, source, config = {}) => {
|
|
72
|
-
const merged = { ...target }
|
|
73
|
-
|
|
74
|
-
const setIfNotDefinedInTarget = (key) => {
|
|
75
|
-
if(merged[key] === undefined && source[key] !== undefined) {
|
|
76
|
-
merged[key] = source[key]
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
[
|
|
81
|
-
"example",
|
|
82
|
-
"default",
|
|
83
|
-
"enum",
|
|
84
|
-
"xml",
|
|
85
|
-
"type",
|
|
86
|
-
...objectContracts,
|
|
87
|
-
...arrayContracts,
|
|
88
|
-
...numberContracts,
|
|
89
|
-
...stringContracts,
|
|
90
|
-
].forEach(key => setIfNotDefinedInTarget(key))
|
|
91
|
-
|
|
92
|
-
if(source.required !== undefined && Array.isArray(source.required)) {
|
|
93
|
-
if(merged.required === undefined || !merged.required.length) {
|
|
94
|
-
merged.required = []
|
|
95
|
-
}
|
|
96
|
-
source.required.forEach(key => {
|
|
97
|
-
if(merged.required.includes(key)) {
|
|
98
|
-
return
|
|
99
|
-
}
|
|
100
|
-
merged.required.push(key)
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
if(source.properties) {
|
|
104
|
-
if(!merged.properties) {
|
|
105
|
-
merged.properties = {}
|
|
106
|
-
}
|
|
107
|
-
let props = objectify(source.properties)
|
|
108
|
-
for (let propName in props) {
|
|
109
|
-
if (!Object.prototype.hasOwnProperty.call(props, propName)) {
|
|
110
|
-
continue
|
|
111
|
-
}
|
|
112
|
-
if ( props[propName] && props[propName].deprecated ) {
|
|
113
|
-
continue
|
|
114
|
-
}
|
|
115
|
-
if ( props[propName] && props[propName].readOnly && !config.includeReadOnly ) {
|
|
116
|
-
continue
|
|
117
|
-
}
|
|
118
|
-
if ( props[propName] && props[propName].writeOnly && !config.includeWriteOnly ) {
|
|
119
|
-
continue
|
|
120
|
-
}
|
|
121
|
-
if(!merged.properties[propName]) {
|
|
122
|
-
merged.properties[propName] = props[propName]
|
|
123
|
-
if(!source.required && Array.isArray(source.required) && source.required.indexOf(propName) !== -1) {
|
|
124
|
-
if(!merged.required) {
|
|
125
|
-
merged.required = [propName]
|
|
126
|
-
} else {
|
|
127
|
-
merged.required.push(propName)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
if(source.items) {
|
|
134
|
-
if(!merged.items) {
|
|
135
|
-
merged.items = {}
|
|
136
|
-
}
|
|
137
|
-
merged.items = mergeJsonSchema(merged.items, source.items, config)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return merged
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export const sampleFromSchemaGeneric = (schema, config={}, exampleOverride = undefined, respectXML = false) => {
|
|
144
|
-
if(schema && isFunc(schema.toJS))
|
|
145
|
-
schema = schema.toJS()
|
|
146
|
-
let usePlainValue = exampleOverride !== undefined || schema && schema.example !== undefined || schema && schema.default !== undefined
|
|
147
|
-
// first check if there is the need of combining this schema with others required by allOf
|
|
148
|
-
const hasOneOf = !usePlainValue && schema && schema.oneOf && schema.oneOf.length > 0
|
|
149
|
-
const hasAnyOf = !usePlainValue && schema && schema.anyOf && schema.anyOf.length > 0
|
|
150
|
-
if(!usePlainValue && (hasOneOf || hasAnyOf)) {
|
|
151
|
-
const schemaToAdd = objectify(hasOneOf
|
|
152
|
-
? schema.oneOf[0]
|
|
153
|
-
: schema.anyOf[0]
|
|
154
|
-
)
|
|
155
|
-
schema = mergeJsonSchema(schema, schemaToAdd, config)
|
|
156
|
-
if(!schema.xml && schemaToAdd.xml) {
|
|
157
|
-
schema.xml = schemaToAdd.xml
|
|
158
|
-
}
|
|
159
|
-
if(schema.example !== undefined && schemaToAdd.example !== undefined) {
|
|
160
|
-
usePlainValue = true
|
|
161
|
-
} else if(schemaToAdd.properties) {
|
|
162
|
-
if(!schema.properties) {
|
|
163
|
-
schema.properties = {}
|
|
164
|
-
}
|
|
165
|
-
let props = objectify(schemaToAdd.properties)
|
|
166
|
-
for (let propName in props) {
|
|
167
|
-
if (!Object.prototype.hasOwnProperty.call(props, propName)) {
|
|
168
|
-
continue
|
|
169
|
-
}
|
|
170
|
-
if ( props[propName] && props[propName].deprecated ) {
|
|
171
|
-
continue
|
|
172
|
-
}
|
|
173
|
-
if ( props[propName] && props[propName].readOnly && !config.includeReadOnly ) {
|
|
174
|
-
continue
|
|
175
|
-
}
|
|
176
|
-
if ( props[propName] && props[propName].writeOnly && !config.includeWriteOnly ) {
|
|
177
|
-
continue
|
|
178
|
-
}
|
|
179
|
-
if(!schema.properties[propName]) {
|
|
180
|
-
schema.properties[propName] = props[propName]
|
|
181
|
-
if(!schemaToAdd.required && Array.isArray(schemaToAdd.required) && schemaToAdd.required.indexOf(propName) !== -1) {
|
|
182
|
-
if(!schema.required) {
|
|
183
|
-
schema.required = [propName]
|
|
184
|
-
} else {
|
|
185
|
-
schema.required.push(propName)
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
const _attr = {}
|
|
193
|
-
let { xml, type, example, properties, additionalProperties, items } = schema || {}
|
|
194
|
-
let { includeReadOnly, includeWriteOnly } = config
|
|
195
|
-
xml = xml || {}
|
|
196
|
-
let { name, prefix, namespace } = xml
|
|
197
|
-
let displayName
|
|
198
|
-
let res = {}
|
|
199
|
-
|
|
200
|
-
// set xml naming and attributes
|
|
201
|
-
if(respectXML) {
|
|
202
|
-
name = name || "notagname"
|
|
203
|
-
// add prefix to name if exists
|
|
204
|
-
displayName = (prefix ? prefix + ":" : "") + name
|
|
205
|
-
if ( namespace ) {
|
|
206
|
-
//add prefix to namespace if exists
|
|
207
|
-
let namespacePrefix = prefix ? ( "xmlns:" + prefix ) : "xmlns"
|
|
208
|
-
_attr[namespacePrefix] = namespace
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// init xml default response sample obj
|
|
213
|
-
if(respectXML) {
|
|
214
|
-
res[displayName] = []
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const schemaHasAny = (keys) => keys.some(key => Object.prototype.hasOwnProperty.call(schema, key))
|
|
218
|
-
// try recover missing type
|
|
219
|
-
if(schema && !type) {
|
|
220
|
-
if(properties || additionalProperties || schemaHasAny(objectContracts)) {
|
|
221
|
-
type = "object"
|
|
222
|
-
} else if(items || schemaHasAny(arrayContracts)) {
|
|
223
|
-
type = "array"
|
|
224
|
-
} else if(schemaHasAny(numberContracts)) {
|
|
225
|
-
type = "number"
|
|
226
|
-
schema.type = "number"
|
|
227
|
-
} else if(!usePlainValue && !schema.enum){
|
|
228
|
-
// implicit cover schemaHasAny(stringContracts) or A schema without a type matches any data type is:
|
|
229
|
-
// components:
|
|
230
|
-
// schemas:
|
|
231
|
-
// AnyValue:
|
|
232
|
-
// anyOf:
|
|
233
|
-
// - type: string
|
|
234
|
-
// - type: number
|
|
235
|
-
// - type: integer
|
|
236
|
-
// - type: boolean
|
|
237
|
-
// - type: array
|
|
238
|
-
// items: {}
|
|
239
|
-
// - type: object
|
|
240
|
-
//
|
|
241
|
-
// which would resolve to type: string
|
|
242
|
-
type = "string"
|
|
243
|
-
schema.type = "string"
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const handleMinMaxItems = (sampleArray) => {
|
|
248
|
-
if (schema?.maxItems !== null && schema?.maxItems !== undefined) {
|
|
249
|
-
sampleArray = sampleArray.slice(0, schema?.maxItems)
|
|
250
|
-
}
|
|
251
|
-
if (schema?.minItems !== null && schema?.minItems !== undefined) {
|
|
252
|
-
let i = 0
|
|
253
|
-
while (sampleArray.length < schema?.minItems) {
|
|
254
|
-
sampleArray.push(sampleArray[i++ % sampleArray.length])
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return sampleArray
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// add to result helper init for xml or json
|
|
261
|
-
const props = objectify(properties)
|
|
262
|
-
let addPropertyToResult
|
|
263
|
-
let propertyAddedCounter = 0
|
|
264
|
-
|
|
265
|
-
const hasExceededMaxProperties = () => schema
|
|
266
|
-
&& schema.maxProperties !== null && schema.maxProperties !== undefined
|
|
267
|
-
&& propertyAddedCounter >= schema.maxProperties
|
|
268
|
-
|
|
269
|
-
const requiredPropertiesToAdd = () => {
|
|
270
|
-
if(!schema || !schema.required) {
|
|
271
|
-
return 0
|
|
272
|
-
}
|
|
273
|
-
let addedCount = 0
|
|
274
|
-
if(respectXML) {
|
|
275
|
-
schema.required.forEach(key => addedCount +=
|
|
276
|
-
res[key] === undefined
|
|
277
|
-
? 0
|
|
278
|
-
: 1
|
|
279
|
-
)
|
|
280
|
-
} else {
|
|
281
|
-
schema.required.forEach(key => addedCount +=
|
|
282
|
-
res[displayName]?.find(x => x[key] !== undefined) === undefined
|
|
283
|
-
? 0
|
|
284
|
-
: 1
|
|
285
|
-
)
|
|
286
|
-
}
|
|
287
|
-
return schema.required.length - addedCount
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const isOptionalProperty = (propName) => {
|
|
291
|
-
if(!schema || !schema.required || !schema.required.length) {
|
|
292
|
-
return true
|
|
293
|
-
}
|
|
294
|
-
return !schema.required.includes(propName)
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const canAddProperty = (propName) => {
|
|
298
|
-
if(!schema || schema.maxProperties === null || schema.maxProperties === undefined) {
|
|
299
|
-
return true
|
|
300
|
-
}
|
|
301
|
-
if(hasExceededMaxProperties()) {
|
|
302
|
-
return false
|
|
303
|
-
}
|
|
304
|
-
if(!isOptionalProperty(propName)) {
|
|
305
|
-
return true
|
|
306
|
-
}
|
|
307
|
-
return (schema.maxProperties - propertyAddedCounter - requiredPropertiesToAdd()) > 0
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
if(respectXML) {
|
|
311
|
-
addPropertyToResult = (propName, overrideE = undefined) => {
|
|
312
|
-
if(schema && props[propName]) {
|
|
313
|
-
// case it is an xml attribute
|
|
314
|
-
props[propName].xml = props[propName].xml || {}
|
|
315
|
-
|
|
316
|
-
if (props[propName].xml.attribute) {
|
|
317
|
-
const enumAttrVal = Array.isArray(props[propName].enum)
|
|
318
|
-
? props[propName].enum[0]
|
|
319
|
-
: undefined
|
|
320
|
-
const attrExample = props[propName].example
|
|
321
|
-
const attrDefault = props[propName].default
|
|
322
|
-
|
|
323
|
-
if(attrExample !== undefined) {
|
|
324
|
-
_attr[props[propName].xml.name || propName] = attrExample
|
|
325
|
-
} else if(attrDefault !== undefined) {
|
|
326
|
-
_attr[props[propName].xml.name || propName] = attrDefault
|
|
327
|
-
} else if(enumAttrVal !== undefined) {
|
|
328
|
-
_attr[props[propName].xml.name || propName] = enumAttrVal
|
|
329
|
-
} else {
|
|
330
|
-
_attr[props[propName].xml.name || propName] = primitive(props[propName])
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
return
|
|
334
|
-
}
|
|
335
|
-
props[propName].xml.name = props[propName].xml.name || propName
|
|
336
|
-
} else if(!props[propName] && additionalProperties !== false) {
|
|
337
|
-
// case only additionalProperty that is not defined in schema
|
|
338
|
-
props[propName] = {
|
|
339
|
-
xml: {
|
|
340
|
-
name: propName
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
let t = sampleFromSchemaGeneric(schema && props[propName] || undefined, config, overrideE, respectXML)
|
|
346
|
-
if(!canAddProperty(propName)) {
|
|
347
|
-
return
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
propertyAddedCounter++
|
|
351
|
-
if (Array.isArray(t)) {
|
|
352
|
-
res[displayName] = res[displayName].concat(t)
|
|
353
|
-
} else {
|
|
354
|
-
res[displayName].push(t)
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
} else {
|
|
358
|
-
addPropertyToResult = (propName, overrideE) => {
|
|
359
|
-
if(!canAddProperty(propName)) {
|
|
360
|
-
return
|
|
361
|
-
}
|
|
362
|
-
if(Object.prototype.hasOwnProperty.call(schema, "discriminator") &&
|
|
363
|
-
schema.discriminator &&
|
|
364
|
-
Object.prototype.hasOwnProperty.call(schema.discriminator, "mapping") &&
|
|
365
|
-
schema.discriminator.mapping &&
|
|
366
|
-
Object.prototype.hasOwnProperty.call(schema, "$$ref") &&
|
|
367
|
-
schema.$$ref &&
|
|
368
|
-
schema.discriminator.propertyName === propName) {
|
|
369
|
-
for (let pair in schema.discriminator.mapping){
|
|
370
|
-
if (schema.$$ref.search(schema.discriminator.mapping[pair]) !== -1) {
|
|
371
|
-
res[propName] = pair
|
|
372
|
-
break
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
} else {
|
|
376
|
-
res[propName] = sampleFromSchemaGeneric(props[propName], config, overrideE, respectXML)
|
|
377
|
-
}
|
|
378
|
-
propertyAddedCounter++
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
// check for plain value and if found use it to generate sample from it
|
|
383
|
-
if(usePlainValue) {
|
|
384
|
-
let sample
|
|
385
|
-
if(exampleOverride !== undefined) {
|
|
386
|
-
sample = sanitizeRef(exampleOverride)
|
|
387
|
-
} else if(example !== undefined) {
|
|
388
|
-
sample = sanitizeRef(example)
|
|
389
|
-
} else {
|
|
390
|
-
sample = sanitizeRef(schema.default)
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
// if json just return
|
|
394
|
-
if(!respectXML) {
|
|
395
|
-
// special case yaml parser can not know about
|
|
396
|
-
if(typeof sample === "number" && type === "string") {
|
|
397
|
-
return `${sample}`
|
|
398
|
-
}
|
|
399
|
-
// return if sample does not need any parsing
|
|
400
|
-
if(typeof sample !== "string" || type === "string") {
|
|
401
|
-
return sample
|
|
402
|
-
}
|
|
403
|
-
// check if sample is parsable or just a plain string
|
|
404
|
-
try {
|
|
405
|
-
return JSON.parse(sample)
|
|
406
|
-
} catch(e) {
|
|
407
|
-
// sample is just plain string return it
|
|
408
|
-
return sample
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// recover missing type
|
|
413
|
-
if(!schema) {
|
|
414
|
-
type = Array.isArray(sample) ? "array" : typeof sample
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// generate xml sample recursively for array case
|
|
418
|
-
if(type === "array") {
|
|
419
|
-
if (!Array.isArray(sample)) {
|
|
420
|
-
if(typeof sample === "string") {
|
|
421
|
-
return sample
|
|
422
|
-
}
|
|
423
|
-
sample = [sample]
|
|
424
|
-
}
|
|
425
|
-
const itemSchema = schema
|
|
426
|
-
? schema.items
|
|
427
|
-
: undefined
|
|
428
|
-
if(itemSchema) {
|
|
429
|
-
itemSchema.xml = itemSchema.xml || xml || {}
|
|
430
|
-
itemSchema.xml.name = itemSchema.xml.name || xml.name
|
|
431
|
-
}
|
|
432
|
-
let itemSamples = sample
|
|
433
|
-
.map(s => sampleFromSchemaGeneric(itemSchema, config, s, respectXML))
|
|
434
|
-
itemSamples = handleMinMaxItems(itemSamples)
|
|
435
|
-
if(xml.wrapped) {
|
|
436
|
-
res[displayName] = itemSamples
|
|
437
|
-
if (!isEmpty(_attr)) {
|
|
438
|
-
res[displayName].push({_attr: _attr})
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
else {
|
|
442
|
-
res = itemSamples
|
|
443
|
-
}
|
|
444
|
-
return res
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
// generate xml sample recursively for object case
|
|
448
|
-
if(type === "object") {
|
|
449
|
-
// case literal example
|
|
450
|
-
if(typeof sample === "string") {
|
|
451
|
-
return sample
|
|
452
|
-
}
|
|
453
|
-
for (let propName in sample) {
|
|
454
|
-
if (!Object.prototype.hasOwnProperty.call(sample, propName)) {
|
|
455
|
-
continue
|
|
456
|
-
}
|
|
457
|
-
if (schema && props[propName] && props[propName].readOnly && !includeReadOnly) {
|
|
458
|
-
continue
|
|
459
|
-
}
|
|
460
|
-
if (schema && props[propName] && props[propName].writeOnly && !includeWriteOnly) {
|
|
461
|
-
continue
|
|
462
|
-
}
|
|
463
|
-
if (schema && props[propName] && props[propName].xml && props[propName].xml.attribute) {
|
|
464
|
-
_attr[props[propName].xml.name || propName] = sample[propName]
|
|
465
|
-
continue
|
|
466
|
-
}
|
|
467
|
-
addPropertyToResult(propName, sample[propName])
|
|
468
|
-
}
|
|
469
|
-
if (!isEmpty(_attr)) {
|
|
470
|
-
res[displayName].push({_attr: _attr})
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
return res
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
res[displayName] = !isEmpty(_attr) ? [{_attr: _attr}, sample] : sample
|
|
477
|
-
return res
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// use schema to generate sample
|
|
481
|
-
|
|
482
|
-
if(type === "object") {
|
|
483
|
-
for (let propName in props) {
|
|
484
|
-
if (!Object.prototype.hasOwnProperty.call(props, propName)) {
|
|
485
|
-
continue
|
|
486
|
-
}
|
|
487
|
-
if ( props[propName] && props[propName].deprecated ) {
|
|
488
|
-
continue
|
|
489
|
-
}
|
|
490
|
-
if ( props[propName] && props[propName].readOnly && !includeReadOnly ) {
|
|
491
|
-
continue
|
|
492
|
-
}
|
|
493
|
-
if ( props[propName] && props[propName].writeOnly && !includeWriteOnly ) {
|
|
494
|
-
continue
|
|
495
|
-
}
|
|
496
|
-
addPropertyToResult(propName)
|
|
497
|
-
}
|
|
498
|
-
if (respectXML && _attr) {
|
|
499
|
-
res[displayName].push({_attr: _attr})
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
if(hasExceededMaxProperties()) {
|
|
503
|
-
return res
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
if ( additionalProperties === true ) {
|
|
507
|
-
if(respectXML) {
|
|
508
|
-
res[displayName].push({additionalProp: "Anything can be here"})
|
|
509
|
-
} else {
|
|
510
|
-
res.additionalProp1 = {}
|
|
511
|
-
}
|
|
512
|
-
propertyAddedCounter++
|
|
513
|
-
} else if ( additionalProperties ) {
|
|
514
|
-
const additionalProps = objectify(additionalProperties)
|
|
515
|
-
const additionalPropSample = sampleFromSchemaGeneric(additionalProps, config, undefined, respectXML)
|
|
516
|
-
|
|
517
|
-
if(respectXML && additionalProps.xml && additionalProps.xml.name && additionalProps.xml.name !== "notagname")
|
|
518
|
-
{
|
|
519
|
-
res[displayName].push(additionalPropSample)
|
|
520
|
-
} else {
|
|
521
|
-
const keyName = additionalProps["x-additionalPropertiesName"] || "additionalProp"
|
|
522
|
-
const toGenerateCount = schema.minProperties !== null && schema.minProperties !== undefined && propertyAddedCounter < schema.minProperties
|
|
523
|
-
? schema.minProperties - propertyAddedCounter
|
|
524
|
-
: 3
|
|
525
|
-
for (let i = 1; i <= toGenerateCount; i++) {
|
|
526
|
-
if(hasExceededMaxProperties()) {
|
|
527
|
-
return res
|
|
528
|
-
}
|
|
529
|
-
if(respectXML) {
|
|
530
|
-
const temp = {}
|
|
531
|
-
temp[keyName + i] = additionalPropSample["notagname"]
|
|
532
|
-
res[displayName].push(temp)
|
|
533
|
-
} else {
|
|
534
|
-
res[keyName + i] = additionalPropSample
|
|
535
|
-
}
|
|
536
|
-
propertyAddedCounter++
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
return res
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
if(type === "array") {
|
|
544
|
-
if (!items) {
|
|
545
|
-
return
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
let sampleArray
|
|
549
|
-
if(respectXML) {
|
|
550
|
-
items.xml = items.xml || schema?.xml || {}
|
|
551
|
-
items.xml.name = items.xml.name || xml.name
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
if(Array.isArray(items.anyOf)) {
|
|
555
|
-
sampleArray = items.anyOf.map(i => sampleFromSchemaGeneric(mergeJsonSchema(i, items, config), config, undefined, respectXML))
|
|
556
|
-
} else if(Array.isArray(items.oneOf)) {
|
|
557
|
-
sampleArray = items.oneOf.map(i => sampleFromSchemaGeneric(mergeJsonSchema(i, items, config), config, undefined, respectXML))
|
|
558
|
-
} else if(!respectXML || respectXML && xml.wrapped) {
|
|
559
|
-
sampleArray = [sampleFromSchemaGeneric(items, config, undefined, respectXML)]
|
|
560
|
-
} else {
|
|
561
|
-
return sampleFromSchemaGeneric(items, config, undefined, respectXML)
|
|
562
|
-
}
|
|
563
|
-
sampleArray = handleMinMaxItems(sampleArray)
|
|
564
|
-
if(respectXML && xml.wrapped) {
|
|
565
|
-
res[displayName] = sampleArray
|
|
566
|
-
if (!isEmpty(_attr)) {
|
|
567
|
-
res[displayName].push({_attr: _attr})
|
|
568
|
-
}
|
|
569
|
-
return res
|
|
570
|
-
}
|
|
571
|
-
return sampleArray
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
let value
|
|
575
|
-
if (schema && Array.isArray(schema.enum)) {
|
|
576
|
-
//display enum first value
|
|
577
|
-
value = normalizeArray(schema.enum)[0]
|
|
578
|
-
} else if(schema) {
|
|
579
|
-
// display schema default
|
|
580
|
-
value = primitive(schema)
|
|
581
|
-
if(typeof value === "number") {
|
|
582
|
-
let min = schema.minimum
|
|
583
|
-
if(min !== undefined && min !== null) {
|
|
584
|
-
if(schema.exclusiveMinimum) {
|
|
585
|
-
min++
|
|
586
|
-
}
|
|
587
|
-
value = min
|
|
588
|
-
}
|
|
589
|
-
let max = schema.maximum
|
|
590
|
-
if(max !== undefined && max !== null) {
|
|
591
|
-
if(schema.exclusiveMaximum) {
|
|
592
|
-
max--
|
|
593
|
-
}
|
|
594
|
-
value = max
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
if(typeof value === "string") {
|
|
598
|
-
if (schema.maxLength !== null && schema.maxLength !== undefined) {
|
|
599
|
-
value = value.slice(0, schema.maxLength)
|
|
600
|
-
}
|
|
601
|
-
if (schema.minLength !== null && schema.minLength !== undefined) {
|
|
602
|
-
let i = 0
|
|
603
|
-
while (value.length < schema.minLength) {
|
|
604
|
-
value += value[i++ % value.length]
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
} else {
|
|
609
|
-
return
|
|
610
|
-
}
|
|
611
|
-
if (type === "file") {
|
|
612
|
-
return
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
if(respectXML) {
|
|
616
|
-
res[displayName] = !isEmpty(_attr) ? [{_attr: _attr}, value] : value
|
|
617
|
-
return res
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
return value
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
export const inferSchema = (thing) => {
|
|
624
|
-
if(thing.schema)
|
|
625
|
-
thing = thing.schema
|
|
626
|
-
|
|
627
|
-
if(thing.properties) {
|
|
628
|
-
thing.type = "object"
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
return thing // Hopefully this will have something schema like in it... `type` for example
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
export const createXMLExample = (schema, config, o) => {
|
|
635
|
-
const json = sampleFromSchemaGeneric(schema, config, o, true)
|
|
636
|
-
if (!json) { return }
|
|
637
|
-
if(typeof json === "string") {
|
|
638
|
-
return json
|
|
639
|
-
}
|
|
640
|
-
return XML(json, { declaration: true, indent: "\t" })
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
export const sampleFromSchema = (schema, config, o) =>
|
|
645
|
-
sampleFromSchemaGeneric(schema, config, o, false)
|
|
646
|
-
|
|
647
|
-
const resolver = (arg1, arg2, arg3) => [arg1, JSON.stringify(arg2), JSON.stringify(arg3)]
|
|
648
|
-
|
|
649
|
-
export const memoizedCreateXMLExample = memoizeN(createXMLExample, resolver)
|
|
650
|
-
|
|
651
|
-
export const memoizedSampleFromSchema = memoizeN(sampleFromSchema, resolver)
|
|
652
|
-
|
|
653
|
-
export const getSchemaObjectType = (schema) => immutableToJS(schema)?.type ?? "string"
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @prettier
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
sampleFromSchema,
|
|
6
|
-
inferSchema,
|
|
7
|
-
sampleFromSchemaGeneric,
|
|
8
|
-
createXMLExample,
|
|
9
|
-
memoizedCreateXMLExample,
|
|
10
|
-
memoizedSampleFromSchema,
|
|
11
|
-
mergeJsonSchema,
|
|
12
|
-
getSchemaObjectType,
|
|
13
|
-
} from "./fn/index"
|
|
14
|
-
import makeGetJsonSampleSchema from "./fn/get-json-sample-schema"
|
|
15
|
-
import makeGetYamlSampleSchema from "./fn/get-yaml-sample-schema"
|
|
16
|
-
import makeGetXmlSampleSchema from "./fn/get-xml-sample-schema"
|
|
17
|
-
import makeGetSampleSchema from "./fn/get-sample-schema"
|
|
18
|
-
|
|
19
|
-
const JSONSchema5SamplesPlugin = ({ getSystem }) => {
|
|
20
|
-
const getJsonSampleSchema = makeGetJsonSampleSchema(getSystem)
|
|
21
|
-
const getYamlSampleSchema = makeGetYamlSampleSchema(getSystem)
|
|
22
|
-
const getXmlSampleSchema = makeGetXmlSampleSchema(getSystem)
|
|
23
|
-
const getSampleSchema = makeGetSampleSchema(getSystem)
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
fn: {
|
|
27
|
-
jsonSchema5: {
|
|
28
|
-
inferSchema,
|
|
29
|
-
sampleFromSchema,
|
|
30
|
-
sampleFromSchemaGeneric,
|
|
31
|
-
createXMLExample,
|
|
32
|
-
memoizedSampleFromSchema,
|
|
33
|
-
memoizedCreateXMLExample,
|
|
34
|
-
getJsonSampleSchema,
|
|
35
|
-
getYamlSampleSchema,
|
|
36
|
-
getXmlSampleSchema,
|
|
37
|
-
getSampleSchema,
|
|
38
|
-
mergeJsonSchema,
|
|
39
|
-
},
|
|
40
|
-
inferSchema,
|
|
41
|
-
sampleFromSchema,
|
|
42
|
-
sampleFromSchemaGeneric,
|
|
43
|
-
createXMLExample,
|
|
44
|
-
memoizedSampleFromSchema,
|
|
45
|
-
memoizedCreateXMLExample,
|
|
46
|
-
getJsonSampleSchema,
|
|
47
|
-
getYamlSampleSchema,
|
|
48
|
-
getXmlSampleSchema,
|
|
49
|
-
getSampleSchema,
|
|
50
|
-
mergeJsonSchema,
|
|
51
|
-
getSchemaObjectType,
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default JSONSchema5SamplesPlugin
|