swagger-mock-validator
Advanced tools
Comparing version 9.0.0 to 10.0.0
@@ -0,1 +1,20 @@ | ||
# [10.0.0](https://bitbucket.org/atlassian/swagger-mock-validator/compare/9.0.0...10.0.0) (2020-11-03) | ||
### Bug Fixes | ||
* fix bug when both nullable and swagger custom formats are defined ([ed4acf9](https://bitbucket.org/atlassian/swagger-mock-validator/commits/ed4acf97bd42f68e7cf799f4d2b85e6696ccee23)) | ||
### chore | ||
* bump dependencies ([9b959be](https://bitbucket.org/atlassian/swagger-mock-validator/commits/9b959beabd7d96051c83d241dbc7073a00f3504a)) | ||
### BREAKING CHANGES | ||
* Dropped support for NodeJS v6 and v8. Migrate to NodeJS v10 or above. | ||
# [9.0.0](https://bitbucket.org/atlassian/swagger-mock-validator/compare/8.0.0...9.0.0) (2019-11-07) | ||
@@ -2,0 +21,0 @@ |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -12,3 +13,3 @@ }); | ||
const swaggerMockValidator = { | ||
validate: (options) => __awaiter(this, void 0, void 0, function* () { | ||
validate: (options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const result = yield swagger_mock_validator_1.validateSpecAndMockContent(options); | ||
@@ -15,0 +16,0 @@ return result.validationOutcome; |
#! /usr/bin/env node | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -72,3 +73,3 @@ }); | ||
(i.e. THE_USERNAME:THE_PASSWORD) to access the pact broker resources.`) | ||
.action((swagger, mock, options) => __awaiter(this, void 0, void 0, function* () { | ||
.action((swagger, mock, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
try { | ||
@@ -75,0 +76,0 @@ const swaggerMockValidator = swagger_mock_validator_factory_1.SwaggerMockValidatorFactory.create(options.user); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SwaggerMockValidatorFactory = void 0; | ||
const swagger_mock_validator_1 = require("./swagger-mock-validator"); | ||
@@ -4,0 +5,0 @@ const analytics_1 = require("./swagger-mock-validator/analytics"); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -11,2 +12,3 @@ }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SwaggerMockValidator = exports.validateSpecAndMockContent = void 0; | ||
const _ = require("lodash"); | ||
@@ -27,3 +29,3 @@ const file_store_1 = require("./swagger-mock-validator/file-store"); | ||
const getSpecSource = (specPathOrUrl) => file_store_1.FileStore.isUrl(specPathOrUrl) ? 'url' : 'path'; | ||
const parseUserOptions = (userOptions) => (Object.assign({}, userOptions, { mockSource: getMockSource(userOptions.mockPathOrUrl, userOptions.providerName), specSource: getSpecSource(userOptions.specPathOrUrl) })); | ||
const parseUserOptions = (userOptions) => (Object.assign(Object.assign({}, userOptions), { mockSource: getMockSource(userOptions.mockPathOrUrl, userOptions.providerName), specSource: getSpecSource(userOptions.specPathOrUrl) })); | ||
const combineValidationResults = (validationResults) => { | ||
@@ -44,3 +46,3 @@ const flattenedValidationResults = _.flatten(validationResults); | ||
}; | ||
exports.validateSpecAndMockContent = (options) => __awaiter(this, void 0, void 0, function* () { | ||
exports.validateSpecAndMockContent = (options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const spec = options.spec; | ||
@@ -47,0 +49,0 @@ const mock = options.mock; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Analytics = void 0; | ||
const generateResultSummary = (results) => { | ||
@@ -4,0 +5,0 @@ const summary = results.reduce((partialSummary, result) => { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Metadata = void 0; | ||
const os = require("os"); | ||
@@ -4,0 +5,0 @@ // tslint:disable:no-var-requires |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FileSystem = void 0; | ||
const fs = require("fs"); | ||
@@ -4,0 +5,0 @@ class FileSystem { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.HttpClient = void 0; | ||
const request = require("request"); | ||
@@ -12,3 +13,3 @@ const hasHttp2xxStatusCode = (response) => response.statusCode && response.statusCode >= 200 && response.statusCode <= 299; | ||
if (auth) { | ||
requestOptions = Object.assign({}, requestOptions, { headers: { | ||
requestOptions = Object.assign(Object.assign({}, requestOptions), { headers: { | ||
authorization: 'Basic ' + Buffer.from(auth).toString('base64') | ||
@@ -15,0 +16,0 @@ } }); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -11,2 +12,3 @@ }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PactBrokerClient = void 0; | ||
const swagger_mock_validator_error_impl_1 = require("../swagger-mock-validator-error-impl"); | ||
@@ -13,0 +15,0 @@ const transform_string_to_object_1 = require("../transform-string-to-object"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.traverseJsonSchema = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const util_1 = require("util"); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -11,2 +12,3 @@ }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FileStore = void 0; | ||
const swagger_mock_validator_error_impl_1 = require("./swagger-mock-validator-error-impl"); | ||
@@ -13,0 +15,0 @@ class FileStore { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MockParser = void 0; | ||
const pact_parser_1 = require("./mock-parser/pact/pact-parser"); | ||
@@ -4,0 +5,0 @@ const transform_string_to_object_1 = require("./transform-string-to-object"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pactParser = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const querystring = require("querystring"); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -11,2 +12,3 @@ }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PactBroker = void 0; | ||
const _ = require("lodash"); | ||
@@ -13,0 +15,0 @@ const swagger_mock_validator_error_impl_1 = require("./swagger-mock-validator-error-impl"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.result = void 0; | ||
const errorCodes = [ | ||
@@ -4,0 +5,0 @@ 'request.accept.incompatible', |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -11,2 +12,3 @@ }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SpecParser = void 0; | ||
const openapi3_parser_1 = require("./spec-parser/openapi3/openapi3-parser"); | ||
@@ -13,0 +15,0 @@ const validate_and_dereference_openapi3_spec_1 = require("./spec-parser/openapi3/validate-and-dereference-openapi3-spec"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createEmptyParentOperation = void 0; | ||
exports.createEmptyParentOperation = (specPathOrUrl) => { | ||
@@ -4,0 +5,0 @@ const location = ''; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parsePathNameSegments = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const parseParameterSegment = (pathNameSegment, parsedOperation, pathParameters) => { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isOpenApi3Content = void 0; | ||
const util_1 = require("util"); | ||
@@ -4,0 +5,0 @@ exports.isOpenApi3Content = (specContent) => { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.openApi3Parser = void 0; | ||
const create_empty_parent_operation_1 = require("../common/create-empty-parent-operation"); | ||
@@ -4,0 +5,0 @@ const parse_operation_1 = require("./openapi3-parser/parse-operation"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dereferenceComponent = exports.doDereferenceComponent = void 0; | ||
const jsonpointer = require("jsonpointer"); | ||
@@ -4,0 +5,0 @@ const swagger_mock_validator_error_impl_1 = require("../../../swagger-mock-validator-error-impl"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getContentMimeTypes = void 0; | ||
exports.getContentMimeTypes = (content) => content ? Object.keys(content) : []; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getContentSchema = void 0; | ||
const get_schema_with_spec_definitions_1 = require("./get-schema-with-spec-definitions"); | ||
@@ -4,0 +5,0 @@ const defaultMediaType = 'application/json'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSchemaWithSpecDefinitions = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const traverse_json_schema_1 = require("../../../common/traverse-json-schema"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseOperation = void 0; | ||
const parse_path_name_segments_1 = require("../../common/parse-path-name-segments"); | ||
@@ -4,0 +5,0 @@ const parse_parameters_1 = require("./parse-parameters"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseParameters = void 0; | ||
const dereference_component_1 = require("./dereference-component"); | ||
@@ -29,6 +30,6 @@ const to_parsed_spec_parameter_1 = require("./to-parsed-spec-parameter"); | ||
const mergePathItemAndOperationParameters = (pathItemParameters, operationParameters) => ({ | ||
header: Object.assign({}, pathItemParameters.header, operationParameters.header), | ||
path: Object.assign({}, pathItemParameters.path, operationParameters.path), | ||
query: Object.assign({}, pathItemParameters.query, operationParameters.query) | ||
header: Object.assign(Object.assign({}, pathItemParameters.header), operationParameters.header), | ||
path: Object.assign(Object.assign({}, pathItemParameters.path), operationParameters.path), | ||
query: Object.assign(Object.assign({}, pathItemParameters.query), operationParameters.query) | ||
}); | ||
exports.parseParameters = ({ pathItemParameters, operationParameters, parentOperation, spec }) => mergePathItemAndOperationParameters(toParsedParameters(pathItemParameters, parentOperation, spec), toParsedParameters(operationParameters, parentOperation, spec)); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getParsedRequestBodyValues = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const dereference_component_1 = require("./dereference-component"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseResponseHeaders = void 0; | ||
const dereference_component_1 = require("./dereference-component"); | ||
@@ -4,0 +5,0 @@ const to_parsed_spec_parameter_1 = require("./to-parsed-spec-parameter"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseResponses = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const dereference_component_1 = require("./dereference-component"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseSecurityRequirements = void 0; | ||
const dereference_component_1 = require("./dereference-component"); | ||
@@ -20,3 +21,3 @@ const dereferenceSecuritySchemes = (securitySchemes, spec) => Object.keys(securitySchemes) | ||
}; | ||
const toParsedSpecSecurityRequirement = (requirementDefinition, baseLocation, parentOperation) => (Object.assign({}, getCredential(requirementDefinition), { location: `${baseLocation}.${requirementDefinition.name}`, parentOperation, value: requirementDefinition.value })); | ||
const toParsedSpecSecurityRequirement = (requirementDefinition, baseLocation, parentOperation) => (Object.assign(Object.assign({}, getCredential(requirementDefinition)), { location: `${baseLocation}.${requirementDefinition.name}`, parentOperation, value: requirementDefinition.value })); | ||
const isApiKeySecuritySchemeInHeaderOrQuery = (scheme) => scheme.type === 'apiKey' && (scheme.in === 'header' || scheme.in === 'query'); | ||
@@ -23,0 +24,0 @@ const isHttpSecurityScheme = (scheme) => scheme.type === 'http'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toParsedSpecParameter = void 0; | ||
const isParameterSchemaUndefined = (schema) => schema === undefined; | ||
@@ -4,0 +5,0 @@ const isParameterSchemaUnsupported = (schema) => schema.type === 'object' || schema.type === 'array'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateAndDereferenceOpenApi3Spec = void 0; | ||
const swagger_mock_validator_error_impl_1 = require("../../swagger-mock-validator-error-impl"); | ||
@@ -4,0 +5,0 @@ const validate_and_dereference_spec_1 = require("../validate-and-dereference-spec"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resolveSpecFormat = void 0; | ||
const swagger_mock_validator_error_impl_1 = require("../swagger-mock-validator-error-impl"); | ||
@@ -4,0 +5,0 @@ const is_swagger2_content_1 = require("./swagger2/is-swagger2-content"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isSwagger2Content = void 0; | ||
exports.isSwagger2Content = (specContent) => specContent.hasOwnProperty('swagger'); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.swagger2Parser = void 0; | ||
const _ = require("lodash"); | ||
@@ -199,3 +200,3 @@ const create_empty_parent_operation_1 = require("../common/create-empty-parent-operation"); | ||
const credential = getCredentialKeyAndLocation(securityScheme); | ||
return Object.assign({}, credential, { location: `${securityRequirementsAndBaseLocation.baseLocation}.security[${index}].${requirementName}`, parentOperation: parsedOperation, type: securityScheme.type, value: requirement }); | ||
return Object.assign(Object.assign({}, credential), { location: `${securityRequirementsAndBaseLocation.baseLocation}.security[${index}].${requirementName}`, parentOperation: parsedOperation, type: securityScheme.type, value: requirement }); | ||
})) | ||
@@ -202,0 +203,0 @@ .value(); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -11,2 +12,3 @@ }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateAndDereferenceSwagger2Spec = void 0; | ||
const swagger_mock_validator_error_impl_1 = require("../../swagger-mock-validator-error-impl"); | ||
@@ -20,5 +22,5 @@ const validate_and_dereference_spec_1 = require("../validate-and-dereference-spec"); | ||
}; | ||
exports.validateAndDereferenceSwagger2Spec = (content, pathOrUrl) => __awaiter(this, void 0, void 0, function* () { | ||
exports.validateAndDereferenceSwagger2Spec = (content, pathOrUrl) => __awaiter(void 0, void 0, void 0, function* () { | ||
validateSpecFormat(content, pathOrUrl); | ||
return validate_and_dereference_spec_1.validateAndDereferenceSpec(content, pathOrUrl); | ||
}); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -11,5 +12,6 @@ }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateAndDereferenceSpec = void 0; | ||
const SwaggerParser = require("swagger-parser"); | ||
const swagger_mock_validator_error_impl_1 = require("../swagger-mock-validator-error-impl"); | ||
exports.validateAndDereferenceSpec = (document, pathOrUrl) => __awaiter(this, void 0, void 0, function* () { | ||
exports.validateAndDereferenceSpec = (document, pathOrUrl) => __awaiter(void 0, void 0, void 0, function* () { | ||
try { | ||
@@ -16,0 +18,0 @@ return yield SwaggerParser.validate(document, { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SwaggerMockValidatorErrorImpl = void 0; | ||
const VError = require("verror"); | ||
@@ -4,0 +5,0 @@ class SwaggerMockValidatorErrorImpl extends VError { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.transformStringToObject = void 0; | ||
const yaml = require("js-yaml"); | ||
@@ -4,0 +5,0 @@ const swagger_mock_validator_error_impl_1 = require("./swagger-mock-validator-error-impl"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UuidGenerator = void 0; | ||
const uuid = require("uuidjs"); | ||
@@ -4,0 +5,0 @@ class UuidGenerator { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateAndResolvePact = void 0; | ||
const swagger_mock_validator_error_impl_1 = require("./swagger-mock-validator-error-impl"); | ||
@@ -4,0 +5,0 @@ exports.validateAndResolvePact = (pactJson, mockPathOrUrl) => { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateSpecAndMock = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const get_parsed_spec_operation_1 = require("./validate-spec-and-mock/get-parsed-spec-operation"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isMediaTypeSupported = void 0; | ||
const PARAMETER_SEPARATOR = ';'; | ||
@@ -4,0 +5,0 @@ const WILDCARD = '*'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getParsedSpecOperation = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const result_1 = require("../result"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getParsedSpecResponse = void 0; | ||
const result_1 = require("../result"); | ||
@@ -4,0 +5,0 @@ exports.getParsedSpecResponse = (parsedMockInteraction, parsedSpecOperation) => { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toMapWithLowerCaseKeys = void 0; | ||
exports.toMapWithLowerCaseKeys = (originalMap) => Object.keys(originalMap).reduce((lowerCaseMap, originalKey) => { | ||
@@ -4,0 +5,0 @@ lowerCaseMap[originalKey.toLowerCase()] = originalMap[originalKey]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toNormalizedParsedMock = void 0; | ||
const to_map_with_lower_case_keys_1 = require("./to-map-with-lower-case-keys"); | ||
const toParsedMockInteractionWithNormalizedHeaders = (parsedMockInteraction) => (Object.assign({}, parsedMockInteraction, { requestHeaders: to_map_with_lower_case_keys_1.toMapWithLowerCaseKeys(parsedMockInteraction.requestHeaders), responseHeaders: to_map_with_lower_case_keys_1.toMapWithLowerCaseKeys(parsedMockInteraction.responseHeaders) })); | ||
exports.toNormalizedParsedMock = (parsedMock) => (Object.assign({}, parsedMock, { interactions: parsedMock.interactions.map(toParsedMockInteractionWithNormalizedHeaders) })); | ||
const toParsedMockInteractionWithNormalizedHeaders = (parsedMockInteraction) => (Object.assign(Object.assign({}, parsedMockInteraction), { requestHeaders: to_map_with_lower_case_keys_1.toMapWithLowerCaseKeys(parsedMockInteraction.requestHeaders), responseHeaders: to_map_with_lower_case_keys_1.toMapWithLowerCaseKeys(parsedMockInteraction.responseHeaders) })); | ||
exports.toNormalizedParsedMock = (parsedMock) => (Object.assign(Object.assign({}, parsedMock), { interactions: parsedMock.interactions.map(toParsedMockInteractionWithNormalizedHeaders) })); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toNormalizedParsedSpec = void 0; | ||
const to_map_with_lower_case_keys_1 = require("./to-map-with-lower-case-keys"); | ||
@@ -19,3 +20,3 @@ const operationHasPathParameters = (operation) => operation.pathNameSegments.findIndex((segment) => segment.validatorType === 'jsonSchema') > -1; | ||
const toNormalizedSecurityRequirementsInHeaders = (securityRequirements) => securityRequirements.map((requirements) => requirements.map((requirement) => requirement.credentialLocation === 'header' | ||
? Object.assign({}, requirement, { credentialKey: requirement.credentialKey.toLowerCase() }) : requirement)); | ||
? Object.assign(Object.assign({}, requirement), { credentialKey: requirement.credentialKey.toLowerCase() }) : requirement)); | ||
const toResponsesWithNormalizedHeaders = (responses) => { | ||
@@ -27,3 +28,3 @@ const modifiedResponses = Object.assign({}, responses); | ||
modifiedResponses[responsePropertyKey] = responseProperty.headers | ||
? Object.assign({}, responseProperty, { headers: to_map_with_lower_case_keys_1.toMapWithLowerCaseKeys(responseProperty.headers) }) : responseProperty; | ||
? Object.assign(Object.assign({}, responseProperty), { headers: to_map_with_lower_case_keys_1.toMapWithLowerCaseKeys(responseProperty.headers) }) : responseProperty; | ||
}); | ||
@@ -33,6 +34,6 @@ return modifiedResponses; | ||
const toNormalizedRequestHeaders = (requestHeaders) => to_map_with_lower_case_keys_1.toMapWithLowerCaseKeys(requestHeaders); | ||
const toParsedSpecOperationWithNormalizedHeaders = (parsedSpecOperation) => (Object.assign({}, parsedSpecOperation, { requestHeaderParameters: toNormalizedRequestHeaders(parsedSpecOperation.requestHeaderParameters), responses: toResponsesWithNormalizedHeaders(parsedSpecOperation.responses), securityRequirements: toNormalizedSecurityRequirementsInHeaders(parsedSpecOperation.securityRequirements) })); | ||
const toParsedSpecOperationWithNormalizedHeaders = (parsedSpecOperation) => (Object.assign(Object.assign({}, parsedSpecOperation), { requestHeaderParameters: toNormalizedRequestHeaders(parsedSpecOperation.requestHeaderParameters), responses: toResponsesWithNormalizedHeaders(parsedSpecOperation.responses), securityRequirements: toNormalizedSecurityRequirementsInHeaders(parsedSpecOperation.securityRequirements) })); | ||
const toNormalizedParsedSpecOperations = (operations) => operations | ||
.map(toParsedSpecOperationWithNormalizedHeaders) | ||
.sort(operationComparator); | ||
exports.toNormalizedParsedSpec = (parsedSpec) => (Object.assign({}, parsedSpec, { operations: toNormalizedParsedSpecOperations(parsedSpec.operations) })); | ||
exports.toNormalizedParsedSpec = (parsedSpec) => (Object.assign(Object.assign({}, parsedSpec), { operations: toNormalizedParsedSpecOperations(parsedSpec.operations) })); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateJson = void 0; | ||
const Ajv = require("ajv"); | ||
@@ -4,0 +5,0 @@ const _ = require("lodash"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isBinary = void 0; | ||
exports.isBinary = () => true; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isByte = void 0; | ||
const validator_1 = require("validator"); | ||
exports.isByte = (rawValue) => { | ||
return validator_1.isBase64(rawValue); | ||
return validator_1.default.isBase64(rawValue); | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isDouble = exports.formatForDoubleNumbers = exports.doubleAjvKeyword = void 0; | ||
const decimal_js_1 = require("decimal.js"); | ||
const is_type_supported_1 = require("./is-type-supported"); | ||
exports.doubleAjvKeyword = 'formatDouble'; | ||
exports.formatForDoubleNumbers = (schema) => { | ||
if (schema.type === 'number' && schema.format === 'double') { | ||
if (is_type_supported_1.isTypeSupported('number', schema.type) && schema.format === 'double') { | ||
delete schema.format; | ||
@@ -8,0 +10,0 @@ schema[exports.doubleAjvKeyword] = true; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isFloat = exports.formatForFloatNumbers = exports.floatAjvKeyword = void 0; | ||
const decimal_js_1 = require("decimal.js"); | ||
const is_type_supported_1 = require("./is-type-supported"); | ||
const maximumFloatPrecision = 6; | ||
exports.floatAjvKeyword = 'formatFloat'; | ||
exports.formatForFloatNumbers = (schema) => { | ||
if (schema.type === 'number' && schema.format === 'float') { | ||
if (is_type_supported_1.isTypeSupported('number', schema.type) && schema.format === 'float') { | ||
delete schema.format; | ||
@@ -9,0 +11,0 @@ schema[exports.floatAjvKeyword] = true; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isInt32 = exports.formatForInt32Numbers = exports.int32AjvKeyword = void 0; | ||
const decimal_js_1 = require("decimal.js"); | ||
const is_type_supported_1 = require("./is-type-supported"); | ||
const int32MinValue = decimal_js_1.Decimal.pow(2, 31).negated(); | ||
@@ -8,3 +10,3 @@ const int32MaxValue = decimal_js_1.Decimal.pow(2, 31).minus(1); | ||
exports.formatForInt32Numbers = (schema) => { | ||
if (schema.type === 'integer' && schema.format === 'int32') { | ||
if (is_type_supported_1.isTypeSupported('integer', schema.type) && schema.format === 'int32') { | ||
delete schema.format; | ||
@@ -11,0 +13,0 @@ schema[exports.int32AjvKeyword] = true; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isInt64 = exports.formatForInt64Numbers = exports.int64AjvKeyword = void 0; | ||
const decimal_js_1 = require("decimal.js"); | ||
const is_type_supported_1 = require("./is-type-supported"); | ||
const int64MinValue = decimal_js_1.Decimal.pow(2, 63).negated(); | ||
@@ -8,3 +10,3 @@ const int64MaxValue = decimal_js_1.Decimal.pow(2, 63).minus(1); | ||
exports.formatForInt64Numbers = (schema) => { | ||
if (schema.type === 'integer' && schema.format === 'int64') { | ||
if (is_type_supported_1.isTypeSupported('integer', schema.type) && schema.format === 'int64') { | ||
delete schema.format; | ||
@@ -11,0 +13,0 @@ schema[exports.int64AjvKeyword] = true; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isPassword = void 0; | ||
exports.isPassword = () => true; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateMockValueAgainstSpec = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const util_1 = require("util"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateParsedMockRequestBody = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const result_1 = require("../result"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateParsedMockRequestHeaders = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const result_1 = require("../result"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateParsedMockRequestQuery = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const result_1 = require("../result"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateParsedMockResponseBody = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const traverse_json_schema_1 = require("../common/traverse-json-schema"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateParsedMockResponseHeaders = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const result_1 = require("../result"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateParsedSpecConsumes = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const result_1 = require("../result"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateParsedSpecProduces = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const result_1 = require("../result"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateParsedSpecSecurity = void 0; | ||
const _ = require("lodash"); | ||
@@ -4,0 +5,0 @@ const result_1 = require("../result"); |
@@ -16,3 +16,3 @@ export interface ParsedMock { | ||
requestPath: ParsedMockValue<string>; | ||
requestPathSegments: Array<ParsedMockValue<string>>; | ||
requestPathSegments: ParsedMockValue<string>[]; | ||
requestQuery: ParsedMockValueCollection; | ||
@@ -19,0 +19,0 @@ responseBody: ParsedMockValue<any>; |
import {parsePathNameSegments} from '../../common/parse-path-name-segments'; | ||
import {ParsedSpecOperation} from '../../parsed-spec'; | ||
import {Openapi3Schema, Operation, Parameter, Reference} from '../openapi3'; | ||
import {Openapi3Schema, Operation, ParameterOrReference} from '../openapi3'; | ||
import {parseParameters} from './parse-parameters'; | ||
@@ -15,3 +15,3 @@ import {getParsedRequestBodyValues} from './parse-request-body'; | ||
pathLocation: string; | ||
pathItemParameters: Array<Parameter | Reference> | undefined; | ||
pathItemParameters: ParameterOrReference[] | undefined; | ||
spec: Openapi3Schema; | ||
@@ -18,0 +18,0 @@ specPathOrUrl: string; |
@@ -12,2 +12,4 @@ import { | ||
type ParameterOrReference = Parameter | Reference; | ||
interface ParsedParameters { | ||
@@ -20,4 +22,4 @@ query: ParsedSpecParameterCollection; | ||
interface ParseParametersOptions { | ||
pathItemParameters: Array<Parameter | Reference> | undefined; | ||
operationParameters: Array<Parameter | Reference> | undefined; | ||
pathItemParameters: ParameterOrReference[] | undefined; | ||
operationParameters: ParameterOrReference[] | undefined; | ||
parentOperation: ParsedSpecOperation; | ||
@@ -39,3 +41,3 @@ spec: Openapi3Schema; | ||
const toParsedSpecParameters = ( | ||
parameters: Array<Parameter | Reference>, | ||
parameters: ParameterOrReference[], | ||
parentOperation: ParsedSpecOperation, | ||
@@ -52,3 +54,3 @@ spec: Openapi3Schema | ||
const doParseParameters = ( | ||
parameters: Array<Parameter | Reference>, | ||
parameters: ParameterOrReference[], | ||
parentOperation: ParsedSpecOperation, | ||
@@ -70,3 +72,3 @@ spec: Openapi3Schema | ||
const toParsedParameters = ( | ||
parameters: Array<Parameter | Reference> | undefined, | ||
parameters: ParameterOrReference[] | undefined, | ||
parentOperation: ParsedSpecOperation, | ||
@@ -73,0 +75,0 @@ spec: Openapi3Schema |
@@ -33,2 +33,6 @@ /** | ||
export type ParameterOrReference = Parameter | Reference; | ||
type SchemaOrReference = Schema | Reference; | ||
type Openapi3CustomFormat = 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | | ||
@@ -152,3 +156,3 @@ 'password'; | ||
servers?: Server[]; | ||
parameters?: Array<Parameter | Reference>; | ||
parameters?: ParameterOrReference[]; | ||
/** | ||
@@ -166,3 +170,3 @@ * This interface was referenced by `PathItem`'s JSON-Schema definition | ||
operationId?: string; | ||
parameters?: Array<Parameter | Reference>; | ||
parameters?: ParameterOrReference[]; | ||
requestBody?: RequestBody | Reference; | ||
@@ -192,3 +196,3 @@ responses: Responses; | ||
allowReserved?: boolean; | ||
schema: Schema | Reference; | ||
schema: SchemaOrReference; | ||
example?: any; | ||
@@ -219,11 +223,11 @@ /** | ||
type?: 'array' | 'boolean' | 'integer' | 'number' | 'object' | 'string'; | ||
not?: Schema | Reference; | ||
allOf?: Array<Schema | Reference>; | ||
oneOf?: Array<Schema | Reference>; | ||
anyOf?: Array<Schema | Reference>; | ||
items?: Schema | Reference; | ||
not?: SchemaOrReference; | ||
allOf?: SchemaOrReference[]; | ||
oneOf?: SchemaOrReference[]; | ||
anyOf?: SchemaOrReference[]; | ||
items?: SchemaOrReference; | ||
properties?: { | ||
[k: string]: Schema | Reference; | ||
[k: string]: SchemaOrReference; | ||
}; | ||
additionalProperties?: Schema | Reference | boolean; | ||
additionalProperties?: SchemaOrReference | boolean; | ||
description?: string; | ||
@@ -279,3 +283,3 @@ format?: Format; | ||
allowReserved?: boolean; | ||
schema: Schema | Reference; | ||
schema: SchemaOrReference; | ||
example?: any; | ||
@@ -298,3 +302,3 @@ /** | ||
allowReserved?: boolean; | ||
schema: Schema | Reference; | ||
schema: SchemaOrReference; | ||
example?: any; | ||
@@ -317,3 +321,3 @@ /** | ||
allowReserved?: boolean; | ||
schema: Schema | Reference; | ||
schema: SchemaOrReference; | ||
example?: any; | ||
@@ -336,3 +340,3 @@ /** | ||
allowReserved?: boolean; | ||
schema: Schema | Reference; | ||
schema: SchemaOrReference; | ||
examples: { | ||
@@ -368,3 +372,3 @@ [k: string]: Example | Reference; | ||
allowReserved?: boolean; | ||
schema: Schema | Reference; | ||
schema: SchemaOrReference; | ||
examples: { | ||
@@ -389,3 +393,3 @@ [k: string]: Example | Reference; | ||
allowReserved?: boolean; | ||
schema: Schema | Reference; | ||
schema: SchemaOrReference; | ||
examples: { | ||
@@ -410,3 +414,3 @@ [k: string]: Example | Reference; | ||
allowReserved?: boolean; | ||
schema: Schema | Reference; | ||
schema: SchemaOrReference; | ||
examples: { | ||
@@ -438,3 +442,3 @@ [k: string]: Example | Reference; | ||
export interface MediaTypeWithExample { | ||
schema?: Schema | Reference; | ||
schema?: SchemaOrReference; | ||
example?: any; | ||
@@ -467,3 +471,3 @@ encoding?: { | ||
allowReserved?: boolean; | ||
schema: Schema | Reference; | ||
schema: SchemaOrReference; | ||
example?: any; | ||
@@ -484,3 +488,3 @@ /** | ||
allowReserved?: boolean; | ||
schema: Schema | Reference; | ||
schema: SchemaOrReference; | ||
examples: { | ||
@@ -510,3 +514,3 @@ [k: string]: Example | Reference; | ||
export interface MediaTypeWithExamples { | ||
schema?: Schema | Reference; | ||
schema?: SchemaOrReference; | ||
examples: { | ||
@@ -513,0 +517,0 @@ [k: string]: Example | Reference; |
@@ -56,4 +56,4 @@ import * as _ from 'lodash'; | ||
const mergePathAndOperationParameters = ( | ||
pathParameters: Array<ParsedSpecValue<Swagger2Parameter>>, | ||
operationParameters: Array<ParsedSpecValue<Swagger2Parameter>> | ||
pathParameters: ParsedSpecValue<Swagger2Parameter>[], | ||
operationParameters: ParsedSpecValue<Swagger2Parameter>[] | ||
) => { | ||
@@ -183,3 +183,3 @@ const mergedParameters = _.clone(pathParameters); | ||
const toRequestBodyParameter = ( | ||
parameters: Array<ParsedSpecValue<Swagger2Parameter>>, | ||
parameters: ParsedSpecValue<Swagger2Parameter>[], | ||
definitions?: Swagger2JsonSchemaDefinitions | ||
@@ -211,3 +211,3 @@ ): ParsedSpecBody | undefined => | ||
inValue: 'header' | 'path' | 'query', | ||
parameters: Array<ParsedSpecValue<Swagger2Parameter>> | ||
parameters: ParsedSpecValue<Swagger2Parameter>[] | ||
): ParsedSpecParameter[] => | ||
@@ -392,3 +392,3 @@ _(parameters) | ||
) | ||
.flatten<ParsedSpecOperation>() | ||
.flatten() | ||
.value(), | ||
@@ -395,0 +395,0 @@ pathOrUrl: specPathOrUrl, |
@@ -33,3 +33,3 @@ import * as yaml from 'js-yaml'; | ||
return parsedYaml; | ||
return parsedYaml as any; | ||
}; | ||
@@ -36,0 +36,0 @@ |
@@ -85,3 +85,3 @@ import * as _ from 'lodash'; | ||
.map((parsedMockInteraction) => validateMockInteraction(parsedMockInteraction, normalizedParsedSpec)) | ||
.flatten<ValidationResult>() | ||
.flatten() | ||
.value(); | ||
@@ -88,0 +88,0 @@ |
@@ -1,5 +0,5 @@ | ||
import {isBase64} from 'validator'; | ||
import validator from 'validator'; | ||
export const isByte = (rawValue: string) => { | ||
return isBase64(rawValue); | ||
return validator.isBase64(rawValue); | ||
}; |
import {Decimal} from 'decimal.js'; | ||
import {ParsedSpecJsonSchemaValue} from '../../spec-parser/parsed-spec'; | ||
import {isTypeSupported} from './is-type-supported'; | ||
@@ -7,3 +8,3 @@ export const doubleAjvKeyword = 'formatDouble'; | ||
export const formatForDoubleNumbers = (schema: ParsedSpecJsonSchemaValue) => { | ||
if (schema.type === 'number' && schema.format as any === 'double') { | ||
if (isTypeSupported('number', schema.type) && schema.format as any === 'double') { | ||
delete schema.format; | ||
@@ -10,0 +11,0 @@ (schema as any)[doubleAjvKeyword] = true; |
import {Decimal} from 'decimal.js'; | ||
import {ParsedSpecJsonSchemaValue} from '../../spec-parser/parsed-spec'; | ||
import {isTypeSupported} from './is-type-supported'; | ||
@@ -9,3 +10,3 @@ const maximumFloatPrecision = 6; | ||
export const formatForFloatNumbers = (schema: ParsedSpecJsonSchemaValue) => { | ||
if (schema.type === 'number' && schema.format as any === 'float') { | ||
if (isTypeSupported('number', schema.type) && schema.format as any === 'float') { | ||
delete schema.format; | ||
@@ -12,0 +13,0 @@ (schema as any)[floatAjvKeyword] = true; |
import {Decimal} from 'decimal.js'; | ||
import {ParsedSpecJsonSchemaValue} from '../../spec-parser/parsed-spec'; | ||
import {isTypeSupported} from './is-type-supported'; | ||
@@ -10,3 +11,3 @@ const int32MinValue = Decimal.pow(2, 31).negated(); | ||
export const formatForInt32Numbers = (schema: ParsedSpecJsonSchemaValue) => { | ||
if (schema.type === 'integer' && schema.format as any === 'int32') { | ||
if (isTypeSupported('integer', schema.type) && schema.format as any === 'int32') { | ||
delete schema.format; | ||
@@ -13,0 +14,0 @@ (schema as any)[int32AjvKeyword] = true; |
import {Decimal} from 'decimal.js'; | ||
import {ParsedSpecJsonSchemaValue} from '../../spec-parser/parsed-spec'; | ||
import {isTypeSupported} from './is-type-supported'; | ||
@@ -10,3 +11,3 @@ const int64MinValue = Decimal.pow(2, 63).negated(); | ||
export const formatForInt64Numbers = (schema: ParsedSpecJsonSchemaValue) => { | ||
if (schema.type === 'integer' && schema.format as any === 'int64') { | ||
if (isTypeSupported('integer', schema.type) && schema.format as any === 'int64') { | ||
delete schema.format; | ||
@@ -13,0 +14,0 @@ (schema as any)[int64AjvKeyword] = true; |
{ | ||
"name": "swagger-mock-validator", | ||
"version": "9.0.0", | ||
"version": "10.0.0", | ||
"description": "A CLI tool to validate mocks against swagger/OpenApi specs.", | ||
@@ -31,3 +31,2 @@ "bin": { | ||
"@types/body-parser": "^1.16.0", | ||
"@types/commander": "^2.3.31", | ||
"@types/express": "^4.0.34", | ||
@@ -37,12 +36,11 @@ "@types/jasmine": "^3.3.12", | ||
"@types/lodash": "^4.14.126", | ||
"@types/node": "^12.0.0", | ||
"@types/node": "^14.14.2", | ||
"@types/q": "^1.0.0", | ||
"@types/request": "^2.0.3", | ||
"@types/uuidjs": "^3.3.1", | ||
"@types/validator": "^10.11.0", | ||
"@types/validator": "^13.1.0", | ||
"@types/verror": "^1.9.0", | ||
"ansi-colors": "^3.2.4", | ||
"ansi-colors": "^4.1.1", | ||
"body-parser": "^1.18.3", | ||
"conventional-changelog": "^1.1.3", | ||
"conventional-changelog-lint": "^1.1.0", | ||
"conventional-changelog": "^3.1.23", | ||
"conventional-changelog-lint": "^2.1.1", | ||
"express": "^4.16.3", | ||
@@ -54,3 +52,3 @@ "gulp": "^4.0.2", | ||
"gulp-conventional-changelog": "^2.0.19", | ||
"gulp-filter": "^5.1.0", | ||
"gulp-filter": "^6.0.0", | ||
"gulp-git": "^2.7.0", | ||
@@ -62,8 +60,8 @@ "gulp-jasmine": "^4.0.0", | ||
"minimist": "^1.2.0", | ||
"tslint": "^5.11.0", | ||
"typescript": "^2.9.2" | ||
"tslint": "^6.1.3", | ||
"typescript": "^4.0.3" | ||
}, | ||
"dependencies": { | ||
"ajv": "^6.10.0", | ||
"commander": "^2.16.0", | ||
"commander": "^6.1.0", | ||
"decimal.js": "^10.2.0", | ||
@@ -73,6 +71,7 @@ "js-yaml": "^3.12.0", | ||
"lodash": "^4.17.10", | ||
"openapi-types": "^7.0.1", | ||
"request": "^2.87.0", | ||
"swagger-parser": "5.0.2", | ||
"swagger-parser": "^10.0.2", | ||
"uuidjs": "^4.0.3", | ||
"validator": "^10.11.0", | ||
"validator": "^13.1.17", | ||
"verror": "^1.8.1" | ||
@@ -79,0 +78,0 @@ }, |
@@ -63,3 +63,3 @@ import * as bodyParser from 'body-parser'; | ||
let mockPactBroker: jasmine.SpyObj<{ get: (requestHeaders: object, requestUrl: string) => void }>; | ||
let mockAnalytics: jasmine.SpyObj<{ post: (body: string) => void }>; | ||
let mockAnalytics: jasmine.SpyObj<{ post: (body: object) => void }>; | ||
@@ -66,0 +66,0 @@ beforeAll((done) => { |
@@ -60,3 +60,7 @@ import * as _ from 'lodash'; | ||
const pass = options.utilities.equals(actualProperty, expectedProperty, options.customEqualityTesters); | ||
const pass = options.utilities.equals( | ||
actualProperty, | ||
expectedProperty, | ||
options.customEqualityTesters as CustomEqualityTester[] | ||
); | ||
@@ -63,0 +67,0 @@ const message = pass |
@@ -23,3 +23,3 @@ import {cloneDeep} from 'lodash'; | ||
const parameterWithContent = setValueOn(parameter, 'content', contentBuilder.build()); | ||
delete parameterWithContent.schema; | ||
delete (parameterWithContent as Partial<OpenApi3Parameter>).schema; | ||
return createOpenApi3ParameterBuilder(parameterWithContent); | ||
@@ -26,0 +26,0 @@ }, |
@@ -18,3 +18,3 @@ import {cloneDeep} from 'lodash'; | ||
const parameterWithContent = setValueOn(header, 'content', contentBuilder.build()); | ||
delete parameterWithContent.schema; | ||
delete (parameterWithContent as Partial<OpenApi3ResponseHeader>).schema; | ||
return createOpenApi3ResponseHeaderBuilder(parameterWithContent); | ||
@@ -21,0 +21,0 @@ }, |
@@ -14,3 +14,6 @@ import {cloneDeep} from 'lodash'; | ||
setValueOn(openApi3Schema, `anyOf`, schemaBuilders.map((builder) => builder.build()))), | ||
withFormatDouble: () => createOpenApi3SchemaBuilder(setValueOn(openApi3Schema, 'format', 'double')), | ||
withFormatFloat: () => createOpenApi3SchemaBuilder(setValueOn(openApi3Schema, 'format', 'float')), | ||
withFormatInt32: () => createOpenApi3SchemaBuilder(setValueOn(openApi3Schema, 'format', 'int32')), | ||
withFormatInt64: () => createOpenApi3SchemaBuilder(setValueOn(openApi3Schema, 'format', 'int64')), | ||
withItems: (items: OpenApi3SchemaBuilder) => | ||
@@ -17,0 +20,0 @@ createOpenApi3SchemaBuilder(setValueOn(openApi3Schema, 'items', items.build())), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
883289
29
223
18041
12
+ Addedopenapi-types@^7.0.1
+ Added@apidevtools/json-schema-ref-parser@9.1.2(transitive)
+ Added@apidevtools/openapi-schemas@2.1.0(transitive)
+ Added@apidevtools/swagger-methods@3.0.2(transitive)
+ Added@apidevtools/swagger-parser@10.0.3(transitive)
+ Added@jsdevtools/ono@7.1.3(transitive)
+ Added@types/json-schema@7.0.15(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedcommander@10.0.16.2.1(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedopenapi-types@7.2.3(transitive)
+ Addedswagger-parser@10.0.3(transitive)
+ Addedvalidator@13.12.0(transitive)
+ Addedz-schema@5.0.6(transitive)
- Removedcommander@2.20.3(transitive)
- Removedcore-js@2.6.12(transitive)
- Removeddebug@3.2.7(transitive)
- Removedformat-util@1.0.5(transitive)
- Removedjson-schema-ref-parser@5.1.3(transitive)
- Removedjsonschema@1.2.4(transitive)
- Removedjsonschema-draft4@1.0.0(transitive)
- Removedms@2.1.3(transitive)
- Removedono@4.0.11(transitive)
- Removedopenapi-schema-validation@0.4.2(transitive)
- Removedswagger-methods@1.0.8(transitive)
- Removedswagger-parser@5.0.2(transitive)
- Removedswagger-schema-official@2.0.0-bab6bed(transitive)
- Removedvalidator@10.11.0(transitive)
- Removedz-schema@3.25.1(transitive)
Updatedcommander@^6.1.0
Updatedswagger-parser@^10.0.2
Updatedvalidator@^13.1.17