Skip to content

Commit 6c1a5d8

Browse files
committed
Update to reftools v0.0.12
1 parent d93a4cb commit 6c1a5d8

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ To run a test-suite:
9898
node testRunner [-f {path-to-expected-failures}]... [{path-to-APIs|single-file...}]
9999
```
100100

101-
The test harness currently expects files with a `.json` or `.yaml` extension, or a single named file, and has been tested on Node.js versions 4.x, 6.x and 8.7 (it is not recommended to run the test suite under Node.js version 7.x or Node.js versions less than 8.7.0 because of [this bug](https://github.com/nodejs/node/issues/13048)) against
101+
The test harness currently expects files with a `.json` or `.yaml` extension, or a single named file, and has been tested on Node.js versions 4.x, 6.x and 8.x LTS (it is not recommended to run the test suite under Node.js version 7.x or Node.js versions less than 8.7.0 because of [this bug](https://github.com/nodejs/node/issues/13048)) against
102102

103103
* [APIs.guru](https://github.com/APIs-guru/openapi-directory)
104104
* [Mermade OpenApi specifications collection](https://github.com/mermade/openapi_specifications)

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"js-yaml": "^3.6.1",
3232
"node-fetch": "^1.6.3",
3333
"node-readfiles": "^0.2.0",
34-
"reftools": "^0.0.10",
34+
"reftools": "0.0.12",
3535
"should": "^13.0.1",
3636
"yargs": "^9.0.1"
3737
},

validate.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ function checkSubSchema(schema, parent, state) {
282282

283283
function checkSchema(schema,parent,prop,openapi,options) {
284284
let state = {};
285+
state.depth = 0;
286+
state.seen = [];
285287
state.openapi = openapi;
286288
state.options = options;
287289
state.property = prop;

walkSchema.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
'use strict';
22

3+
const util = require('util');
4+
35
function walkSchema(schema, parent, state, callback) {
46

7+
if (typeof state.depth === 'undefined') state = { depth: 0, seen: [], top:true };
58
if (typeof schema.$ref !== 'undefined') {
69
let temp = {$ref:schema.$ref};
710
callback(temp,parent,state);
811
return temp; // all other properties SHALL be ignored
912
}
1013
callback(schema,parent,state);
14+
if (state.seen.indexOf(schema)>=0) {
15+
return schema;
16+
}
17+
//else
18+
state.seen.push(schema);
19+
state.top = false;
20+
state.depth++;
1121

1222
if (typeof schema.items !== 'undefined') {
1323
state.property = 'items';
@@ -61,6 +71,7 @@ function walkSchema(schema, parent, state, callback) {
6171
state.property = 'not';
6272
walkSchema(schema.not,schema,state,callback);
6373
}
74+
state.depth--;
6475
return schema;
6576
}
6677

0 commit comments

Comments
 (0)