dotansimha / dotansimha/graphql-code-generator-community
MongoDB Plugin: Align configuration options with TypeScript plugin
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
### Describe the bug
I love codegen and the MongoDB plugin - having full typesafety from Database to Client is just awesome. But I'm running into issues time and time again because the MongoDB plugin doesn't accept the same configuration as the TypeScript one, some examples;
- allowEnumStringTypes
- immutableTypes
- declarationKind
- useTypeImports
### Your Example Website or App
https://codesandbox.io/s/cranky-clarke-t3okkm
### Steps to Reproduce the Bug or Issue
Use any of the mentioned configurations and you'll end up with various type inconsistencies, some hurts more than others.
### Expected behavior
I'd expect the MongoDB plugin to accept the same configuration options as the TypeScript plugin as long as it's possible.
### Screenshots or Videos
_No response_
### Platform
- OS: macOS
- NodeJS: 16.15.3
- `graphql` version: 16.5.0
- "@graphql-codegen/cli": "2.8.1",
- "@graphql-codegen/typescript": "2.7.1",
- "@graphql-codegen/typescript-mongodb": "2.4.1",
### Codegen Config File
overwrite: true
# errorsOnly: true # this seems to do the trick, even though validation fails
schema: ./schema.graphql
require:
- ts-node/register
generates:
./types.ts:
plugins:
- typescript
- typescript-mongodb
config:
namingConvention:
enumValues: keep
useIndexSignature: true
allowEnumStringTypes: true
showUnusedMappers: true
immutableTypes: true
enumsAsString: false
declarationKind: 'interface'
useTypeImports: true
objectIdType: ObjectId#mongodb
scalars:
ObjectId: mongodb#ObjectId
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.