Last active
April 17, 2020 08:56
-
-
Save clement911/9c5c0db2f6a46d064a6a13d44648f66c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let res = await fetch('https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json'); | |
let spec = await res.json(); | |
function printRequiredParametersOnGet() | |
{ | |
for (let path in spec.paths) | |
{ | |
if (path.indexOf('{') >= 0) | |
continue; | |
let verbs = spec.paths[path]; | |
if (verbs.get != null && verbs.get.parameters != null && verbs.get.parameters.some(p => p.required)) | |
{ | |
console.log(`${path}: ${verbs.get.parameters.filter(p => p.required).map(p => p.name).join(',')}`); | |
} | |
} | |
} | |
function printExpandableFields() | |
{ | |
for (let schemaName in spec.components.schemas) | |
{ | |
let schema = spec.components.schemas[schemaName]; | |
let expandableFields = schema['x-expandableFields']; | |
if (expandableFields != null && expandableFields.length > 0) | |
{ | |
console.log(`${schemaName}: ${expandableFields.join(',')}`); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment