Lint command fails randomly
See original GitHub issueWhen we are running the spectral lint in our project, sometimes we get this error (request-body.yaml can be any of the YAML files):
1:1 error valid-oas-example-in-content “application/json.example” property can’t resolve reference schemas/request-body.yaml from id #
This is the command that we are running:
spectral lint $BASE_PATH/src/main/resources/openapi.yaml --ruleset https://someurl.com/openapi-rules.yaml
Important note
This error doesn’t happen all the time and to make it happen, we should run the spectral lint many times and technically, it happens randomly which is weird.
The openapi-rules file
Full error log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/local/Cellar/node/13.4.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'lint-openapi'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v13.4.0
4 verbose run-script [ 'prelint-openapi', 'lint-openapi', 'postlint-openapi' ]
5 info lifecycle rdc-api-mock@~prelint-openapi: rdc-api-mock@
6 info lifecycle rdc-api-mock@~lint-openapi: rdc-api-mock@
7 verbose lifecycle rdc-api-mock@~lint-openapi: unsafe-perm in lifecycle true
8 verbose lifecycle rdc-api-mock@~lint-openapi: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/s/Documents/projects/our-project/api/node_modules/.bin:/opt/apache-maven-3.6.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle rdc-api-mock@~lint-openapi: CWD: /Users/s/Documents/projects/our-project/api
10 silly lifecycle rdc-api-mock@~lint-openapi: Args: [
10 silly lifecycle '-c',
10 silly lifecycle 'spectral lint $BASE_PATH/src/main/resources/openapi.yaml --ruleset https://someurl/openapi-rules.yaml'
10 silly lifecycle ]
11 silly lifecycle rdc-api-mock@~lint-openapi: Returned: code: 1 signal: null
12 info lifecycle rdc-api-mock@~lint-openapi: Failed to exec lint-openapi script
13 verbose stack Error: rdc-api-mock@ lint-openapi: `spectral lint $BASE_PATH/src/main/resources/openapi.yaml --ruleset https://someurl/openapi-rules.yaml`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:304:20)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:304:20)
13 verbose stack at maybeClose (internal/child_process.js:1028:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid rdc-api-mock@
15 verbose cwd /Users/s/Documents/projects/our-project/api/persistence-api
16 verbose Darwin 19.2.0
17 verbose argv "/usr/local/Cellar/node/13.4.0/bin/node" "/usr/local/bin/npm" "run" "lint-openapi"
18 verbose node v13.4.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error rdc-api-mock@ lint-openapi: `spectral lint $BASE_PATH/src/main/resources/openapi.yaml --ruleset https://someurl.com/openapi-rules.yaml`
22 error Exit status 1
23 error Failed at the rdc-api-mock@ lint-openapi script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
ng lint --fix=true doesn't fix linting errors - Stack Overflow
I played around with tslint in a new Angular project, and while it did fix e.g. quotemarks, it does not fix the indentation...
Read more >Common React TypeScript ESLint / Lint Errors & Warning ...
This one can happen easily making a mistake and using the wrong event type. It won't create a compile-time error, but lint will...
Read more >What is linting and how can it save you time? - freeCodeCamp
So what is linting? lint, or a linter, is a tool that analyzes source ... instead of getting caught later as an error...
Read more >Chapter 4 lint Source Code Checker (Sun Studio 12
This chapter explains how you can use the lint program to check your C code for errors that may cause a compilation failure...
Read more >A Complete Guide to Linting Go Programs - freshman.tech
Use the command below to install golangci-lint locally on any ... pseudo random numbers for faster speeds, you can ignore the error by ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We are having this problem too in our builds, it happens for us when we have some remote references in the $ref parts of the components, like:
$ref: https://<git-url>/repos/common-types/browse/src/schemas/currency.yaml
I’m trying to create a specification that reproduces the error. I can’t share the exact one that we have.