Closed asherccohen closed 2 years ago
The codegen is now published as @rtk-query/codegen-openapi
and the code has moved over to the Redux Toolkit monorepo.
As usage has changed as well, please read the new documentation.
The new release of the codegen now also uses configuration files and already allows for some overrides, so this would theoretically be possible to implement there. If you are still interested in continuing this discussion, please re-open a ticket over in the RTK repository - I am going to archive this repo now.
Context: Right now manual patching is needed to extend/refine generated types that are either wrong or not properly documented by the backend schema definition (and no, "kicking the backend team" is not always an option).
Since these are Types the only way to extend/merge declaration it to define a new type with a different name and use &, like so:
This introduces a bloated list of types with similar names in codebases (even more if the frontend needs to further reshape them to its specific needs), plus manual work every time a new schema is pulled.
Graphql code gen uses yaml files for its configuration and one of the options is to define additionalTypeDefs (also takes a file as input) which lets u overwrite existing types with more refined ones.
Expected result: Not saying we need something as extensible/elaborated, but would be nice to explore some solutions.