This commit is contained in:
syuilo 2024-08-15 20:29:21 +09:00
parent c7b95561fa
commit 2e24e2e5ae
4 changed files with 445 additions and 548 deletions

View File

@ -67,7 +67,7 @@
"@typescript-eslint/parser": "7.17.0",
"cross-env": "7.0.3",
"cypress": "13.13.1",
"eslint": "9.8.0",
"eslint": "9.9.0",
"globals": "15.8.0",
"ncp": "2.0.0",
"start-server-and-test": "2.0.4"

View File

@ -7,15 +7,15 @@
"generate": "tsx src/generator.ts && eslint ./built/**/*.ts --fix"
},
"devDependencies": {
"@readme/openapi-parser": "2.5.0",
"@types/node": "20.9.1",
"@typescript-eslint/eslint-plugin": "6.11.0",
"@typescript-eslint/parser": "6.11.0",
"@readme/openapi-parser": "2.6.0",
"@types/node": "22.3.0",
"@typescript-eslint/eslint-plugin": "8.1.0",
"@typescript-eslint/parser": "8.1.0",
"openapi-types": "12.1.3",
"openapi-typescript": "6.7.3",
"ts-case-convert": "2.0.2",
"tsx": "4.4.0",
"typescript": "5.3.3"
"openapi-typescript": "7.3.0",
"ts-case-convert": "2.0.7",
"tsx": "4.17.0",
"typescript": "5.5.4"
},
"files": [
"built"

View File

@ -1,4 +1,4 @@
import { mkdir, writeFile } from 'fs/promises';
import { mkdir, writeFile, readFile } from 'fs/promises';
import { OpenAPIV3_1 } from 'openapi-types';
import { toPascal } from 'ts-case-convert';
import OpenAPIParser from '@readme/openapi-parser';
@ -20,7 +20,9 @@ async function generateBaseTypes(
}
lines.push('');
const generatedTypes = await openapiTS(openApiJsonPath, {
const json = await readFile(openApiJsonPath, 'utf-8');
const generatedTypes = await openapiTS(json, {
exportType: true,
transform(schemaObject) {
if ('format' in schemaObject && schemaObject.format === 'binary') {

File diff suppressed because it is too large Load Diff