-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(quoteSummary): all submodules, using validation type coercion
- Loading branch information
Showing
15 changed files
with
677 additions
and
1,771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
const schemaWalker = require('oas-schema-walker'); | ||
|
||
const chunks = []; | ||
process.stdin.on('readable', () => { | ||
let chunk; | ||
while (null !== (chunk = process.stdin.read())) | ||
chunks.push(chunk); | ||
}); | ||
|
||
process.stdin.on('end', () => { | ||
|
||
const schema = JSON.parse(chunks.join('')); | ||
|
||
//const schema = JSON.parse(fs.readFileSync('./schema.json')); | ||
|
||
function callback(schema, parent, state) { | ||
if (schema.type === 'number') { | ||
delete schema.type; | ||
schema.yahooFinanceType = 'number'; | ||
} else if (schema.type === 'string' && schema.format === 'date-time') { | ||
delete schema.format; | ||
delete schema.type; | ||
schema.yahooFinanceType = 'date'; | ||
} | ||
} | ||
|
||
for (let key of Object.keys(schema.definitions)) | ||
schemaWalker.walkSchema(schema.definitions[key], {}, {}, callback); | ||
|
||
|
||
process.stdout.end(JSON.stringify(schema, null, 2) + '\n'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.