Skip to content

Commit baab5ce

Browse files
committed
Move examples to test directory, take filenames on input
1 parent 26dbc05 commit baab5ce

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ import jsonpath from 'jsonpath';
33
import {safeStringify,parseWithPointers} from "@stoplight/yaml";
44
import mergician from 'mergician';
55

6-
try {
6+
// example: node index.js test/specs/petstore.yaml test/overlays/overlay.yaml
7+
const openapiFile = process.argv[2]
8+
const overlayFile = process.argv[3]
79

8-
// Parse the "input" OpenAPI spec document
10+
try {
911

10-
const specraw = fs.readFileSync('big.yaml', 'utf8');
12+
// Parse the "input" OpenAPI document
13+
const specraw = fs.readFileSync(openapiFile, 'utf8');
1114
var spec = parseWithPointers(specraw).data;
1215

13-
// Parse the "overlay" OpenAPI document
14-
15-
const overlayraw = fs.readFileSync('overlay.yaml', 'utf8');
16+
// Parse the "overlay" document
17+
const overlayraw = fs.readFileSync(overlayFile, 'utf8');
1618
const overlay = parseWithPointers(overlayraw).data;
1719

1820
// Use jsonpath.apply to do the changes

test/actual/.gitignore

Whitespace-only changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)