Husqvik / GraphQlClientGenerator

GraphQL C# client generator
MIT License
213 stars 49 forks source link

UUID Not Getting Mapped to System.Guid #139

Closed adamfisher closed 1 year ago

adamfisher commented 1 year ago

This schema definition below generates out QueryBuilderParameter<ICollection<object>?>? UserIds for the userIds: parameter but I was expected a GUID. Based on #53 it sounds like UUID would already be supported and automatically convert to a C# GUID?

input UserFilterInputType {
  userIds: [UUID!]
  organizationId: Long
}

I added a TypeMappingProvider.gql.config.json file and linked it in the csproj:

<AdditionalFiles Include="TypeMappingProvider.gql.config.json" />

I added this in the contents of the file:

[
  {
    "FieldType": "Guid",
    "RegexPattern": "System.Guid"
  }
]

Am I just missing something with the config to get this working?

Husqvik commented 1 year ago
[
  {
    "patternBaseType": ".+",
    "patternValueType": "^UUID$",
    "patternValueName": ".+",
    "netTypeName": "Guid"
  }
]

and the file name must be RegexScalarFieldTypeMappingProvider.gql.config.json

adamfisher commented 1 year ago

Thank you!