dotansimha / dotansimha/graphql-code-generator-community

CSharp plugin - Support additional configuration to specify "value types"

Open
#146 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

The value type mapping file is internal to the csharp plugin, this means that there is no way to add additional scalar types that map correctly when they are optional.

A concrete example is to use `DateTimeOffset` (which is preferable when representing timestamps) instead of `DateTime`.

Due to the way that the plugin works, `DateTimeOffset` would not be detected as a value type and so, for optional fields, the generated C# will not include the nullable flag, making it break on deserialization if `null` were provided.

In order to support other value types it would be good to be able to specify "value types" as a configuration option, then the implementation is protected against any other scalar types people care to add.

For our scenario, using `DateTime` as a workaround works, but is not preferable.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.