reduxjs / redux-toolkit

The official, opinionated, batteries-included toolset for efficient Redux development
https://redux-toolkit.js.org
MIT License
10.64k stars 1.15k forks source link

[RTKQ Code Gen] Unable to set BaseQuery or Reducer Path with @rtk-query/codegen-openapi #1943

Open jbrighton-dev opened 2 years ago

jbrighton-dev commented 2 years ago

@rtk-incubator/rtk-query-codegen-openapi allows you to set the baseQuery and the Redcucer Path as part of the generation, how do you do this with @rtk-query/codegen-openapi?

XpamAmAdEuS commented 2 years ago

Having same problem, Without manually set reducerPath typescript will give us middleware error.

We only have injectEndpoints function that responsible for enddpoints but we also need ability to set reducerPath. Also would be nice if we can generate complete baseQuery wehn generating. That way we can generate baseUrl: '/', and also more impornant prepareHeaders. Sry for my bad english.

phryneas commented 2 years ago

@rtk-incubator/rtk-query-codegen-openapi is not in active development any more and you should not be using it. Instead, you should be using @rtk-query/codegen-openapi. There you write your basic api yourself (so you can define reducerPath, baseUrl etc. once by hand) and then everything gets injected into that by the generated code. That is much more flexible than having to remember (and maintain) 20 different command line options for all of that.