-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client の openapi 生成に preprocess 処理を嚙ませた
- Loading branch information
Showing
7 changed files
with
70 additions
and
39 deletions.
There are no files selected for viewing
Binary file not shown.
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,20 @@ | ||
import * as Bun from 'bun' | ||
import * as yaml from 'yaml' | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const stripDiscriminator = (schema: any) => { | ||
Object.entries(schema).forEach(([key, value]) => { | ||
if (!(typeof value === 'object')) return | ||
if (key === 'discriminator') { | ||
delete schema[key] | ||
} else { | ||
stripDiscriminator(value) | ||
} | ||
}) | ||
} | ||
|
||
const file = await Bun.file('../openapi/openapi.yml').text() | ||
const parsed = yaml.parse(file) | ||
stripDiscriminator(parsed) | ||
const temp = Bun.env['FILE'] ?? '/tmp/openapi.yml' | ||
await Bun.write(temp, yaml.stringify(parsed)) |
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
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 |
---|---|---|
@@ -1,11 +1,8 @@ | ||
{ | ||
"files": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.node.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.app.json" | ||
} | ||
{ "path": "./tsconfig.node.json" }, | ||
{ "path": "./tsconfig.app.json" }, | ||
{ "path": "./tsconfig.script.json" } | ||
] | ||
} |
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,28 @@ | ||
{ | ||
"include": ["scripts/**/*"], | ||
"compilerOptions": { | ||
// Enable latest features | ||
"lib": ["ESNext"], | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"moduleDetection": "force", | ||
"jsx": "react-jsx", | ||
"allowJs": true, | ||
|
||
// Bundler mode | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"verbatimModuleSyntax": true, | ||
"noEmit": true, | ||
|
||
// Best practices | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"noFallthroughCasesInSwitch": true, | ||
|
||
// Some stricter flags | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noPropertyAccessFromIndexSignature": true | ||
} | ||
} |