You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My team and I are currently facing some performance issue when using Multiple output files
Our swagger.json has more than 70k lines and we generate 100+ ouput files in our client with rtk-query-codegen-openapi. This result in our script taking roughly 18sec to execute.
When running rtk-query-codegen-openapi, parseConfig will generate a list of config for each outputFile, triggering generateApi for each of them.
However, the current logic parse the spec (path of our swagger.json) at each execution of generateApi:
constv3Doc=awaitgetV3Doc(spec);
This process takes a bit of time as you may expect, and becomes slower as our outputFiles grows
Current fix (patch)
I'm currently applying a patch on the file to cache the output of getV3Doc as follow:
This helped to cut the running time from 18 seconds to only 2 seconds without modifying our structure
Alternative approach
Single ouput file
We tried this approach already, but it creates some issues with typescript as you may expect due to the amount of information extracted in a single type. Type instantiation is excessively deep and possibly infinite.
Multiple swagger files
Instead of generating a single swagger file, the other idea was to generate a swagger for each controller in our backend and run rtk-query-codegen-openapi on each one of them.
This is a more tedious task, but it should reduce it as the amount of information to parse would become small for each swagger files. However, this is not an ideal solution for us.
Action
If it is okay, I will prepare a PR to add the current fix to rtk-query-codegen-openapi
The text was updated successfully, but these errors were encountered:
Issue
My team and I are currently facing some performance issue when using Multiple output files
Our swagger.json has more than 70k lines and we generate 100+ ouput files in our client with
rtk-query-codegen-openapi
. This result in our script taking roughly 18sec to execute.Our config file looks a bit like this:
Explanation
When running rtk-query-codegen-openapi, parseConfig will generate a list of config for each outputFile, triggering
generateApi
for each of them.However, the current logic parse the
spec
(path of our swagger.json) at each execution of generateApi:This process takes a bit of time as you may expect, and becomes slower as our outputFiles grows
Current fix (patch)
I'm currently applying a patch on the file to cache the output of
getV3Doc
as follow:This helped to cut the running time from 18 seconds to only 2 seconds without modifying our structure
Alternative approach
Single ouput file
We tried this approach already, but it creates some issues with typescript as you may expect due to the amount of information extracted in a single type.
Type instantiation is excessively deep and possibly infinite.
Multiple swagger files
Instead of generating a single swagger file, the other idea was to generate a swagger for each controller in our backend and run
rtk-query-codegen-openapi
on each one of them.This is a more tedious task, but it should reduce it as the amount of information to parse would become small for each swagger files. However, this is not an ideal solution for us.
Action
If it is okay, I will prepare a PR to add the current fix to
rtk-query-codegen-openapi
The text was updated successfully, but these errors were encountered: