-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Move RTK-Query OpenAPI Codegen into Monorepo, prepare release 1.0 #1680
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
Conversation
RTK Query requires method property, so add it.
* Add a generator for react hooks option * Add prettier, parse URLs and files from CLI Co-authored-by: kahirokunn <[email protected]>
* Add chalk, support named and default exports from a baseQuery CLI arg * Add jest, msw and CLI tests * Add test for --file option * Simple string snapshot serializer Co-authored-by: kahirokunn <[email protected]> Co-authored-by: Lenz Weber <[email protected]>
* start extracting ts-generation code * add csb
Great! I've resolved conflicts in rtk-incubator/rtk-query-codegen#82 and submitted #1712 with @lindapaiste's changes. I'll look into the other issues later today. |
Thanks! Also, one last thing for the list:
|
@grumpyTofu @phryneas I've attempted to reproduce the ts-node issue but on my setup both ts-node and esr works fine. I've installed the latest CI package and tested it stock, and I've tested by commenting out the esr import in cli.js (forcing it to use ts-node) but it works fine. TS is already configured to output CJS modules so I'm not sure what's wrong here. @grumpyTofu could you provide a repo with a clean, minimal config that reproduces this issue (if it's still an issue on the latest revisions)? |
I chatted with @msutkowski yesterday about a |
I'm thinking that it's not necessary with both options as a |
Co-authored-by: Matt Sutkowski <[email protected]>
@Lokaltog Unfortunately, I don't have the repo that I am working with on github. However, the config is posted in the comments above. I am also just running it with a yarn script that runs the cli.js file using node and passes the config file as the argument. I wouldn't worry too much about it. I did switch to esr and everything is fine. We could just recommend that in the docs. |
@grumpyTofu could you please test the version I just pushed? I think your |
@phryneas Was this related to something in my PR? Or are you talking about the broken import Issue #1753? It looks like the broken import issue was opened by @ChuckJonas. However, I can help with the testing efforts. I can try to replicate the original issue so that I can test if that is the case, but it might be easier if @ChuckJonas tests this to see if it solves the original issue. |
@phryneas I was just running the code from the example in the docs when I got the broken import issue. |
@grumpyTofu sorry, "export" 😅
|
Can we got PR #1738 merged in? This PR is needed in order to support queries with method We are now allowing the user to specify whether an endpoint is a |
I have encountered the same sort of issue as @grumpyTofu. I would consider it "user error" because I'm pretty sure that it's caused by trying to run the script in an environment that doesn't have access to TS. The error is not from inside the rtk-query script. It never gets far enough to execute the codegen. The error is that node cannot open a Detailed explanation of errors My setup: calling
I have
So I changed the
So then I changed my config file to use Avoiding Errors The problem does not happen when I call the commands directly from the script. Instead using the script to execute a file that calls the commands, I can cut out the middle step and put this in my
|
@lindapaiste Yes, there is definitely an issue with the script implementation. It's not really related to the use of Javascript vs Typescript but more of an ES module thing. There are several fixes such as changing to a .mjs or .mts file extension which makes the script into an ES module OR change the export to @phryneas to follow up on testing, everything looks great and the example config file from the docs should work fine now! |
This is now released as |
This pretty much completely overhauls the way the Codegen is used, as suggested in rtk-incubator/rtk-query-codegen#63
Could some people please give this a try and report back?
The new README is here: https://github.com/reduxjs/redux-toolkit/blob/rtk-query-codegen-openapi/packages/rtk-query-codegen-openapi/README.md
Please note that right now you will have to use the CI build, so call
Where
4b8f6b4f
should reference the latest commit.