graphql-code-generator
graphql-code-generator copied to clipboard
feat(import-types): add preservePluginsTypes option
Description
Add new option preservePluginsTypes
to import-types preset to fix the problem with overriding own types located in the outcome file, with an unnecessary namespace prefix.
Related (https://github.com/dotansimha/graphql-code-generator/issues/6909)
Type of change
Please delete options that are not relevant.
- [X] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [X] This change requires a documentation update
How Has This Been Tested?
I tested it locally in another project. Tested with the following configuration:
./libs/graphql-schema/src/lib/graphql-schema.tsx:
documents: ./libs/graphql-schema/src/**/*.graphql
preset: import-types
presetConfig:
typesPath: "@tutoring/graphql-schema-types"
preservePluginsTypes: true
plugins:
- typescript-react-apollo
- typescript-operations
config:
withHooks: true
preResolveTypes: false
skipTypename: true
immutableTypes: true
namingConvention:
typeNames: change-case#pascalCase
enumValues: change-case#upperCase
Test Environment:
- OS: MacOS 11.4
-
@graphql-codegen/...
: - NodeJS: v12.22.3
Checklist:
- [x] I have followed the CONTRIBUTING doc and the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
Further comments
This PR fix only case with usage of import-types
preset in combination with typescript-react-apollo
plugin, instead of typescript-react-query
mentioned in the issue, because typescript-react-query
doesn't have implemented importOperationTypesFrom
option yet.
If this PR will be accepted, the next step will be to implement importOperationTypesFrom
option for typescript-react-query
plugin.
โ ๏ธ No Changeset found
Latest commit: 87d85313c7e4a7577d98640e4f5ec263fe9efd43
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
๐ Inspect: https://vercel.com/theguild/graphql-code-generator/4xV2poEBqQ9vka4aPNnmLsTn6gxF
โ
Preview: https://graphql-code-generator-git-fork-andrzejsala-master-theguild.vercel.app
Hi @AndrzejSala ๐๐ผ
Just a little heads-up on my previous message โคต๏ธ
Could you please add some tests for this new behavior? ๐
Thanks!
Closing due to inactivity.