edgedb / edgedb-net

The official .NET client library for EdgeDB
https://edgedb.com
Apache License 2.0
83 stars 9 forks source link

Issue with string[] option type #54

Closed Darkle closed 1 year ago

Darkle commented 1 year ago

Describe the bug The client errors when using an array type and an option type together.

Reproduction With the following schema:

module default {
  type Post {
    myOptionalArrayOfStrings: array<str>;
  }
}

and the following code:


[<CLIMutable>]
type Post =
    { myOptionalArrayOfStrings: string[] option }

dbClient.QuerySingleAsync<Post>("select Post{*} limit 1")

the client errors with the following message:

Error: System.NotSupportedException: Cannot find inner type of Microsoft.FSharp.Core.FSharpOption`1[System.String[]]
   at EdgeDB.TypeExtensions.GetWrappingType(Type type)
   at EdgeDB.Binary.Codecs.TypeVisitor.VisitCodec(ICodec& codec)
   at EdgeDB.Binary.Codecs.CodecVisitor.Visit(ICodec& codec)
   at EdgeDB.Binary.Codecs.TypeVisitor.VisitCodec(ICodec& codec)
   at EdgeDB.Binary.Codecs.CodecVisitor.Visit(ICodec& codec)
   at EdgeDB.ObjectBuilder.BuildResult[TType](EdgeDBBinaryClient client, ICodec codec, Data& data)
   at EdgeDB.EdgeDBBinaryClient.QuerySingleAsync[TResult](String query, IDictionary`2 args, Nullable`1 capabilities, CancellationToken token)
   at EdgeDB.EdgeDBClient.QuerySingleAsync[TResult](String query, IDictionary`2 args, Nullable`1 capabilities, CancellationToken token)
   at EdgeDB.EdgeDBClient.QuerySingleAsync[TResult](String query, IDictionary`2 args, Nullable`1 capabilities, CancellationToken token)
   at Program.Pipe #2 input at line 23@23.MoveNext() in /home/coop/Coding/edgedb-temp/Program.fs:line 25

Minimal repro here: https://github.com/Darkle/edgedb-temp

Versions (please complete the following information):

quinchs commented 1 year ago

Seems like the cause is the option type, the binding doesn't unwrap them. Fixing this momentarily

quinchs commented 1 year ago

Fixed in #58