A command line tool for validating RAML files.
- Uses raml-org/raml-js-parser-2 to do the parsing
- Can be used as a linter in Sublime Text via the SublimeLinter and SublimeLinter-contrib-raml-cop plugins
npm install -g raml-cop
Command line RAML validator
License: MIT License
A command line tool for validating RAML files.
npm install -g raml-cop
Is it possible to output RAML as well as JSON, in order to generate a single RAML file with external files, such as schema and examples?
When it is ready raml-js-parser-2 will be replacing raml-js-parser and raml-cop will need to upgrade to support RAML 1.0
raml-cop doesn't appear to validate examples, at least not the pattern
-controlled types that I just tried.
When raml-cop was originally written it was only checking for one type of issue (errors) but after PR #11 it now checks for two types of issues (errors and warnings). As a result the code is now a little disorganized.
For example
errorsToReport
should be renamed to issuesToReport
When raml-cop processes a valid file then it gives a green "VALID" message and shows the filename.
When there are problems with the raml or schema or examples, then raml-cop reports each of those and gives a clue about which file is the origin.
However it would be useful to also report the outer RAML filename at the end with a yellow "Has issues" or some such.
It is not really needed when only processing one file. But when doing raml-cop *.raml
it can be difficult to know which raml file had the problems. Normally one can get a clue from the individual messages, but when the issues arise from "example" files, then sometimes the messages do not tell which raml file has the issues.
I believe there is a problem parsing !include
statements. Here's some example RAML for testing:
api.raml
#%RAML 1.0
title: AwesomeAPI
version: v1
baseUri: https://awesome.api
mediaType: application/json
types:
UUID: !include UUID.raml
UUID.raml
#%RAML 1.0 DataType
displayName: Universally Unique Identifier
type: string
example: 9922f203-641e-4e60-9729-78547f67b68b
pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
Could you have a look of ramlev, it's another CLI tool for validate RAML and examples defined in RAML.
My API has a few xml examples. They lead to a validation error when the API is actually valid. I have the changes ready to skip xml validations based on an argument.
🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.
Hi,
I am using JSON schemas imported into my RAML and RAML-COP is giving out warnings due to invalid JSON schema.
After some search I realized that it must be using an old draft and not respecting the $schema
parameter that states the use of draft 7 ("$schema": "http://json-schema.org/draft-07/schema#"
).
Example output:
[../../schemas/order_specification.json:371:28] WARNING Invalid JSON schema: Keyword 'exclusiveMinimum' is expected to be of type 'boolean'
[api.raml:30:12] WARNING Invalid JSON schema: Keyword 'exclusiveMinimum' is expected to be of type 'boolean'
[examples/order_251985.json:698:0] WARNING Invalid JSON schema: Keyword 'exclusiveMinimum' is expected to be of type 'boolean'
[examples/order_251985.json:96:4] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:110:12] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:125:7] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:158:20] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:184:28] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:232:20] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:316:16] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:391:28] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:410:12] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:456:1] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:482:4] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:571:8] WARNING Draft 3 schema must have boolean as 'required' property value
[examples/order_251985.json:698:0] WARNING Draft 3 schema must have boolean as 'required' property value
Hi, I use raml-cop in my CI jobs. After new release (1.1.25) of raml-1-parser raml-cop throws an error
Error: Cannot find module 'raml-1-parser'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/???/raml-cop/src/raml-cop.js:9:19)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3
Steps to reproduce:
1. npm install raml-cop --silent
2. node_modules/raml-cop/src/raml-cop.js .raml/api.raml
Error: Unssuported RAML version '#%RAML 1.0'
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.