Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Maximum call stack size exceeded for bigger api schema #520

Open
vladinko0 opened this issue Nov 24, 2023 · 5 comments
Open

Comments

@vladinko0
Copy link

I am running npx @rtk-query/codegen-openapi ./src/store/openapi-config.ts

My openapi-config.ts:

import type { ConfigFile } from "@rtk-query/codegen-openapi";
const config: ConfigFile = {
  schemaFile: "https://beapi.com/user/v3/api-docs",
  apiFile: "./emptyApi.ts",
  apiImport: "emptySplitApi",
    outputFile: "./petApi.ts",
  exportName: "petApi",
  hooks: true,
  tag: true,
};

export default config;

Result:

RangeError: Maximum call stack size exceeded
at [Symbol.replace] ()
at String.replace ()
at prj123/node_modules/oazapfts/src/codegen/generate.ts:129:29
at Array.map ()
at refPathToPropertyPath (prj123/node_modules/oazapfts/src/codegen/generate.ts:129:6)
at ApiGenerator.resolve (prj123/node_modules/oazapfts/src/codegen/generate.ts:322:18)
at ApiGenerator.checkSchemaOnlyMode (prj123/node_modules/oazapfts/src/codegen/generate.ts:781:41)
at ApiGenerator.checkSchemaOnlyMode (prj123/node_modules/oazapfts/src/codegen/generate.ts:794:16)
at prj123/node_modules/oazapfts/src/codegen/generate.ts:808:14
at Array.some ()
error Command failed with exit code 1.

Interesting thing is that rtk-incubator/rtk-query-codegen-openapi has no problem with the same API schema.

@vladinko0
Copy link
Author

I found out that version 1.0.0 works fine.

@Xiphe
Copy link
Collaborator

Xiphe commented Nov 27, 2023

can you check if v4.10.1 fixes the issue?

@weiliy
Copy link

weiliy commented Nov 29, 2023

I meet the same issue, after reinstalling @rtk-query/codegen-openapi, the oazapfts upgraded to 4.11.1. It works fine.

   /@mdx-js/loader@3.0.0(webpack@5.89.0):
     resolution: {integrity: sha512-9kLv83YtgxpoXVYHaf0ygx1dmhCffo0MQCv6KtNG67jy/JlBK/2Q0dSWfuuyStP3jnZKABHfbjv8zsiT1buu6A==}
@@ -1773,7 +1773,7 @@ packages:
     dependencies:
       '@apidevtools/swagger-parser': 10.1.0(openapi-types@12.1.3)
       commander: 6.2.1
-      oazapfts: 4.10.0(openapi-types@12.1.3)
+      oazapfts: 4.11.1(openapi-types@12.1.3)
       prettier: 2.8.8
       semver: 7.5.4
       swagger2openapi: 7.0.8

@vladinko0
Copy link
Author

can you check if v4.10.1 fixes the issue?

I am checking it on @rtk-query/codegen-openapi@1.2.0 which uses oazapfts 4.11.1 but I have now another issue
also same issue if I use oazapfts 4.10.1

@pure180
Copy link

pure180 commented Nov 29, 2023

For every one stumbling over to this issues while using @rtk-query/codegen-openapi this issue is fixed with oazapfts@4.11.1 .

Since the dependencies of @rtk-query/codegen-openapi are pretty out dated, you could easily add a resolution to your package.json, it worked on my side.

{
   "dependencies": {
     "@rtk-query/codegen-openapi": "^1.2.0"
   },
   "resolutions": {
     "@rtk-query/codegen-openapi/oazapfts": "^4.11.1"
   }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants