This repository was archived by the owner on Jan 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +11
-19
lines changed Expand file tree Collapse file tree 4 files changed +11
-19
lines changed Original file line number Diff line number Diff line change 1111 ],
1212 "scripts" : {
1313 "lint" : " standard" ,
14- "test-std " : " mocha -R spec --bail" ,
14+ "test-spec " : " mocha -R spec --bail" ,
1515 "test-cov" : " istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail" ,
1616 "test" : " npm run lint && npm run test-cov"
1717 },
3939 },
4040 "homepage" : " https://github.com/mulesoft-labs/raml-object-standard" ,
4141 "devDependencies" : {
42+ "ajv" : " ^0.7.0" ,
4243 "chai" : " ^1.10.0" ,
4344 "istanbul" : " ^0.3.5" ,
4445 "mocha" : " ^2.1.0" ,
4546 "pre-commit" : " ^1.0.1" ,
4647 "raml-parser" : " ^0.8.10" ,
47- "standard" : " ^2.1.1" ,
48- "z-schema" : " ^3.4.3"
48+ "standard" : " ^2.1.1"
4949 },
5050 "dependencies" : {
5151 "extend" : " ^2.0.0"
Original file line number Diff line number Diff line change 497497 "rootResource" : {
498498 "type" : " object" ,
499499 "patternProperties" : {
500- "^\\ /" : {
500+ "^/" : {
501501 "$ref" : " #/definitions/resource"
502502 }
503503 },
528528 "^(?:head|get|post|put|patch|delete|options|trace|connect)$" : {
529529 "$ref" : " #/definitions/method"
530530 },
531- "^\\ /" : {
531+ "^/" : {
532532 "$ref" : " #/definitions/resource"
533533 }
534534 },
Original file line number Diff line number Diff line change 11var schema = require ( '../../schema.json' )
2- var ZSchema = require ( 'z-schema' )
3- var join = require ( 'path' ) . join
4- var readFile = require ( 'fs' ) . readFileSync
5- var validator = new ZSchema ( )
6-
7- validator . setRemoteReference (
8- 'http://json-schema.org/draft-04/schema' ,
9- JSON . parse ( readFile ( join ( __dirname , '../../vendor/schema' ) , 'utf8' ) )
10- )
2+ var Ajv = require ( 'ajv' )
3+ var ajv = Ajv ( { allErrors : true , verbose : true } )
4+ var validate = ajv . compile ( schema )
115
126module . exports = validateObject
137
148function validateObject ( obj ) {
15- var result = validator . validate ( obj , schema )
9+ var result = validate ( obj )
1610
1711 return {
1812 valid : result ,
19- errors : validator . getLastErrors ( )
13+ errors : validate . errors
2014 }
2115}
Original file line number Diff line number Diff line change @@ -7,15 +7,13 @@ var transform = require('../transform/raml-js-parser-08')
77
88describe ( 'transform raml js parser 0.8' , function ( ) {
99 it ( 'should parse and transform raml into standard object' , function ( ) {
10- this . timeout ( 5 * 60 * 1000 )
11-
1210 return parser . loadFile ( join ( __dirname , 'fixtures/github_v3/api.raml' ) )
1311 . then ( function ( data ) {
1412 var raml = transform ( data )
1513 var result = validate ( raml )
1614
1715 expect ( result . valid ) . to . be . true
18- expect ( result . errors ) . to . be . empty
16+ expect ( result . errors ) . to . not . exist
1917
2018 expect ( raml . title ) . to . be . a ( 'string' )
2119 expect ( raml . version ) . to . be . a ( 'string' )
You can’t perform that action at this time.
0 commit comments