Closed rolivares closed 2 weeks ago
I'm getting the same error using the following command:
lint-openapi -v -j -p --debug 'D:\temp\my-openapi-spec.json'
Output:
[Warning] Skipping non-existent file: D:\temp\my-openapi-spec.json
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Object.json-schema-validation (eval at exports.evaluateExport (C:\Users\aleco\AppData\Roaming\npm\node_modules\ibm-openapi-validator\node_modules\@stoplight\spectral\dist\rulesets\evaluators.js:89:80), <anonymous>:12:27)
at Object.exports.lintNode (C:\Users\aleco\AppData\Roaming\npm\node_modules\ibm-openapi-validator\node_modules\@stoplight\spectral\dist\runner\lintNode.js:30:33)
at callback (C:\Users\aleco\AppData\Roaming\npm\node_modules\ibm-openapi-validator\node_modules\@stoplight\spectral\dist\runner\runner.js:38:32)
at JSONPath._handleCallback (C:\Users\aleco\AppData\Roaming\npm\node_modules\ibm-openapi-validator\node_modules\jsonpath-plus\dist\index-umd.js:626:7)
at JSONPath._trace (C:\Users\aleco\AppData\Roaming\npm\node_modules\ibm-openapi-validator\node_modules\jsonpath-plus\dist\index-umd.js:658:12)
at JSONPath._trace (C:\Users\aleco\AppData\Roaming\npm\node_modules\ibm-openapi-validator\node_modules\jsonpath-plus\dist\index-umd.js:733:19)
at JSONPath.evaluate (C:\Users\aleco\AppData\Roaming\npm\node_modules\ibm-openapi-validator\node_modules\jsonpath-plus\dist\index-umd.js:566:23)
at new JSONPath (C:\Users\aleco\AppData\Roaming\npm\node_modules\ibm-openapi-validator\node_modules\jsonpath-plus\dist\index-umd.js:498:22)
at Object.JSONPath (C:\Users\aleco\AppData\Roaming\npm\node_modules\ibm-openapi-validator\node_modules\jsonpath-plus\dist\index-umd.js:452:16)
{
"version": "0.40.1",
"warnings": [
{
"path": [],
"message": "OpenAPI `servers` must be present and non-empty array.",
"rule": "oas3-api-servers",
"line": 0
},
{
"path": [],
"message": "OpenAPI object should have non-empty `tags` array.",
"rule": "openapi-tags",
"line": 0
},
...
Worth mentioning:
Environment info
{
npm: '7.9.0',
node: '15.13.0',
v8: '8.6.395.17-node.28',
uv: '1.41.0',
zlib: '1.2.11',
brotli: '1.0.9',
ares: '1.17.1',
modules: '88',
nghttp2: '1.42.0',
napi: '8',
llhttp: '2.1.3',
openssl: '1.1.1j+quic',
cldr: '38.1',
icu: '68.2',
tz: '2020d',
unicode: '13.0',
ngtcp2: '0.1.0-DEV',
nghttp3: '0.1.0-DEV'
}
This seems to be a Windows-specific issue with the tool. Is this still happening on the latest version?
@rolivares @alecor191
Closing due to inactivity
this error is shown on console when I upgrade to v0.40 and execute the linter, is not currently appearing on 0.39
maybe related about 'response-error-response-schema' that appearing on revision too, using the same definition
SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at Object.json-schema-validation (eval at exports.evaluateExport (C:\GIT\MTT\bono\back\node_modules\@stoplight\spectral\dist\rulesets\evaluators.js:89:80), <anonymous>:12:27) at Object.exports.lintNode (C:\GIT\MTT\bono\back\node_modules\@stoplight\spectral\dist\runner\lintNode.js:30:33) at callback (C:\GIT\MTT\bono\back\node_modules\@stoplight\spectral\dist\runner\runner.js:38:32) at JSONPath._handleCallback (C:\GIT\MTT\bono\back\node_modules\jsonpath-plus\dist\index-umd.js:626:7) at JSONPath._trace (C:\GIT\MTT\bono\back\node_modules\jsonpath-plus\dist\index-umd.js:658:12) at JSONPath._trace (C:\GIT\MTT\bono\back\node_modules\jsonpath-plus\dist\index-umd.js:733:19) at JSONPath.evaluate (C:\GIT\MTT\bono\back\node_modules\jsonpath-plus\dist\index-umd.js:566:23) at new JSONPath (C:\GIT\MTT\bono\back\node_modules\jsonpath-plus\dist\index-umd.js:498:22) at Object.JSONPath (C:\GIT\MTT\bono\back\node_modules\jsonpath-plus\dist\index-umd.js:452:16)