-
Notifications
You must be signed in to change notification settings - Fork 13
rewrite to work with config file instead of command line args #81
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
@phryneas I was able to try this one out. However, I have been running into some issues: My config: import { ConfigFile } from "@rtk-incubator/rtk-query-codegen-openapi/lib";
const {
parsed: { OPENAPI_DOCS },
} = require("dotenv").config({ path: "./.env.local" });
const config: ConfigFile = {
schemaFile: OPENAPI_DOCS,
apiFile: "./src/app/emptyApi.ts",
//apiImport: "emptyApi",
outputFile: "./src/app/rtk-api.ts",
//exportName: "emptyApi",
hooks: true,
};
export default config; Is it intentional that we have to import from the lib folder? Here is the start of my generated file import { api } from "emptyApi";
const injectedRtkApi = api.injectEndpoints({
endpoints: (build) => ({
// endpoints
})
}) what I notice is that the import is not resolving correctly. It should be a relative import. If I change it manually it works. import { api } from "./emptyApi"; I have also noticed that when I use the apiImport option in the config, it changes the import to: import { api as emptyApi } from "emptyApi";
const injectedRtkApi = api.injectEndpoints({
endpoints: (build) => ({
// endpoints
})
}) but the use of "api" for the injectEnpoints function stays the same, so the whole thing is not working unless you change it to match. |
@grumpyTofu good catches! I'll look into those today evening or tomorrow. |
@grumpyTofu I have fixed the bugs you found. But not in this branch, but over in the RTK monorepo: reduxjs/redux-toolkit#1680 Could you give it another try? |
This is now published as |
This has moved to reduxjs/redux-toolkit#1680