@readme/openapi-parser
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -97,3 +97,3 @@ /* eslint-disable no-unused-vars */ | ||
`Unsupported OpenAPI version: ${schema.openapi}. ` + | ||
`Swagger Parser only supports versions ${supportedVersions.join(', ')}` | ||
`Swagger Parser only supports versions ${supportedVersions.join(', ')}`, | ||
); | ||
@@ -100,0 +100,0 @@ } |
@@ -71,2 +71,3 @@ const { openapi } = require('@apidevtools/openapi-schemas'); | ||
let reducedErrors = reduceAjvErrors(err); | ||
const totalErrors = reducedErrors.length; | ||
if (reducedErrors.length >= LARGE_SPEC_ERROR_CAP) { | ||
@@ -96,3 +97,3 @@ try { | ||
throw ono.syntax(err, { details: err }, message); | ||
throw ono.syntax(err, { details: err, totalErrors }, message); | ||
} | ||
@@ -99,0 +100,0 @@ } |
@@ -43,3 +43,3 @@ const swaggerMethods = require('@apidevtools/swagger-methods'); | ||
throw ono.syntax( | ||
`Validation failed. ${componentId} has an invalid name. Component names should match against: /^[a-zA-Z0-9.-_]+$/` | ||
`Validation failed. ${componentId} has an invalid name. Component names should match against: /^[a-zA-Z0-9.-_]+$/`, | ||
); | ||
@@ -150,3 +150,3 @@ } | ||
'Validation failed. Path parameters cannot be optional. ' + | ||
`Set required=true for the "${param.name}" parameter at ${operationId}` | ||
`Set required=true for the "${param.name}" parameter at ${operationId}`, | ||
); | ||
@@ -159,3 +159,3 @@ } | ||
`Validation failed. ${operationId} has a path parameter named "${param.name}", ` + | ||
`but there is no corresponding {${param.name}} in the path string` | ||
`but there is no corresponding {${param.name}} in the path string`, | ||
); | ||
@@ -162,0 +162,0 @@ } |
@@ -33,3 +33,3 @@ const swaggerMethods = require('@apidevtools/swagger-methods'); | ||
throw ono.syntax( | ||
`Validation failed. ${definitionId} has an invalid name. Definition names should match against: /^[a-zA-Z0-9.-_]+$/` | ||
`Validation failed. ${definitionId} has an invalid name. Definition names should match against: /^[a-zA-Z0-9.-_]+$/`, | ||
); | ||
@@ -136,3 +136,3 @@ } | ||
throw ono.syntax( | ||
`Validation failed. ${operationId} has ${bodyParams.length} body parameters. Only one is allowed.` | ||
`Validation failed. ${operationId} has ${bodyParams.length} body parameters. Only one is allowed.`, | ||
); | ||
@@ -142,3 +142,3 @@ } else if (bodyParams.length > 0 && formParams.length > 0) { | ||
throw ono.syntax( | ||
`Validation failed. ${operationId} has body parameters and formData parameters. Only one or the other is allowed.` | ||
`Validation failed. ${operationId} has body parameters and formData parameters. Only one or the other is allowed.`, | ||
); | ||
@@ -174,3 +174,3 @@ } | ||
'Validation failed. Path parameters cannot be optional. ' + | ||
`Set required=true for the "${param.name}" parameter at ${operationId}` | ||
`Set required=true for the "${param.name}" parameter at ${operationId}`, | ||
); | ||
@@ -183,3 +183,3 @@ } | ||
`Validation failed. ${operationId} has a path parameter named "${param.name}", ` + | ||
`but there is no corresponding {${param.name}} in the path string` | ||
`but there is no corresponding {${param.name}} in the path string`, | ||
); | ||
@@ -229,4 +229,4 @@ } | ||
// "file" params must consume at least one of these MIME types | ||
const formData = /multipart\/(.*\+)?form-data/; // eslint-disable-line unicorn/no-unsafe-regex | ||
const urlEncoded = /application\/(.*\+)?x-www-form-urlencoded/; // eslint-disable-line unicorn/no-unsafe-regex | ||
const formData = /multipart\/(.*\+)?form-data/; | ||
const urlEncoded = /application\/(.*\+)?x-www-form-urlencoded/; | ||
@@ -242,3 +242,3 @@ const consumes = operation.consumes || api.consumes || []; | ||
`Validation failed. ${operationId} has a file parameter, so it must consume multipart/form-data ` + | ||
'or application/x-www-form-urlencoded' | ||
'or application/x-www-form-urlencoded', | ||
); | ||
@@ -289,3 +289,3 @@ } | ||
throw ono.syntax( | ||
`Validation failed. ${responseId} has an invalid response schema type (${response.schema.type})` | ||
`Validation failed. ${responseId} has an invalid response schema type (${response.schema.type})`, | ||
); | ||
@@ -347,3 +347,3 @@ } else { | ||
throw ono.syntax( | ||
`Validation failed. Property '${requiredProperty}' listed as required but does not exist in '${schemaId}'` | ||
`Validation failed. Property '${requiredProperty}' listed as required but does not exist in '${schemaId}'`, | ||
); | ||
@@ -350,0 +350,0 @@ } |
{ | ||
"name": "@readme/openapi-parser", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "Swagger 2.0 and OpenAPI 3.x parser and validator for Node and browsers", | ||
@@ -38,14 +38,10 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=14" | ||
"node": ">=18" | ||
}, | ||
"scripts": { | ||
"clean": "shx rm -rf .nyc_output coverage", | ||
"coverage": "npm run coverage:node && npm run coverage:browser", | ||
"coverage:browser": "npm run test:browser -- --coverage", | ||
"coverage:node": "nyc mocha", | ||
"clean": "rm -rf .nyc_output coverage", | ||
"coverage": "nyc mocha", | ||
"lint": "eslint .", | ||
"prepare": "husky install", | ||
"pretest": "npm run lint", | ||
"test": "npm run test:node && npm run test:typescript", | ||
"test:browser": "karma start --single-run", | ||
"test:node": "mocha", | ||
@@ -56,21 +52,13 @@ "test:typescript": "tsc --noEmit --strict --lib esnext,dom test/specs/typescript-definition.spec.ts" | ||
"@babel/polyfill": "^7.12.1", | ||
"@commitlint/cli": "^17.5.0", | ||
"@commitlint/config-conventional": "^17.4.2", | ||
"@jsdevtools/host-environment": "^2.1.2", | ||
"@jsdevtools/karma-config": "^3.1.7", | ||
"@readme/eslint-config": "^10.5.1", | ||
"@types/node": "^18.15.10", | ||
"chai": "^4.3.7", | ||
"eslint": "^8.36.0", | ||
"husky": "^8.0.3", | ||
"karma": "^6.3.4", | ||
"karma-cli": "^2.0.0", | ||
"@readme/eslint-config": "^14.0.0", | ||
"@types/node": "^20.12.7", | ||
"chai": "^4.3.8", | ||
"eslint": "^8.56.0", | ||
"mocha": "^10.2.0", | ||
"node-fetch": "^2.6.1", | ||
"nyc": "^15.1.0", | ||
"openapi-types": "^12.1.0", | ||
"prettier": "^2.8.7", | ||
"shx": "^0.3.2", | ||
"sinon": "^15.0.3", | ||
"typescript": "^4.9.5" | ||
"openapi-types": "^12.1.3", | ||
"prettier": "^3.1.1", | ||
"sinon": "^17.0.0", | ||
"typescript": "^5.4.5" | ||
}, | ||
@@ -77,0 +65,0 @@ "dependencies": { |
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
12
1378
77946