@kubb/agent 4.33.0 → 4.33.2
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/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +3554 -2113
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +5 -5
- package/.output/server/index.mjs +5 -5
- package/.output/server/node_modules/.nitro/picomatch@4.0.3/index.js +17 -0
- package/.output/server/node_modules/.nitro/picomatch@4.0.3/lib/constants.js +180 -0
- package/.output/server/node_modules/.nitro/picomatch@4.0.3/lib/parse.js +1085 -0
- package/.output/server/node_modules/.nitro/picomatch@4.0.3/lib/picomatch.js +341 -0
- package/.output/server/node_modules/.nitro/picomatch@4.0.3/lib/scan.js +391 -0
- package/.output/server/node_modules/.nitro/picomatch@4.0.3/lib/utils.js +72 -0
- package/.output/server/node_modules/.nitro/picomatch@4.0.3/package.json +83 -0
- package/.output/server/node_modules/@redocly/ajv/dist/2020.js +55 -0
- package/.output/server/node_modules/@redocly/ajv/dist/ajv.js +50 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/codegen/code.js +156 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/codegen/index.js +697 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/codegen/scope.js +143 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/errors.js +123 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/index.js +249 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/names.js +29 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/ref_error.js +12 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/resolve.js +155 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/rules.js +26 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/util.js +178 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/validate/applicability.js +19 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/validate/boolSchema.js +50 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/validate/dataType.js +203 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/validate/defaults.js +35 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/validate/index.js +534 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/validate/keyword.js +124 -0
- package/.output/server/node_modules/@redocly/ajv/dist/compile/validate/subschema.js +81 -0
- package/.output/server/node_modules/@redocly/ajv/dist/core.js +632 -0
- package/.output/server/node_modules/@redocly/ajv/dist/draft4.js +56 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/data.json +13 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-2020-12/index.js +30 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-2020-12/meta/applicator.json +48 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-2020-12/meta/content.json +17 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-2020-12/meta/core.json +51 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json +37 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-2020-12/meta/validation.json +90 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-2020-12/schema.json +55 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-draft-04.json +138 -0
- package/.output/server/node_modules/@redocly/ajv/dist/refs/json-schema-draft-07.json +151 -0
- package/.output/server/node_modules/@redocly/ajv/dist/runtime/equal.js +7 -0
- package/.output/server/node_modules/@redocly/ajv/dist/runtime/ucs2length.js +24 -0
- package/.output/server/node_modules/@redocly/ajv/dist/runtime/uri.js +6 -0
- package/.output/server/node_modules/@redocly/ajv/dist/runtime/validation_error.js +11 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/additionalItems.js +49 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/additionalProperties.js +107 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/allOf.js +23 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/anyOf.js +12 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/contains.js +95 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/dependencies.js +85 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/dependentSchemas.js +11 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/if.js +66 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/index.js +44 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/items.js +52 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/items2020.js +30 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/not.js +26 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/oneOf.js +60 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/patternProperties.js +75 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/prefixItems.js +12 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/properties.js +55 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/propertyNames.js +38 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/applicator/thenElse.js +13 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/code.js +138 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/core/id.js +10 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/core/index.js +16 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/core/ref.js +132 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/discriminator/index.js +139 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/discriminator/types.js +9 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/draft2020.js +23 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/draft4.js +29 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/draft7.js +17 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +30 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/dynamic/dynamicRef.js +51 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/dynamic/index.js +9 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +16 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/dynamic/recursiveRef.js +10 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/format/format.js +92 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/format/index.js +6 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/metadata.js +26 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/next.js +8 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/oasContext.js +26 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/unevaluated/index.js +7 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +40 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +84 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/const.js +25 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/dependentRequired.js +12 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/draft04/limitNumber.js +43 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js +19 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/enum.js +48 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/index.js +37 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/limitContains.js +15 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/limitItems.js +24 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/limitLength.js +27 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/limitNumber.js +27 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/limitProperties.js +24 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/multipleOf.js +26 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/pattern.js +33 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/readOnly.js +20 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/required.js +86 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/uniqueItems.js +64 -0
- package/.output/server/node_modules/@redocly/ajv/dist/vocabularies/validation/writeOnly.js +20 -0
- package/.output/server/node_modules/@redocly/ajv/package.json +130 -0
- package/.output/server/node_modules/@redocly/config/lib/common.js +103 -0
- package/.output/server/node_modules/@redocly/config/lib/constants/config.js +17 -0
- package/.output/server/node_modules/@redocly/config/lib/constants/entities.js +58 -0
- package/.output/server/node_modules/@redocly/config/lib/constants/enum.js +6 -0
- package/.output/server/node_modules/@redocly/config/lib/constants/shared.js +22 -0
- package/.output/server/node_modules/@redocly/config/lib/default-theme-config-schema.js +54 -0
- package/.output/server/node_modules/@redocly/config/lib/entities-catalog-config-schema.js +186 -0
- package/.output/server/node_modules/@redocly/config/lib/entities-catalog-entity-file-schema.js +283 -0
- package/.output/server/node_modules/@redocly/config/lib/ex-theme-config-schemas.js +682 -0
- package/.output/server/node_modules/@redocly/config/lib/feedback-config-schema.js +88 -0
- package/.output/server/node_modules/@redocly/config/lib/graphql-config-schema.js +157 -0
- package/.output/server/node_modules/@redocly/config/lib/index.js +41 -0
- package/.output/server/node_modules/@redocly/config/lib/product-override-schema.js +43 -0
- package/.output/server/node_modules/@redocly/config/lib/redoc-config-schema.js +120 -0
- package/.output/server/node_modules/@redocly/config/lib/reference-docs-config-schema.js +518 -0
- package/.output/server/node_modules/@redocly/config/lib/remove-property-recursively.js +25 -0
- package/.output/server/node_modules/@redocly/config/lib/reunite-config-schema.js +103 -0
- package/.output/server/node_modules/@redocly/config/lib/root-config-schema.js +558 -0
- package/.output/server/node_modules/@redocly/config/lib/scorecards-config-schema.js +242 -0
- package/.output/server/node_modules/@redocly/config/lib/types/api-functions-types.js +3 -0
- package/.output/server/node_modules/@redocly/config/lib/types/catalog-entity-types.js +3 -0
- package/.output/server/node_modules/@redocly/config/lib/types/code-walkthrough-types.js +3 -0
- package/.output/server/node_modules/@redocly/config/lib/types/config-types.js +3 -0
- package/.output/server/node_modules/@redocly/config/lib/types/index.js +21 -0
- package/.output/server/node_modules/@redocly/config/lib/types/portal-shared-types.js +18 -0
- package/.output/server/node_modules/@redocly/config/package.json +28 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-document.js +85 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-visitor.js +257 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle.js +74 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/all.js +310 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/builtIn.js +58 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/bundle-extends.js +27 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/config-resolvers.js +335 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/config.js +338 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/constants.js +13 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/get-resolve-config.js +9 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/group-assertion-rules.js +51 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/index.js +8 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/load.js +98 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/minimal.js +289 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/recommended-strict.js +289 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/recommended.js +289 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/rules.js +35 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/spec.js +289 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/types.js +2 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/utils.js +129 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/visitors.js +99 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/arazzo/index.js +2 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/async2/index.js +2 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/async3/index.js +2 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/common/filters/filter-helper.js +65 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/common/filters/filter-in.js +14 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/common/filters/filter-out.js +14 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/common/info-description-override.js +21 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/common/info-override.js +14 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/common/media-type-examples-override.js +58 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/common/operation-description-override.js +27 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/common/remove-x-internal.js +68 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/common/tag-description-override.js +23 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas2/index.js +19 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas2/remove-unused-components.js +88 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas3/index.js +21 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas3/remove-unused-components.js +116 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/openrpc/index.js +2 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/overlay1/index.js +2 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/detect-spec.js +79 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/env.js +5 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/errors/yaml-parse-error.js +14 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/format/codeframes.js +177 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/format/format.js +365 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/index.js +49 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/js-yaml/index.js +11 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/lint-entity.js +171 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/lint.js +123 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/logger.js +56 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/oas-types.js +35 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/ref-utils.js +109 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/resolve.js +326 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/ajv.js +106 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/criteria-unique.js +68 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/index.js +52 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/outputs-defined.js +139 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/parameters-unique.js +27 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/requestBody-replacements-unique.js +30 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/sourceDescription-type.js +19 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/sourceDescriptions-name-unique.js +21 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/sourceDescriptions-not-empty.js +15 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/step-onFailure-unique.js +27 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/step-onSuccess-unique.js +27 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/stepId-unique.js +23 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/workflow-dependsOn.js +53 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/arazzo/workflowId-unique.js +19 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/async2/channels-kebab-case.js +16 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/async2/index.js +32 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/async2/no-channel-trailing-slash.js +13 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/async3/channels-kebab-case.js +16 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/async3/index.js +32 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/async3/no-channel-trailing-slash.js +13 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/catalog-entity/entity-key-valid.js +39 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/assertions/asserts.js +269 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/assertions/index.js +22 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/assertions/utils.js +215 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/info-contact.js +14 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/info-license-strict.js +23 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/info-license.js +14 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-ambiguous-paths.js +42 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-duplicated-tag-names.js +21 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-enum-type-mismatch.js +38 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-http-verbs-in-paths.js +31 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-identical-paths.js +21 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-invalid-parameter-examples.js +32 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-invalid-schema-examples.js +34 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-path-trailing-slash.js +13 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-required-schema-properties-undefined.js +78 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-schema-type-mismatch.js +19 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-unresolved-refs.js +42 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/operation-2xx-response.js +20 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/operation-4xx-response.js +20 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/operation-description.js +9 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/operation-operationId-unique.js +17 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/operation-operationId-url-safe.js +15 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/operation-operationId.js +13 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/operation-parameters-unique.js +37 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/operation-singular-tag.js +13 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/operation-summary.js +9 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/operation-tag-defined.js +27 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/parameter-description.js +19 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/path-declaration-must-exist.js +13 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/path-http-verbs-order.js +23 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/path-not-include-query.js +15 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/path-params-defined.js +145 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/path-segment-plural.js +30 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/paths-kebab-case.js +17 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/required-string-property-missing-min-length.js +34 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/response-contains-header.js +26 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/scalar-property-missing-example.js +39 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/security-defined.js +62 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/spec-strict-refs.js +27 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/struct.js +150 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/tag-description.js +9 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/tags-alphabetical.js +18 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas2/boolean-parameter-prefixes.js +19 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas2/index.js +93 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas2/request-mime-type.js +14 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas2/response-contains-property.js +34 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas2/response-mime-type.js +14 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/array-parameter-serialization.js +26 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/boolean-parameter-prefixes.js +21 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/component-name-unique.js +130 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/index.js +129 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/no-empty-servers.js +20 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/no-example-value-and-externalValue.js +13 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/no-invalid-media-type-examples.js +59 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/no-server-example.com.js +15 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/no-server-trailing-slash.js +15 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/no-server-variables-empty-enum.js +58 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/no-undefined-server-variable.js +28 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/no-unused-components.js +83 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/nullable-type-sibling.js +15 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +33 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/request-mime-type.js +28 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/response-contains-property.js +36 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/response-mime-type.js +28 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/spec-components-invalid-map-name.js +59 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/spec-discriminator-defaultMapping.js +32 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/spec-example-values.js +31 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/spec-no-invalid-encoding-combinations.js +16 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/spec-no-invalid-tag-parents.js +38 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/oas3/spec-querystring-parameters.js +65 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/openrpc/index.js +20 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/openrpc/no-unused-components.js +82 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/openrpc/spec-no-duplicated-method-params.js +28 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/openrpc/spec-no-required-params-after-optional.js +31 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/other/stats.js +190 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/overlay1/index.js +12 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/respect/no-criteria-xpath.js +20 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/respect/no-x-security-both-scheme-and-scheme-name.js +30 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/respect/no-x-security-scheme-name-without-openapi.js +25 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/respect/respect-supported-versions.js +18 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/respect/x-security-scheme-name-reference.js +35 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/respect/x-security-scheme-required-values.js +60 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/utils.js +172 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/arazzo.js +482 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/asyncapi2.js +1157 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/asyncapi3.js +511 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/entity.js +32 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/index.js +90 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/json-schema-adapter.js +181 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/json-schema-draft7.shared.js +101 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/oas2.js +454 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/oas3.js +828 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/oas3_1.js +292 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/oas3_2.js +306 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/openrpc.js +360 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/overlay.js +61 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/redocly-yaml.js +573 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/typings/arazzo.js +3 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/assign-config.js +28 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/dequal.js +36 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/does-yaml-file-exist.js +7 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/error.js +3 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/get-intersection-length.js +11 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/get-matching-status-code-range.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/get-own.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/identity.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-custom-rule-id.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-defined.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-empty-array.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-empty-object.js +5 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-not-empty-array.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-not-empty-object.js +6 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-not-string.js +5 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-ordered.js +27 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-path-parameter.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-plain-object.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-string.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/is-truthy.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/keys-of.js +6 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/make-ref-id.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/next-tick.js +6 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/oas-has-component.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/omit.js +8 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/pause.js +4 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/pluralize.js +8 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/read-file-from-url.js +26 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/regex-from-string.js +5 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/scorecards.js +99 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/slash.js +11 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/split-camel-case-into-words.js +13 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/stack.js +7 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/validate-mime-type.js +31 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/utils/yaml-fs-helper.js +23 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/visitors.js +177 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/walk.js +303 -0
- package/.output/server/node_modules/@redocly/openapi-core/package.json +74 -0
- package/.output/server/node_modules/ajv-formats/dist/formats.js +208 -0
- package/.output/server/node_modules/ajv-formats/dist/index.js +37 -0
- package/.output/server/node_modules/ajv-formats/dist/limit.js +69 -0
- package/.output/server/node_modules/ajv-formats/package.json +74 -0
- package/.output/server/node_modules/colorette/index.js +82 -0
- package/.output/server/node_modules/colorette/package.json +39 -0
- package/.output/server/node_modules/js-levenshtein/index.js +105 -0
- package/.output/server/node_modules/js-levenshtein/package.json +49 -0
- package/.output/server/node_modules/pluralize/package.json +40 -0
- package/.output/server/node_modules/pluralize/pluralize.js +503 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/common.js +45 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/dumper.js +644 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/exception.js +40 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/index.js +22 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/loader.js +1416 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/mark.js +62 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/scalarInference.js +82 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/schema/core.js +8 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/schema/default_full.js +14 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/schema/default_safe.js +19 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/schema/failsafe.js +10 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/schema/json.js +14 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/schema.js +78 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/binary.js +92 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/bool.js +32 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/float.js +95 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/int.js +155 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/js/regexp.js +64 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/js/undefined.js +22 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/map.js +7 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/merge.js +10 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/null.js +30 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/omap.js +46 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/pairs.js +55 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/seq.js +7 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/set.js +22 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/str.js +7 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type/timestamp.js +70 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/type.js +54 -0
- package/.output/server/node_modules/yaml-ast-parser/dist/src/yamlAST.js +82 -0
- package/.output/server/node_modules/yaml-ast-parser/package.json +39 -0
- package/.output/server/package.json +9 -1
- package/package.json +18 -17
- /package/.output/server/node_modules/{picomatch → .nitro/picomatch@2.3.1}/index.js +0 -0
- /package/.output/server/node_modules/{picomatch → .nitro/picomatch@2.3.1}/lib/constants.js +0 -0
- /package/.output/server/node_modules/{picomatch → .nitro/picomatch@2.3.1}/lib/parse.js +0 -0
- /package/.output/server/node_modules/{picomatch → .nitro/picomatch@2.3.1}/lib/picomatch.js +0 -0
- /package/.output/server/node_modules/{picomatch → .nitro/picomatch@2.3.1}/lib/scan.js +0 -0
- /package/.output/server/node_modules/{picomatch → .nitro/picomatch@2.3.1}/lib/utils.js +0 -0
- /package/.output/server/node_modules/{picomatch → .nitro/picomatch@2.3.1}/package.json +0 -0
|
@@ -0,0 +1,632 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
|
4
|
+
var validate_1 = require("./compile/validate");
|
|
5
|
+
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
|
6
|
+
var codegen_1 = require("./compile/codegen");
|
|
7
|
+
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
|
8
|
+
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
|
9
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
|
10
|
+
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
|
11
|
+
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
|
12
|
+
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
|
13
|
+
const validation_error_1 = require("./runtime/validation_error");
|
|
14
|
+
const ref_error_1 = require("./compile/ref_error");
|
|
15
|
+
const rules_1 = require("./compile/rules");
|
|
16
|
+
const compile_1 = require("./compile");
|
|
17
|
+
const codegen_2 = require("./compile/codegen");
|
|
18
|
+
const resolve_1 = require("./compile/resolve");
|
|
19
|
+
const dataType_1 = require("./compile/validate/dataType");
|
|
20
|
+
const util_1 = require("./compile/util");
|
|
21
|
+
const $dataRefSchema = require("./refs/data.json");
|
|
22
|
+
const uri_1 = require("./runtime/uri");
|
|
23
|
+
const defaultRegExp = (str, flags) => new RegExp(str, flags);
|
|
24
|
+
defaultRegExp.code = "new RegExp";
|
|
25
|
+
const META_IGNORE_OPTIONS = [
|
|
26
|
+
"removeAdditional",
|
|
27
|
+
"useDefaults",
|
|
28
|
+
"coerceTypes",
|
|
29
|
+
"defaultUnevaluatedProperties",
|
|
30
|
+
"defaultAdditionalProperties",
|
|
31
|
+
];
|
|
32
|
+
const EXT_SCOPE_NAMES = new Set([
|
|
33
|
+
"validate",
|
|
34
|
+
"serialize",
|
|
35
|
+
"parse",
|
|
36
|
+
"wrapper",
|
|
37
|
+
"root",
|
|
38
|
+
"schema",
|
|
39
|
+
"keyword",
|
|
40
|
+
"pattern",
|
|
41
|
+
"formats",
|
|
42
|
+
"validate$data",
|
|
43
|
+
"func",
|
|
44
|
+
"obj",
|
|
45
|
+
"Error",
|
|
46
|
+
]);
|
|
47
|
+
const removedOptions = {
|
|
48
|
+
errorDataPath: "",
|
|
49
|
+
format: "`validateFormats: false` can be used instead.",
|
|
50
|
+
nullable: '"nullable" keyword is supported by default.',
|
|
51
|
+
jsonPointers: "Deprecated jsPropertySyntax can be used instead.",
|
|
52
|
+
extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.",
|
|
53
|
+
missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.",
|
|
54
|
+
processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`",
|
|
55
|
+
sourceCode: "Use option `code: {source: true}`",
|
|
56
|
+
strictDefaults: "It is default now, see option `strict`.",
|
|
57
|
+
strictKeywords: "It is default now, see option `strict`.",
|
|
58
|
+
uniqueItems: '"uniqueItems" keyword is always validated.',
|
|
59
|
+
unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
|
|
60
|
+
cache: "Map is used as cache, schema object as key.",
|
|
61
|
+
serialize: "Map is used as cache, schema object as key.",
|
|
62
|
+
ajvErrors: "It is default now.",
|
|
63
|
+
};
|
|
64
|
+
const deprecatedOptions = {
|
|
65
|
+
ignoreKeywordsWithRef: "",
|
|
66
|
+
jsPropertySyntax: "",
|
|
67
|
+
unicode: '"minLength"/"maxLength" account for unicode characters by default.',
|
|
68
|
+
};
|
|
69
|
+
const MAX_EXPRESSION = 200;
|
|
70
|
+
// eslint-disable-next-line complexity
|
|
71
|
+
function requiredOptions(o) {
|
|
72
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
73
|
+
const s = o.strict;
|
|
74
|
+
const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
|
|
75
|
+
const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0;
|
|
76
|
+
const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
|
|
77
|
+
const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
|
|
78
|
+
return {
|
|
79
|
+
strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true,
|
|
80
|
+
strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,
|
|
81
|
+
strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log",
|
|
82
|
+
strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log",
|
|
83
|
+
strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false,
|
|
84
|
+
code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },
|
|
85
|
+
loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,
|
|
86
|
+
loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
|
|
87
|
+
meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,
|
|
88
|
+
messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,
|
|
89
|
+
inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,
|
|
90
|
+
schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id",
|
|
91
|
+
addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true,
|
|
92
|
+
validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true,
|
|
93
|
+
validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true,
|
|
94
|
+
unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true,
|
|
95
|
+
int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true,
|
|
96
|
+
uriResolver: uriResolver,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
class Ajv {
|
|
100
|
+
constructor(opts = {}) {
|
|
101
|
+
this.schemas = {};
|
|
102
|
+
this.refs = {};
|
|
103
|
+
this.formats = {};
|
|
104
|
+
this._compilations = new Set();
|
|
105
|
+
this._loading = {};
|
|
106
|
+
this._cache = new Map();
|
|
107
|
+
opts = this.opts = { ...opts, ...requiredOptions(opts) };
|
|
108
|
+
const { es5, lines } = this.opts.code;
|
|
109
|
+
this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines });
|
|
110
|
+
this.logger = getLogger(opts.logger);
|
|
111
|
+
const formatOpt = opts.validateFormats;
|
|
112
|
+
opts.validateFormats = false;
|
|
113
|
+
this.RULES = (0, rules_1.getRules)();
|
|
114
|
+
checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED");
|
|
115
|
+
checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn");
|
|
116
|
+
this._metaOpts = getMetaSchemaOptions.call(this);
|
|
117
|
+
if (opts.formats)
|
|
118
|
+
addInitialFormats.call(this);
|
|
119
|
+
this._addVocabularies();
|
|
120
|
+
this._addDefaultMetaSchema();
|
|
121
|
+
if (opts.keywords)
|
|
122
|
+
addInitialKeywords.call(this, opts.keywords);
|
|
123
|
+
if (typeof opts.meta == "object")
|
|
124
|
+
this.addMetaSchema(opts.meta);
|
|
125
|
+
addInitialSchemas.call(this);
|
|
126
|
+
opts.validateFormats = formatOpt;
|
|
127
|
+
}
|
|
128
|
+
_addVocabularies() {
|
|
129
|
+
this.addKeyword("$async");
|
|
130
|
+
}
|
|
131
|
+
_addDefaultMetaSchema() {
|
|
132
|
+
const { $data, meta, schemaId } = this.opts;
|
|
133
|
+
let _dataRefSchema = $dataRefSchema;
|
|
134
|
+
if (schemaId === "id") {
|
|
135
|
+
_dataRefSchema = { ...$dataRefSchema };
|
|
136
|
+
_dataRefSchema.id = _dataRefSchema.$id;
|
|
137
|
+
delete _dataRefSchema.$id;
|
|
138
|
+
}
|
|
139
|
+
if (meta && $data)
|
|
140
|
+
this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
|
|
141
|
+
}
|
|
142
|
+
defaultMeta() {
|
|
143
|
+
const { meta, schemaId } = this.opts;
|
|
144
|
+
return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined);
|
|
145
|
+
}
|
|
146
|
+
// Set the defaultUnevaluatedProperties option.
|
|
147
|
+
// WARNING: This only affects schemas compiled AFTER this method is called.
|
|
148
|
+
// Already-compiled schemas in the cache will NOT be affected.
|
|
149
|
+
// Consider clearing the cache or creating a new Ajv instance if you need
|
|
150
|
+
// different behavior for the same schemas.
|
|
151
|
+
setDefaultUnevaluatedProperties(value) {
|
|
152
|
+
this.opts.defaultUnevaluatedProperties = value;
|
|
153
|
+
}
|
|
154
|
+
validate(schemaKeyRef, // key, ref or schema object
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
156
|
+
data // to be validated
|
|
157
|
+
) {
|
|
158
|
+
let v;
|
|
159
|
+
if (typeof schemaKeyRef == "string") {
|
|
160
|
+
v = this.getSchema(schemaKeyRef);
|
|
161
|
+
if (!v)
|
|
162
|
+
throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
v = this.compile(schemaKeyRef);
|
|
166
|
+
}
|
|
167
|
+
const valid = v(data);
|
|
168
|
+
if (!("$async" in v))
|
|
169
|
+
this.errors = v.errors;
|
|
170
|
+
return valid;
|
|
171
|
+
}
|
|
172
|
+
compile(schema, _meta) {
|
|
173
|
+
const sch = this._addSchema(schema, _meta);
|
|
174
|
+
return (sch.validate || this._compileSchemaEnv(sch));
|
|
175
|
+
}
|
|
176
|
+
compileAsync(schema, meta) {
|
|
177
|
+
if (typeof this.opts.loadSchema != "function") {
|
|
178
|
+
throw new Error("options.loadSchema should be a function");
|
|
179
|
+
}
|
|
180
|
+
const { loadSchema } = this.opts;
|
|
181
|
+
return runCompileAsync.call(this, schema, meta);
|
|
182
|
+
async function runCompileAsync(_schema, _meta) {
|
|
183
|
+
await loadMetaSchema.call(this, _schema.$schema);
|
|
184
|
+
const sch = this._addSchema(_schema, _meta);
|
|
185
|
+
return sch.validate || _compileAsync.call(this, sch);
|
|
186
|
+
}
|
|
187
|
+
async function loadMetaSchema($ref) {
|
|
188
|
+
if ($ref && !this.getSchema($ref)) {
|
|
189
|
+
await runCompileAsync.call(this, { $ref }, true);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
async function _compileAsync(sch) {
|
|
193
|
+
try {
|
|
194
|
+
return this._compileSchemaEnv(sch);
|
|
195
|
+
}
|
|
196
|
+
catch (e) {
|
|
197
|
+
if (!(e instanceof ref_error_1.default))
|
|
198
|
+
throw e;
|
|
199
|
+
checkLoaded.call(this, e);
|
|
200
|
+
await loadMissingSchema.call(this, e.missingSchema);
|
|
201
|
+
return _compileAsync.call(this, sch);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function checkLoaded({ missingSchema: ref, missingRef }) {
|
|
205
|
+
if (this.refs[ref]) {
|
|
206
|
+
throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
async function loadMissingSchema(ref) {
|
|
210
|
+
const _schema = await _loadSchema.call(this, ref);
|
|
211
|
+
if (!this.refs[ref])
|
|
212
|
+
await loadMetaSchema.call(this, _schema.$schema);
|
|
213
|
+
if (!this.refs[ref])
|
|
214
|
+
this.addSchema(_schema, ref, meta);
|
|
215
|
+
}
|
|
216
|
+
async function _loadSchema(ref) {
|
|
217
|
+
const p = this._loading[ref];
|
|
218
|
+
if (p)
|
|
219
|
+
return p;
|
|
220
|
+
try {
|
|
221
|
+
return await (this._loading[ref] = loadSchema(ref));
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
delete this._loading[ref];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// Adds schema to the instance
|
|
229
|
+
addSchema(schema, // If array is passed, `key` will be ignored
|
|
230
|
+
key, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
|
|
231
|
+
_meta, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
|
|
232
|
+
_validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead.
|
|
233
|
+
) {
|
|
234
|
+
if (Array.isArray(schema)) {
|
|
235
|
+
for (const sch of schema)
|
|
236
|
+
this.addSchema(sch, undefined, _meta, _validateSchema);
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
let id;
|
|
240
|
+
if (typeof schema === "object") {
|
|
241
|
+
const { schemaId } = this.opts;
|
|
242
|
+
id = schema[schemaId];
|
|
243
|
+
if (id !== undefined && typeof id != "string") {
|
|
244
|
+
throw new Error(`schema ${schemaId} must be string`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
key = (0, resolve_1.normalizeId)(key || id);
|
|
248
|
+
this._checkUnique(key);
|
|
249
|
+
this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
// Add schema that will be used to validate other schemas
|
|
253
|
+
// options in META_IGNORE_OPTIONS are alway set to false
|
|
254
|
+
addMetaSchema(schema, key, // schema key
|
|
255
|
+
_validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema
|
|
256
|
+
) {
|
|
257
|
+
this.addSchema(schema, key, true, _validateSchema);
|
|
258
|
+
return this;
|
|
259
|
+
}
|
|
260
|
+
// Validate schema against its meta-schema
|
|
261
|
+
validateSchema(schema, throwOrLogError) {
|
|
262
|
+
if (typeof schema == "boolean")
|
|
263
|
+
return true;
|
|
264
|
+
let $schema;
|
|
265
|
+
$schema = schema.$schema;
|
|
266
|
+
if ($schema !== undefined && typeof $schema != "string") {
|
|
267
|
+
throw new Error("$schema must be a string");
|
|
268
|
+
}
|
|
269
|
+
$schema = $schema || this.opts.defaultMeta || this.defaultMeta();
|
|
270
|
+
if (!$schema) {
|
|
271
|
+
this.logger.warn("meta-schema not available");
|
|
272
|
+
this.errors = null;
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
const valid = this.validate($schema, schema);
|
|
276
|
+
if (!valid && throwOrLogError) {
|
|
277
|
+
const message = "schema is invalid: " + this.errorsText();
|
|
278
|
+
if (this.opts.validateSchema === "log")
|
|
279
|
+
this.logger.error(message);
|
|
280
|
+
else
|
|
281
|
+
throw new Error(message);
|
|
282
|
+
}
|
|
283
|
+
return valid;
|
|
284
|
+
}
|
|
285
|
+
// Get compiled schema by `key` or `ref`.
|
|
286
|
+
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
287
|
+
getSchema(keyRef) {
|
|
288
|
+
let sch;
|
|
289
|
+
while (typeof (sch = getSchEnv.call(this, keyRef)) == "string")
|
|
290
|
+
keyRef = sch;
|
|
291
|
+
if (sch === undefined) {
|
|
292
|
+
const { schemaId } = this.opts;
|
|
293
|
+
const root = new compile_1.SchemaEnv({ schema: {}, schemaId });
|
|
294
|
+
sch = compile_1.resolveSchema.call(this, root, keyRef);
|
|
295
|
+
if (!sch)
|
|
296
|
+
return;
|
|
297
|
+
this.refs[keyRef] = sch;
|
|
298
|
+
}
|
|
299
|
+
return (sch.validate || this._compileSchemaEnv(sch));
|
|
300
|
+
}
|
|
301
|
+
// Remove cached schema(s).
|
|
302
|
+
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
303
|
+
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
304
|
+
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
305
|
+
removeSchema(schemaKeyRef) {
|
|
306
|
+
if (schemaKeyRef instanceof RegExp) {
|
|
307
|
+
this._removeAllSchemas(this.schemas, schemaKeyRef);
|
|
308
|
+
this._removeAllSchemas(this.refs, schemaKeyRef);
|
|
309
|
+
return this;
|
|
310
|
+
}
|
|
311
|
+
switch (typeof schemaKeyRef) {
|
|
312
|
+
case "undefined":
|
|
313
|
+
this._removeAllSchemas(this.schemas);
|
|
314
|
+
this._removeAllSchemas(this.refs);
|
|
315
|
+
this._cache.clear();
|
|
316
|
+
return this;
|
|
317
|
+
case "string": {
|
|
318
|
+
const sch = getSchEnv.call(this, schemaKeyRef);
|
|
319
|
+
if (typeof sch == "object")
|
|
320
|
+
this._cache.delete(sch.schema);
|
|
321
|
+
delete this.schemas[schemaKeyRef];
|
|
322
|
+
delete this.refs[schemaKeyRef];
|
|
323
|
+
return this;
|
|
324
|
+
}
|
|
325
|
+
case "object": {
|
|
326
|
+
const cacheKey = schemaKeyRef;
|
|
327
|
+
this._cache.delete(cacheKey);
|
|
328
|
+
let id = schemaKeyRef[this.opts.schemaId];
|
|
329
|
+
if (id) {
|
|
330
|
+
id = (0, resolve_1.normalizeId)(id);
|
|
331
|
+
delete this.schemas[id];
|
|
332
|
+
delete this.refs[id];
|
|
333
|
+
}
|
|
334
|
+
return this;
|
|
335
|
+
}
|
|
336
|
+
default:
|
|
337
|
+
throw new Error("ajv.removeSchema: invalid parameter");
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
// add "vocabulary" - a collection of keywords
|
|
341
|
+
addVocabulary(definitions) {
|
|
342
|
+
for (const def of definitions)
|
|
343
|
+
this.addKeyword(def);
|
|
344
|
+
return this;
|
|
345
|
+
}
|
|
346
|
+
addKeyword(kwdOrDef, def // deprecated
|
|
347
|
+
) {
|
|
348
|
+
let keyword;
|
|
349
|
+
if (typeof kwdOrDef == "string") {
|
|
350
|
+
keyword = kwdOrDef;
|
|
351
|
+
if (typeof def == "object") {
|
|
352
|
+
this.logger.warn("these parameters are deprecated, see docs for addKeyword");
|
|
353
|
+
def.keyword = keyword;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else if (typeof kwdOrDef == "object" && def === undefined) {
|
|
357
|
+
def = kwdOrDef;
|
|
358
|
+
keyword = def.keyword;
|
|
359
|
+
if (Array.isArray(keyword) && !keyword.length) {
|
|
360
|
+
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
throw new Error("invalid addKeywords parameters");
|
|
365
|
+
}
|
|
366
|
+
checkKeyword.call(this, keyword, def);
|
|
367
|
+
if (!def) {
|
|
368
|
+
(0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd));
|
|
369
|
+
return this;
|
|
370
|
+
}
|
|
371
|
+
keywordMetaschema.call(this, def);
|
|
372
|
+
const definition = {
|
|
373
|
+
...def,
|
|
374
|
+
type: (0, dataType_1.getJSONTypes)(def.type),
|
|
375
|
+
schemaType: (0, dataType_1.getJSONTypes)(def.schemaType),
|
|
376
|
+
};
|
|
377
|
+
(0, util_1.eachItem)(keyword, definition.type.length === 0
|
|
378
|
+
? (k) => addRule.call(this, k, definition)
|
|
379
|
+
: (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)));
|
|
380
|
+
return this;
|
|
381
|
+
}
|
|
382
|
+
getKeyword(keyword) {
|
|
383
|
+
const rule = this.RULES.all[keyword];
|
|
384
|
+
return typeof rule == "object" ? rule.definition : !!rule;
|
|
385
|
+
}
|
|
386
|
+
// Remove keyword
|
|
387
|
+
removeKeyword(keyword) {
|
|
388
|
+
// TODO return type should be Ajv
|
|
389
|
+
const { RULES } = this;
|
|
390
|
+
delete RULES.keywords[keyword];
|
|
391
|
+
delete RULES.all[keyword];
|
|
392
|
+
for (const group of RULES.rules) {
|
|
393
|
+
const i = group.rules.findIndex((rule) => rule.keyword === keyword);
|
|
394
|
+
if (i >= 0)
|
|
395
|
+
group.rules.splice(i, 1);
|
|
396
|
+
}
|
|
397
|
+
return this;
|
|
398
|
+
}
|
|
399
|
+
// Add format
|
|
400
|
+
addFormat(name, format) {
|
|
401
|
+
if (typeof format == "string")
|
|
402
|
+
format = new RegExp(format);
|
|
403
|
+
this.formats[name] = format;
|
|
404
|
+
return this;
|
|
405
|
+
}
|
|
406
|
+
errorsText(errors = this.errors, // optional array of validation errors
|
|
407
|
+
{ separator = ", ", dataVar = "data" } = {} // optional options with properties `separator` and `dataVar`
|
|
408
|
+
) {
|
|
409
|
+
if (!errors || errors.length === 0)
|
|
410
|
+
return "No errors";
|
|
411
|
+
return errors
|
|
412
|
+
.map((e) => `${dataVar}${e.instancePath} ${e.message}`)
|
|
413
|
+
.reduce((text, msg) => text + separator + msg);
|
|
414
|
+
}
|
|
415
|
+
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
416
|
+
const rules = this.RULES.all;
|
|
417
|
+
metaSchema = JSON.parse(JSON.stringify(metaSchema));
|
|
418
|
+
for (const jsonPointer of keywordsJsonPointers) {
|
|
419
|
+
const segments = jsonPointer.split("/").slice(1); // first segment is an empty string
|
|
420
|
+
let keywords = metaSchema;
|
|
421
|
+
for (const seg of segments)
|
|
422
|
+
keywords = keywords[seg];
|
|
423
|
+
for (const key in rules) {
|
|
424
|
+
const rule = rules[key];
|
|
425
|
+
if (typeof rule != "object")
|
|
426
|
+
continue;
|
|
427
|
+
const { $data } = rule.definition;
|
|
428
|
+
const schema = keywords[key];
|
|
429
|
+
if ($data && schema)
|
|
430
|
+
keywords[key] = schemaOrData(schema);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return metaSchema;
|
|
434
|
+
}
|
|
435
|
+
_removeAllSchemas(schemas, regex) {
|
|
436
|
+
for (const keyRef in schemas) {
|
|
437
|
+
const sch = schemas[keyRef];
|
|
438
|
+
if (!regex || regex.test(keyRef)) {
|
|
439
|
+
if (typeof sch == "string") {
|
|
440
|
+
delete schemas[keyRef];
|
|
441
|
+
}
|
|
442
|
+
else if (sch && !sch.meta) {
|
|
443
|
+
this._cache.delete(sch.schema);
|
|
444
|
+
delete schemas[keyRef];
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
_addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
450
|
+
let id;
|
|
451
|
+
const { schemaId } = this.opts;
|
|
452
|
+
if (typeof schema == "object") {
|
|
453
|
+
id = schema[schemaId];
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
if (this.opts.jtd)
|
|
457
|
+
throw new Error("schema must be object");
|
|
458
|
+
else if (typeof schema != "boolean")
|
|
459
|
+
throw new Error("schema must be object or boolean");
|
|
460
|
+
}
|
|
461
|
+
let sch = this._cache.get(schema);
|
|
462
|
+
if (sch !== undefined)
|
|
463
|
+
return sch;
|
|
464
|
+
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
465
|
+
const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
|
|
466
|
+
sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });
|
|
467
|
+
this._cache.set(sch.schema, sch);
|
|
468
|
+
if (addSchema && !baseId.startsWith("#")) {
|
|
469
|
+
// TODO atm it is allowed to overwrite schemas without id (instead of not adding them)
|
|
470
|
+
if (baseId)
|
|
471
|
+
this._checkUnique(baseId);
|
|
472
|
+
this.refs[baseId] = sch;
|
|
473
|
+
}
|
|
474
|
+
if (validateSchema)
|
|
475
|
+
this.validateSchema(schema, true);
|
|
476
|
+
return sch;
|
|
477
|
+
}
|
|
478
|
+
_checkUnique(id) {
|
|
479
|
+
if (this.schemas[id] || this.refs[id]) {
|
|
480
|
+
throw new Error(`schema with key or id "${id}" already exists`);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
_compileSchemaEnv(sch) {
|
|
484
|
+
if (sch.meta)
|
|
485
|
+
this._compileMetaSchema(sch);
|
|
486
|
+
else
|
|
487
|
+
compile_1.compileSchema.call(this, sch);
|
|
488
|
+
/* istanbul ignore if */
|
|
489
|
+
if (!sch.validate)
|
|
490
|
+
throw new Error("ajv implementation error");
|
|
491
|
+
return sch.validate;
|
|
492
|
+
}
|
|
493
|
+
_compileMetaSchema(sch) {
|
|
494
|
+
const currentOpts = this.opts;
|
|
495
|
+
this.opts = this._metaOpts;
|
|
496
|
+
try {
|
|
497
|
+
compile_1.compileSchema.call(this, sch);
|
|
498
|
+
}
|
|
499
|
+
finally {
|
|
500
|
+
this.opts = currentOpts;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
Ajv.ValidationError = validation_error_1.default;
|
|
505
|
+
Ajv.MissingRefError = ref_error_1.default;
|
|
506
|
+
exports.default = Ajv;
|
|
507
|
+
function checkOptions(checkOpts, options, msg, log = "error") {
|
|
508
|
+
for (const key in checkOpts) {
|
|
509
|
+
const opt = key;
|
|
510
|
+
if (opt in options)
|
|
511
|
+
this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
function getSchEnv(keyRef) {
|
|
515
|
+
keyRef = (0, resolve_1.normalizeId)(keyRef); // TODO tests fail without this line
|
|
516
|
+
return this.schemas[keyRef] || this.refs[keyRef];
|
|
517
|
+
}
|
|
518
|
+
function addInitialSchemas() {
|
|
519
|
+
const optsSchemas = this.opts.schemas;
|
|
520
|
+
if (!optsSchemas)
|
|
521
|
+
return;
|
|
522
|
+
if (Array.isArray(optsSchemas))
|
|
523
|
+
this.addSchema(optsSchemas);
|
|
524
|
+
else
|
|
525
|
+
for (const key in optsSchemas)
|
|
526
|
+
this.addSchema(optsSchemas[key], key);
|
|
527
|
+
}
|
|
528
|
+
function addInitialFormats() {
|
|
529
|
+
for (const name in this.opts.formats) {
|
|
530
|
+
const format = this.opts.formats[name];
|
|
531
|
+
if (format)
|
|
532
|
+
this.addFormat(name, format);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
function addInitialKeywords(defs) {
|
|
536
|
+
if (Array.isArray(defs)) {
|
|
537
|
+
this.addVocabulary(defs);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
541
|
+
for (const keyword in defs) {
|
|
542
|
+
const def = defs[keyword];
|
|
543
|
+
if (!def.keyword)
|
|
544
|
+
def.keyword = keyword;
|
|
545
|
+
this.addKeyword(def);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
function getMetaSchemaOptions() {
|
|
549
|
+
const metaOpts = { ...this.opts };
|
|
550
|
+
for (const opt of META_IGNORE_OPTIONS)
|
|
551
|
+
delete metaOpts[opt];
|
|
552
|
+
return metaOpts;
|
|
553
|
+
}
|
|
554
|
+
const noLogs = { log() { }, warn() { }, error() { } };
|
|
555
|
+
function getLogger(logger) {
|
|
556
|
+
if (logger === false)
|
|
557
|
+
return noLogs;
|
|
558
|
+
if (logger === undefined)
|
|
559
|
+
return console;
|
|
560
|
+
if (logger.log && logger.warn && logger.error)
|
|
561
|
+
return logger;
|
|
562
|
+
throw new Error("logger must implement log, warn and error methods");
|
|
563
|
+
}
|
|
564
|
+
const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
565
|
+
function checkKeyword(keyword, def) {
|
|
566
|
+
const { RULES } = this;
|
|
567
|
+
(0, util_1.eachItem)(keyword, (kwd) => {
|
|
568
|
+
if (RULES.keywords[kwd])
|
|
569
|
+
throw new Error(`Keyword ${kwd} is already defined`);
|
|
570
|
+
if (!KEYWORD_NAME.test(kwd))
|
|
571
|
+
throw new Error(`Keyword ${kwd} has invalid name`);
|
|
572
|
+
});
|
|
573
|
+
if (!def)
|
|
574
|
+
return;
|
|
575
|
+
if (def.$data && !("code" in def || "validate" in def)) {
|
|
576
|
+
throw new Error('$data keyword must have "code" or "validate" function');
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function addRule(keyword, definition, dataType) {
|
|
580
|
+
var _a;
|
|
581
|
+
const post = definition === null || definition === void 0 ? void 0 : definition.post;
|
|
582
|
+
if (dataType && post)
|
|
583
|
+
throw new Error('keyword with "post" flag cannot have "type"');
|
|
584
|
+
const { RULES } = this;
|
|
585
|
+
let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType);
|
|
586
|
+
if (!ruleGroup) {
|
|
587
|
+
ruleGroup = { type: dataType, rules: [] };
|
|
588
|
+
RULES.rules.push(ruleGroup);
|
|
589
|
+
}
|
|
590
|
+
RULES.keywords[keyword] = true;
|
|
591
|
+
if (!definition)
|
|
592
|
+
return;
|
|
593
|
+
const rule = {
|
|
594
|
+
keyword,
|
|
595
|
+
definition: {
|
|
596
|
+
...definition,
|
|
597
|
+
type: (0, dataType_1.getJSONTypes)(definition.type),
|
|
598
|
+
schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType),
|
|
599
|
+
},
|
|
600
|
+
};
|
|
601
|
+
if (definition.before)
|
|
602
|
+
addBeforeRule.call(this, ruleGroup, rule, definition.before);
|
|
603
|
+
else
|
|
604
|
+
ruleGroup.rules.push(rule);
|
|
605
|
+
RULES.all[keyword] = rule;
|
|
606
|
+
(_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
|
|
607
|
+
}
|
|
608
|
+
function addBeforeRule(ruleGroup, rule, before) {
|
|
609
|
+
const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
|
|
610
|
+
if (i >= 0) {
|
|
611
|
+
ruleGroup.rules.splice(i, 0, rule);
|
|
612
|
+
}
|
|
613
|
+
else {
|
|
614
|
+
ruleGroup.rules.push(rule);
|
|
615
|
+
this.logger.warn(`rule ${before} is not defined`);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
function keywordMetaschema(def) {
|
|
619
|
+
let { metaSchema } = def;
|
|
620
|
+
if (metaSchema === undefined)
|
|
621
|
+
return;
|
|
622
|
+
if (def.$data && this.opts.$data)
|
|
623
|
+
metaSchema = schemaOrData(metaSchema);
|
|
624
|
+
def.validateSchema = this.compile(metaSchema, true);
|
|
625
|
+
}
|
|
626
|
+
const $dataRef = {
|
|
627
|
+
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
|
|
628
|
+
};
|
|
629
|
+
function schemaOrData(schema) {
|
|
630
|
+
return { anyOf: [schema, $dataRef] };
|
|
631
|
+
}
|
|
632
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
|
4
|
+
const core_1 = require("./core");
|
|
5
|
+
const draft4_1 = require("./vocabularies/draft4");
|
|
6
|
+
const discriminator_1 = require("./vocabularies/discriminator");
|
|
7
|
+
const draft4MetaSchema = require("./refs/json-schema-draft-04.json");
|
|
8
|
+
const META_SUPPORT_DATA = ["/properties"];
|
|
9
|
+
const META_SCHEMA_ID = "http://json-schema.org/draft-04/schema";
|
|
10
|
+
class Ajv extends core_1.default {
|
|
11
|
+
constructor(opts = {}) {
|
|
12
|
+
super({
|
|
13
|
+
...opts,
|
|
14
|
+
schemaId: "id",
|
|
15
|
+
dynamicRef: true,
|
|
16
|
+
unevaluated: true,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
_addVocabularies() {
|
|
20
|
+
super._addVocabularies();
|
|
21
|
+
draft4_1.default.forEach((v) => this.addVocabulary(v));
|
|
22
|
+
if (this.opts.discriminator)
|
|
23
|
+
this.addKeyword(discriminator_1.default);
|
|
24
|
+
}
|
|
25
|
+
_addDefaultMetaSchema() {
|
|
26
|
+
super._addDefaultMetaSchema();
|
|
27
|
+
if (!this.opts.meta)
|
|
28
|
+
return;
|
|
29
|
+
const metaSchema = this.opts.$data
|
|
30
|
+
? this.$dataMetaSchema(draft4MetaSchema, META_SUPPORT_DATA)
|
|
31
|
+
: draft4MetaSchema;
|
|
32
|
+
this.addMetaSchema(metaSchema, META_SCHEMA_ID, false);
|
|
33
|
+
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
|
34
|
+
}
|
|
35
|
+
defaultMeta() {
|
|
36
|
+
return (this.opts.defaultMeta =
|
|
37
|
+
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
module.exports = exports = Ajv;
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.default = Ajv;
|
|
43
|
+
var validate_1 = require("./compile/validate");
|
|
44
|
+
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
|
45
|
+
var codegen_1 = require("./compile/codegen");
|
|
46
|
+
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
|
47
|
+
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
|
48
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
|
49
|
+
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
|
50
|
+
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
|
51
|
+
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
|
52
|
+
var validation_error_1 = require("./runtime/validation_error");
|
|
53
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
|
|
54
|
+
var ref_error_1 = require("./compile/ref_error");
|
|
55
|
+
Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
|
|
56
|
+
//# sourceMappingURL=draft4.js.map
|