From cc4ea39fffad09ed96677c650dcb35865505d8f4 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Fri, 30 Aug 2024 16:09:29 -0400 Subject: [PATCH 1/2] Update oazapfts to 6.1 --- .../rtk-query-codegen-openapi/package.json | 2 +- yarn.lock | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/rtk-query-codegen-openapi/package.json b/packages/rtk-query-codegen-openapi/package.json index f959a5a18b..2cecaf2ede 100644 --- a/packages/rtk-query-codegen-openapi/package.json +++ b/packages/rtk-query-codegen-openapi/package.json @@ -61,7 +61,7 @@ "@apidevtools/swagger-parser": "^10.0.2", "commander": "^6.2.0", "lodash": "^4.17.21", - "oazapfts": "^6.0.2", + "oazapfts": "^6.1.0", "prettier": "^3.2.5", "semver": "^7.3.5", "swagger2openapi": "^7.0.4", diff --git a/yarn.lock b/yarn.lock index dc03d77ac4..138dcd19b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8251,7 +8251,7 @@ __metadata: lodash: "npm:^4.17.21" msw: "npm:^2.1.5" node-fetch: "npm:^3.3.2" - oazapfts: "npm:^6.0.2" + oazapfts: "npm:^6.1.0" openapi-types: "npm:^9.1.0" prettier: "npm:^3.2.5" pretty-quick: "npm:^4.0.0" @@ -22292,20 +22292,21 @@ __metadata: languageName: node linkType: hard -"oazapfts@npm:^6.0.2": - version: 6.0.2 - resolution: "oazapfts@npm:6.0.2" +"oazapfts@npm:^6.1.0": + version: 6.1.0 + resolution: "oazapfts@npm:6.1.0" dependencies: "@apidevtools/swagger-parser": "npm:^10.1.0" lodash: "npm:^4.17.21" minimist: "npm:^1.2.8" swagger2openapi: "npm:^7.0.8" - typescript: "npm:^5.3.3" + tapable: "npm:^2.2.1" + typescript: "npm:^5.4.5" peerDependencies: "@oazapfts/runtime": "*" bin: - oazapfts: dist/cli.js - checksum: 10/9132e4bbc589cefba2b93a2421309c89e7685cf75108ac8611d93f78c4e985a0d95829feb2f2b109fa22cb6feb12a6a1e03a679bba9892633c22fe9fb21bd91c + oazapfts: cli.js + checksum: 10/804c3936702acf66bb9bcff6bdcdce2708783b31c83262d7097fb04a53d3720d96114cec345408cbf3f933f9c5d198815457853a07362796c6a6d5db7a31d150 languageName: node linkType: hard @@ -28272,6 +28273,13 @@ __metadata: languageName: node linkType: hard +"tapable@npm:^2.2.1": + version: 2.2.1 + resolution: "tapable@npm:2.2.1" + checksum: 10/1769336dd21481ae6347611ca5fca47add0962fd8e80466515032125eca0084a4f0ede11e65341b9c0018ef4e1cf1ad820adbb0fba7cc99865c6005734000b0a + languageName: node + linkType: hard + "tar@npm:^6.0.2, tar@npm:^6.1.0": version: 6.1.0 resolution: "tar@npm:6.1.0" @@ -29157,7 +29165,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^5.3.3, typescript@npm:^5.5.4": +"typescript@npm:^5.3.3, typescript@npm:^5.4.5, typescript@npm:^5.5.4": version: 5.5.4 resolution: "typescript@npm:5.5.4" bin: @@ -29217,7 +29225,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A^5.3.3#optional!builtin, typescript@patch:typescript@npm%3A^5.5.4#optional!builtin": +"typescript@patch:typescript@npm%3A^5.3.3#optional!builtin, typescript@patch:typescript@npm%3A^5.4.5#optional!builtin, typescript@patch:typescript@npm%3A^5.5.4#optional!builtin": version: 5.5.4 resolution: "typescript@patch:typescript@npm%3A5.5.4#optional!builtin::version=5.5.4&hash=d69c25" bin: From 6d4563ddcf181129f97cb3bc2c1d6e9582130c35 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Fri, 30 Aug 2024 16:17:35 -0400 Subject: [PATCH 2/2] Update title check to work with latest types --- packages/rtk-query-codegen-openapi/src/generate.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/rtk-query-codegen-openapi/src/generate.ts b/packages/rtk-query-codegen-openapi/src/generate.ts index fc726f0ca6..1b32ba1125 100644 --- a/packages/rtk-query-codegen-openapi/src/generate.ts +++ b/packages/rtk-query-codegen-openapi/src/generate.ts @@ -299,7 +299,10 @@ export async function generateApi( const schema = apiGen.getSchemaFromContent(body.content); const type = apiGen.getTypeFromSchema(schema); const schemaName = camelCase( - (type as any).name || getReferenceName(schema) || ('title' in schema && schema.title) || 'body' + (type as any).name || + getReferenceName(schema) || + (typeof schema === 'object' && 'title' in schema && schema.title) || + 'body' ); const name = generateName(schemaName in queryArg ? 'body' : schemaName, 'body');