ibm-etag-header crashes linter on incorrect specification
Closed this issue ยท 4 comments
Hello,
I'm using the latest version of openapi-validator (IBM OpenAPI Validator (validator: 1.2.0; ruleset: 1.2.0)).
On invalid specification
openapi: 3.0.3
paths:
/test:
get:
operationId: ruleBug
parameters:
- $ref: '#/components/schemas/NotAParameter'
responses:
'204':
description: No content
components:
schemas:
NotAParameter:
type: string
rule ibm-etag-header
crashes whole linter:
[ERROR] There was a problem with spectral.
[ERROR] Error running Nimma
[ERROR] Additional error details:
[ERROR] AggregateError: Error running Nimma
at Scope.destroy (/opt/linters/node_modules/nimma/dist/legacy/cjs/runtime/scope.js:137:13)
at Nimma.eval (eval at query (/opt/linters/node_modules/nimma/dist/legacy/cjs/core/index.js:66:71), <anonymous>:182:11)
at Nimma.query (/opt/linters/node_modules/nimma/dist/legacy/cjs/core/index.js:68:71)
at execute (/opt/linters/node_modules/@stoplight/spectral-core/dist/runner/runner.js:82:11)
at Runner.run (/opt/linters/node_modules/@stoplight/spectral-core/dist/runner/runner.js:51:13)
at Spectral.runWithResolved (/opt/linters/node_modules/@stoplight/spectral-core/dist/spectral.js:55:22)
at async Spectral.run (/opt/linters/node_modules/@stoplight/spectral-core/dist/spectral.js:63:17)
at async runSpectral (/opt/linters/node_modules/ibm-openapi-validator/src/spectral/spectral-validator.js:39:27)
at async runValidator (/opt/linters/node_modules/ibm-openapi-validator/src/cli-validator/run-validator.js:201:17) {
[errors]: [
RuntimeError: $.paths[*] threw: ErrorWithCause("Function \"\" threw an exception: Cannot read properties of undefined (reading 'toLowerCase')")
at _callbacks.<computed> (/opt/linters/node_modules/nimma/dist/legacy/cjs/runtime/proxy-callbacks.js:34:21)
at Scope.emit (/opt/linters/node_modules/nimma/dist/legacy/cjs/runtime/scope.js:109:19)
... 4 lines matching cause stack trace ...
at _traverseBody (/opt/linters/node_modules/nimma/dist/legacy/cjs/runtime/traverse.js:17:5)
at _traverse (/opt/linters/node_modules/nimma/dist/legacy/cjs/runtime/traverse.js:41:7)
at Scope.traverse (/opt/linters/node_modules/nimma/dist/legacy/cjs/runtime/traverse.js:47:3)
at Scope.traverse (/opt/linters/node_modules/nimma/dist/legacy/cjs/runtime/scope.js:94:25) {
cause: [ErrorWithCause]
}
]
}
Side issue โ I wonder if it would be possible to output better error message containing rule name and perhaps rule input? I have bunch of rules specific to my projects, and it can be time-consuming to figure out which rule has error.
@fenuks thanks for the issue - I'll debug this today
I wonder if it would be possible to output better error message containing rule name and perhaps rule input
I agree, the current error output is not super helpful. I've been wanting to address that. I'll look into making an improvement there alongside the rule fix
๐ This issue has been resolved in version 1.4.1 ๐
The release is available on npm package (@latest dist-tag)
Your semantic-release bot ๐ฆ๐
๐ This issue has been resolved in version 1.4.1 ๐
The release is available on npm package (@latest dist-tag)
Your semantic-release bot ๐ฆ๐
๐ This issue has been resolved in version 1.2.1 ๐
The release is available on npm package (@latest dist-tag)
Your semantic-release bot ๐ฆ๐