-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added script for counting oneOf responses.
- Loading branch information
jkaliszuk
committed
Nov 30, 2023
1 parent
4eec2ad
commit b0e3c99
Showing
2 changed files
with
21 additions
and
1 deletion.
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
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,19 @@ | ||
import path from "path"; | ||
import fsPromises from "fs/promises"; | ||
|
||
const main = async () => { | ||
const openApiPath = path.join(__dirname, "../reference/OpenAPI.json"); | ||
const openAPIContent = JSON.parse( | ||
(await fsPromises.readFile(openApiPath)).toString() | ||
); | ||
|
||
const schemas = openAPIContent.components.schemas; | ||
|
||
const schemasWithOneOf = Object.keys(schemas) | ||
.filter(schemaName => schemaName.includes("ResponseBody")) | ||
.filter(schemaName => schemas[schemaName].oneOf) | ||
|
||
console.log("Responses schemas with oneOf = ", schemasWithOneOf); | ||
} | ||
|
||
main() |