Checks structural and semantic errors in OPENAPI
files (json and yaml) by posting passed files to https://validator.swagger.io/
.
- Run
npm install -g openapi-checker
- Run
openapi-checker /path/to/file
to validate yourOPENAPI
file.
Validate OpenAPI files in Node environments.
Checks structural and semantic errors in OPENAPI
files (json and yaml) by posting passed files to https://validator.swagger.io/
.
npm install -g openapi-checker
openapi-checker /path/to/file
to validate your OPENAPI
file.Like it says on the tin. Here's the command I'm running and its output:
npx openapi-checker ./design/openapi.yaml
undefined:1
openapi: 3.0.0
^
SyntaxError: Unexpected token o in JSON at position 0
at JSON.parse (<anonymous>)
at Object.<anonymous> (/Users/yanni/.npm/_npx/f82504eb25360710/node_modules/openapi-checker/validator.js:16:24)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
The YAML file opens with openapi: 3.0.0
, which is certainly not a JSON data structure (so the error is "accurate")… and, looking at the validate.js
file, I'm puzzled as to where it's even possible that YAML is at all supported by this package. Perhaps an unpushed / unmerged branch somewhere…? 😅
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.