From 893acebb91761de79e6d6f7269bbf46f3b8cfda6 Mon Sep 17 00:00:00 2001 From: Islam Aleiv Date: Thu, 28 Mar 2024 11:34:21 +0100 Subject: [PATCH] non-nillable types (WIP) --- client/document.go | 21 +++-- client/schema_field_description.go | 48 +++++++++- core/encoding.go | 16 ++-- db/fetcher/encoded_doc.go | 8 +- db/fetcher/indexer_iterators.go | 9 +- request/graphql/schema/collection.go | 16 ++-- request/graphql/schema/descriptions.go | 118 ++++++++++++++++++------- request/graphql/schema/generate.go | 9 +- 8 files changed, 185 insertions(+), 60 deletions(-) diff --git a/client/document.go b/client/document.go index 531ccd42cd..53540ace4c 100644 --- a/client/document.go +++ b/client/document.go @@ -206,14 +206,14 @@ func validateFieldSchema(val any, field SchemaFieldDescription) (NormalValue, er } return NewNormalString(v), nil - case FieldKind_STRING_ARRAY: + case FieldKind_STRING_NILLABLE_ARRAY: v, err := getArray(val, getString) if err != nil { return nil, err } return NewNormalStringArray(v), nil - case FieldKind_NILLABLE_STRING_ARRAY: + case FieldKind_NILLABLE_STRING_NILLABLE_ARRAY: v, err := getNillableArray(val, getString) if err != nil { return nil, err @@ -234,7 +234,14 @@ func validateFieldSchema(val any, field SchemaFieldDescription) (NormalValue, er } return NewNormalBoolArray(v), nil - case FieldKind_NILLABLE_BOOL_ARRAY: + case FieldKind_BOOL_NILLABLE_ARRAY: + v, err := getArray(val, getBool) + if err != nil { + return nil, err + } + return NewNormalBoolArray(v), nil + + case FieldKind_NILLABLE_BOOL_NILLABLE_ARRAY: v, err := getNillableArray(val, getBool) if err != nil { return nil, err @@ -248,14 +255,14 @@ func validateFieldSchema(val any, field SchemaFieldDescription) (NormalValue, er } return NewNormalFloat(v), nil - case FieldKind_FLOAT_ARRAY: + case FieldKind_FLOAT_NILLABLE_ARRAY: v, err := getArray(val, getFloat64) if err != nil { return nil, err } return NewNormalFloatArray(v), nil - case FieldKind_NILLABLE_FLOAT_ARRAY: + case FieldKind_NILLABLE_FLOAT_NILLABLE_ARRAY: v, err := getNillableArray(val, getFloat64) if err != nil { return nil, err @@ -276,14 +283,14 @@ func validateFieldSchema(val any, field SchemaFieldDescription) (NormalValue, er } return NewNormalInt(v), nil - case FieldKind_INT_ARRAY: + case FieldKind_INT_NILLABLE_ARRAY: v, err := getArray(val, getInt64) if err != nil { return nil, err } return NewNormalIntArray(v), nil - case FieldKind_NILLABLE_INT_ARRAY: + case FieldKind_NILLABLE_INT_NILLABLE_ARRAY: v, err := getNillableArray(val, getInt64) if err != nil { return nil, err diff --git a/client/schema_field_description.go b/client/schema_field_description.go index ef4740b206..435681980c 100644 --- a/client/schema_field_description.go +++ b/client/schema_field_description.go @@ -146,6 +146,40 @@ func (k ScalarKind) IsArray() bool { return false } +func (k ScalarKind) ToArray() ScalarArrayKind { + switch k { + case FieldKind_BOOL: + return FieldKind_BOOL_ARRAY + case FieldKind_INT: + return FieldKind_INT_ARRAY + case FieldKind_FLOAT: + return FieldKind_FLOAT_ARRAY + case FieldKind_STRING: + return FieldKind_STRING_ARRAY + case FieldKind_JSON: + return FieldKind_JSON_ARRAY + case FieldKind_BLOB: + return FieldKind_BLOB_ARRAY + case FieldKind_DATETIME: + return FieldKind_DATETIME_ARRAY + case FieldKind_NILLABLE_BOOL: + return FieldKind_BOOL_NILLABLE_ARRAY + case FieldKind_NILLABLE_INT: + return FieldKind_INT_NILLABLE_ARRAY + case FieldKind_NILLABLE_FLOAT: + return FieldKind_FLOAT_NILLABLE_ARRAY + case FieldKind_NILLABLE_STRING: + return FieldKind_STRING_NILLABLE_ARRAY + case FieldKind_NILLABLE_JSON: + return FieldKind_JSON_NILLABLE_ARRAY + case FieldKind_NILLABLE_BLOB: + return FieldKind_BLOB_NILLABLE_ARRAY + case FieldKind_NILLABLE_DATETIME: + return FieldKind_DATETIME_NILLABLE_ARRAY + } + return ScalarArrayKind(0) +} + func (k ScalarArrayKind) String() string { switch k { case FieldKind_NILLABLE_BOOL_NILLABLE_ARRAY: @@ -440,8 +474,18 @@ func (f *SchemaFieldDescription) UnmarshalJSON(bytes []byte) error { } switch intKind { case uint8(FieldKind_BOOL_ARRAY), uint8(FieldKind_INT_ARRAY), uint8(FieldKind_FLOAT_ARRAY), - uint8(FieldKind_STRING_ARRAY), uint8(FieldKind_NILLABLE_BOOL_ARRAY), uint8(FieldKind_NILLABLE_INT_ARRAY), - uint8(FieldKind_NILLABLE_FLOAT_ARRAY), uint8(FieldKind_NILLABLE_STRING_ARRAY): + uint8(FieldKind_STRING_ARRAY), uint8(FieldKind_JSON_ARRAY), uint8(FieldKind_BLOB_ARRAY), + uint8(FieldKind_DATETIME_ARRAY), uint8(FieldKind_NILLABLE_BOOL_ARRAY), + uint8(FieldKind_NILLABLE_INT_ARRAY), uint8(FieldKind_NILLABLE_FLOAT_ARRAY), + uint8(FieldKind_NILLABLE_STRING_ARRAY), uint8(FieldKind_NILLABLE_JSON_ARRAY), + uint8(FieldKind_NILLABLE_BLOB_ARRAY), uint8(FieldKind_NILLABLE_DATETIME_ARRAY), + uint8(FieldKind_BOOL_NILLABLE_ARRAY), uint8(FieldKind_INT_NILLABLE_ARRAY), + uint8(FieldKind_FLOAT_NILLABLE_ARRAY), uint8(FieldKind_STRING_NILLABLE_ARRAY), + uint8(FieldKind_JSON_NILLABLE_ARRAY), uint8(FieldKind_BLOB_NILLABLE_ARRAY), + uint8(FieldKind_DATETIME_NILLABLE_ARRAY), uint8(FieldKind_NILLABLE_BOOL_NILLABLE_ARRAY), + uint8(FieldKind_NILLABLE_INT_NILLABLE_ARRAY), uint8(FieldKind_NILLABLE_FLOAT_NILLABLE_ARRAY), + uint8(FieldKind_NILLABLE_STRING_NILLABLE_ARRAY), uint8(FieldKind_NILLABLE_JSON_NILLABLE_ARRAY), + uint8(FieldKind_NILLABLE_BLOB_NILLABLE_ARRAY), uint8(FieldKind_NILLABLE_DATETIME_NILLABLE_ARRAY): f.Kind = ScalarArrayKind(intKind) default: f.Kind = ScalarKind(intKind) diff --git a/core/encoding.go b/core/encoding.go index eab401c7a2..62f9deabcc 100644 --- a/core/encoding.go +++ b/core/encoding.go @@ -31,7 +31,7 @@ func NormalizeFieldValue(fieldDesc client.FieldDefinition, val any) (any, error) if array, isArray := val.([]any); isArray { var ok bool switch fieldDesc.Kind { - case client.FieldKind_BOOL_ARRAY: + case client.FieldKind_BOOL_NILLABLE_ARRAY: boolArray := make([]bool, len(array)) for i, untypedValue := range array { boolArray[i], ok = untypedValue.(bool) @@ -41,13 +41,13 @@ func NormalizeFieldValue(fieldDesc client.FieldDefinition, val any) (any, error) } val = boolArray - case client.FieldKind_NILLABLE_BOOL_ARRAY: + case client.FieldKind_NILLABLE_BOOL_NILLABLE_ARRAY: val, err = convertNillableArray[bool](fieldDesc.Name, array) if err != nil { return nil, err } - case client.FieldKind_INT_ARRAY: + case client.FieldKind_INT_NILLABLE_ARRAY: intArray := make([]int64, len(array)) for i, untypedValue := range array { intArray[i], err = convertToInt(fmt.Sprintf("%s[%v]", fieldDesc.Name, i), untypedValue) @@ -57,13 +57,13 @@ func NormalizeFieldValue(fieldDesc client.FieldDefinition, val any) (any, error) } val = intArray - case client.FieldKind_NILLABLE_INT_ARRAY: + case client.FieldKind_NILLABLE_INT_NILLABLE_ARRAY: val, err = convertNillableArrayWithConverter(fieldDesc.Name, array, convertToInt) if err != nil { return nil, err } - case client.FieldKind_FLOAT_ARRAY: + case client.FieldKind_FLOAT_NILLABLE_ARRAY: floatArray := make([]float64, len(array)) for i, untypedValue := range array { floatArray[i], ok = untypedValue.(float64) @@ -73,13 +73,13 @@ func NormalizeFieldValue(fieldDesc client.FieldDefinition, val any) (any, error) } val = floatArray - case client.FieldKind_NILLABLE_FLOAT_ARRAY: + case client.FieldKind_NILLABLE_FLOAT_NILLABLE_ARRAY: val, err = convertNillableArray[float64](fieldDesc.Name, array) if err != nil { return nil, err } - case client.FieldKind_STRING_ARRAY: + case client.FieldKind_STRING_NILLABLE_ARRAY: stringArray := make([]string, len(array)) for i, untypedValue := range array { stringArray[i], ok = untypedValue.(string) @@ -89,7 +89,7 @@ func NormalizeFieldValue(fieldDesc client.FieldDefinition, val any) (any, error) } val = stringArray - case client.FieldKind_NILLABLE_STRING_ARRAY: + case client.FieldKind_NILLABLE_STRING_NILLABLE_ARRAY: val, err = convertNillableArray[string](fieldDesc.Name, array) if err != nil { return nil, err diff --git a/db/fetcher/encoded_doc.go b/db/fetcher/encoded_doc.go index 889aea848a..5a90cca1b7 100644 --- a/db/fetcher/encoded_doc.go +++ b/db/fetcher/encoded_doc.go @@ -60,7 +60,13 @@ func (e encProperty) Decode() (any, error) { return nil, err } - return core.NormalizeFieldValue(e.Desc, val) + nv, err := client.NewNormalValue(val, e.Desc.Kind) + if err != nil { + return nil, err + } + return nv.Unwrap(), nil + + //return core.NormalizeFieldValue(e.Desc, val) } // @todo: Implement Encoded Document type diff --git a/db/fetcher/indexer_iterators.go b/db/fetcher/indexer_iterators.go index 83b620b662..b5ff6d8a2e 100644 --- a/db/fetcher/indexer_iterators.go +++ b/db/fetcher/indexer_iterators.go @@ -660,7 +660,14 @@ func (f *IndexFetcher) determineFieldFilterConditions() ([]fieldFilterCond, erro condMap := indexFilterCond.(map[connor.FilterKey]any) for key, filterVal := range condMap { opKey := key.(*mapper.Operator) - normalVal, err := client.NewNormalValue(filterVal, f.indexedFields[i].Kind) + kind := f.indexedFields[i].Kind + if opKey.Operation == opIn || opKey.Operation == opNin { + if k, ok := kind.(client.ScalarKind); ok { + kind = k.ToArray() + } + } + + normalVal, err := client.NewNormalValue(filterVal, kind) if err != nil { return nil, err } diff --git a/request/graphql/schema/collection.go b/request/graphql/schema/collection.go index 3786d41209..84bb74324a 100644 --- a/request/graphql/schema/collection.go +++ b/request/graphql/schema/collection.go @@ -430,13 +430,13 @@ func astTypeToKind(t ast.Type) (client.FieldKind, error) { case *ast.NonNull: switch innerAstTypeVal.Type.(*ast.Named).Name.Value { case typeBoolean: - return client.FieldKind_BOOL_ARRAY, nil + return client.FieldKind_BOOL_NILLABLE_ARRAY, nil case typeInt: - return client.FieldKind_INT_ARRAY, nil + return client.FieldKind_INT_NILLABLE_ARRAY, nil case typeFloat: - return client.FieldKind_FLOAT_ARRAY, nil + return client.FieldKind_FLOAT_NILLABLE_ARRAY, nil case typeString: - return client.FieldKind_STRING_ARRAY, nil + return client.FieldKind_STRING_NILLABLE_ARRAY, nil default: return client.FieldKind_None, NewErrNonNullForTypeNotSupported(innerAstTypeVal.Type.(*ast.Named).Name.Value) } @@ -444,13 +444,13 @@ func astTypeToKind(t ast.Type) (client.FieldKind, error) { default: switch astTypeVal.Type.(*ast.Named).Name.Value { case typeBoolean: - return client.FieldKind_NILLABLE_BOOL_ARRAY, nil + return client.FieldKind_NILLABLE_BOOL_NILLABLE_ARRAY, nil case typeInt: - return client.FieldKind_NILLABLE_INT_ARRAY, nil + return client.FieldKind_NILLABLE_INT_NILLABLE_ARRAY, nil case typeFloat: - return client.FieldKind_NILLABLE_FLOAT_ARRAY, nil + return client.FieldKind_NILLABLE_FLOAT_NILLABLE_ARRAY, nil case typeString: - return client.FieldKind_NILLABLE_STRING_ARRAY, nil + return client.FieldKind_NILLABLE_STRING_NILLABLE_ARRAY, nil default: return client.ObjectArrayKind(astTypeVal.Type.(*ast.Named).Name.Value), nil } diff --git a/request/graphql/schema/descriptions.go b/request/graphql/schema/descriptions.go index dc97705b5d..dcc61c9e0e 100644 --- a/request/graphql/schema/descriptions.go +++ b/request/graphql/schema/descriptions.go @@ -19,41 +19,95 @@ import ( var ( fieldKindToGQLType = map[client.FieldKind]gql.Type{ - client.FieldKind_DocID: gql.ID, - client.FieldKind_NILLABLE_BOOL: gql.Boolean, - client.FieldKind_BOOL_ARRAY: gql.NewList(gql.NewNonNull(gql.Boolean)), - client.FieldKind_NILLABLE_BOOL_ARRAY: gql.NewList(gql.Boolean), - client.FieldKind_NILLABLE_INT: gql.Int, - client.FieldKind_INT_ARRAY: gql.NewList(gql.NewNonNull(gql.Int)), - client.FieldKind_NILLABLE_INT_ARRAY: gql.NewList(gql.Int), - client.FieldKind_NILLABLE_FLOAT: gql.Float, - client.FieldKind_FLOAT_ARRAY: gql.NewList(gql.NewNonNull(gql.Float)), - client.FieldKind_NILLABLE_FLOAT_ARRAY: gql.NewList(gql.Float), - client.FieldKind_NILLABLE_DATETIME: gql.DateTime, - client.FieldKind_NILLABLE_STRING: gql.String, - client.FieldKind_STRING_ARRAY: gql.NewList(gql.NewNonNull(gql.String)), - client.FieldKind_NILLABLE_STRING_ARRAY: gql.NewList(gql.String), - client.FieldKind_NILLABLE_BLOB: schemaTypes.BlobScalarType, - client.FieldKind_NILLABLE_JSON: schemaTypes.JSONScalarType, + client.FieldKind_DocID: gql.ID, + client.FieldKind_BOOL: gql.NewNonNull(gql.Boolean), + client.FieldKind_INT: gql.NewNonNull(gql.Int), + client.FieldKind_FLOAT: gql.NewNonNull(gql.Float), + client.FieldKind_DATETIME: gql.NewNonNull(gql.DateTime), + client.FieldKind_STRING: gql.NewNonNull(gql.String), + client.FieldKind_BLOB: gql.NewNonNull(schemaTypes.BlobScalarType), + client.FieldKind_JSON: gql.NewNonNull(schemaTypes.JSONScalarType), + client.FieldKind_NILLABLE_BOOL: gql.Boolean, + client.FieldKind_NILLABLE_INT: gql.Int, + client.FieldKind_NILLABLE_FLOAT: gql.Float, + client.FieldKind_NILLABLE_DATETIME: gql.DateTime, + client.FieldKind_NILLABLE_STRING: gql.String, + client.FieldKind_NILLABLE_BLOB: schemaTypes.BlobScalarType, + client.FieldKind_NILLABLE_JSON: schemaTypes.JSONScalarType, + client.FieldKind_BOOL_ARRAY: gql.NewNonNull(gql.NewList(gql.NewNonNull(gql.Boolean))), + client.FieldKind_INT_ARRAY: gql.NewNonNull(gql.NewList(gql.NewNonNull(gql.Int))), + client.FieldKind_FLOAT_ARRAY: gql.NewNonNull(gql.NewList(gql.NewNonNull(gql.Float))), + client.FieldKind_DATETIME_ARRAY: gql.NewNonNull(gql.NewList(gql.NewNonNull(gql.DateTime))), + client.FieldKind_STRING_ARRAY: gql.NewNonNull(gql.NewList(gql.NewNonNull(gql.String))), + client.FieldKind_BLOB_ARRAY: gql.NewNonNull(gql.NewList(gql.NewNonNull(schemaTypes.BlobScalarType))), + client.FieldKind_JSON_ARRAY: gql.NewNonNull(gql.NewList(gql.NewNonNull(schemaTypes.JSONScalarType))), + client.FieldKind_BOOL_NILLABLE_ARRAY: gql.NewList(gql.NewNonNull(gql.Boolean)), + client.FieldKind_INT_NILLABLE_ARRAY: gql.NewList(gql.NewNonNull(gql.Int)), + client.FieldKind_FLOAT_NILLABLE_ARRAY: gql.NewList(gql.NewNonNull(gql.Float)), + client.FieldKind_DATETIME_NILLABLE_ARRAY: gql.NewList(gql.NewNonNull(gql.DateTime)), + client.FieldKind_STRING_NILLABLE_ARRAY: gql.NewList(gql.NewNonNull(gql.String)), + client.FieldKind_BLOB_NILLABLE_ARRAY: gql.NewList(gql.NewNonNull(schemaTypes.BlobScalarType)), + client.FieldKind_JSON_NILLABLE_ARRAY: gql.NewList(gql.NewNonNull(schemaTypes.JSONScalarType)), + client.FieldKind_NILLABLE_BOOL_ARRAY: gql.NewNonNull(gql.NewList(gql.Boolean)), + client.FieldKind_NILLABLE_INT_ARRAY: gql.NewNonNull(gql.NewList(gql.Int)), + client.FieldKind_NILLABLE_FLOAT_ARRAY: gql.NewNonNull(gql.NewList(gql.Float)), + client.FieldKind_NILLABLE_DATETIME_ARRAY: gql.NewNonNull(gql.NewList(gql.DateTime)), + client.FieldKind_NILLABLE_STRING_ARRAY: gql.NewNonNull(gql.NewList(gql.String)), + client.FieldKind_NILLABLE_BLOB_ARRAY: gql.NewNonNull(gql.NewList(schemaTypes.BlobScalarType)), + client.FieldKind_NILLABLE_JSON_ARRAY: gql.NewNonNull(gql.NewList(schemaTypes.JSONScalarType)), + client.FieldKind_NILLABLE_BOOL_NILLABLE_ARRAY: gql.NewList(gql.Boolean), + client.FieldKind_NILLABLE_INT_NILLABLE_ARRAY: gql.NewList(gql.Int), + client.FieldKind_NILLABLE_FLOAT_NILLABLE_ARRAY: gql.NewList(gql.Float), + client.FieldKind_NILLABLE_DATETIME_NILLABLE_ARRAY: gql.NewList(gql.DateTime), + client.FieldKind_NILLABLE_STRING_NILLABLE_ARRAY: gql.NewList(gql.String), + client.FieldKind_NILLABLE_BLOB_NILLABLE_ARRAY: gql.NewList(schemaTypes.BlobScalarType), + client.FieldKind_NILLABLE_JSON_NILLABLE_ARRAY: gql.NewList(schemaTypes.JSONScalarType), } defaultCRDTForFieldKind = map[client.FieldKind]client.CType{ - client.FieldKind_DocID: client.LWW_REGISTER, - client.FieldKind_NILLABLE_BOOL: client.LWW_REGISTER, - client.FieldKind_BOOL_ARRAY: client.LWW_REGISTER, - client.FieldKind_NILLABLE_BOOL_ARRAY: client.LWW_REGISTER, - client.FieldKind_NILLABLE_INT: client.LWW_REGISTER, - client.FieldKind_INT_ARRAY: client.LWW_REGISTER, - client.FieldKind_NILLABLE_INT_ARRAY: client.LWW_REGISTER, - client.FieldKind_NILLABLE_FLOAT: client.LWW_REGISTER, - client.FieldKind_FLOAT_ARRAY: client.LWW_REGISTER, - client.FieldKind_NILLABLE_FLOAT_ARRAY: client.LWW_REGISTER, - client.FieldKind_NILLABLE_DATETIME: client.LWW_REGISTER, - client.FieldKind_NILLABLE_STRING: client.LWW_REGISTER, - client.FieldKind_STRING_ARRAY: client.LWW_REGISTER, - client.FieldKind_NILLABLE_STRING_ARRAY: client.LWW_REGISTER, - client.FieldKind_NILLABLE_BLOB: client.LWW_REGISTER, - client.FieldKind_NILLABLE_JSON: client.LWW_REGISTER, + client.FieldKind_DocID: client.LWW_REGISTER, + client.FieldKind_BOOL: client.LWW_REGISTER, + client.FieldKind_INT: client.LWW_REGISTER, + client.FieldKind_FLOAT: client.LWW_REGISTER, + client.FieldKind_DATETIME: client.LWW_REGISTER, + client.FieldKind_STRING: client.LWW_REGISTER, + client.FieldKind_BLOB: client.LWW_REGISTER, + client.FieldKind_JSON: client.LWW_REGISTER, + client.FieldKind_NILLABLE_BOOL: client.LWW_REGISTER, + client.FieldKind_NILLABLE_INT: client.LWW_REGISTER, + client.FieldKind_NILLABLE_FLOAT: client.LWW_REGISTER, + client.FieldKind_NILLABLE_DATETIME: client.LWW_REGISTER, + client.FieldKind_NILLABLE_STRING: client.LWW_REGISTER, + client.FieldKind_NILLABLE_BLOB: client.LWW_REGISTER, + client.FieldKind_NILLABLE_JSON: client.LWW_REGISTER, + client.FieldKind_BOOL_ARRAY: client.LWW_REGISTER, + client.FieldKind_INT_ARRAY: client.LWW_REGISTER, + client.FieldKind_FLOAT_ARRAY: client.LWW_REGISTER, + client.FieldKind_DATETIME_ARRAY: client.LWW_REGISTER, + client.FieldKind_STRING_ARRAY: client.LWW_REGISTER, + client.FieldKind_BLOB_ARRAY: client.LWW_REGISTER, + client.FieldKind_JSON_ARRAY: client.LWW_REGISTER, + client.FieldKind_BOOL_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_INT_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_FLOAT_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_STRING_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_DATETIME_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_BLOB_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_JSON_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_BOOL_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_INT_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_FLOAT_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_STRING_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_DATETIME_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_BLOB_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_JSON_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_BOOL_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_INT_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_FLOAT_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_STRING_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_DATETIME_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_BLOB_NILLABLE_ARRAY: client.LWW_REGISTER, + client.FieldKind_NILLABLE_JSON_NILLABLE_ARRAY: client.LWW_REGISTER, } ) diff --git a/request/graphql/schema/generate.go b/request/graphql/schema/generate.go index fc706041d8..771da05d7f 100644 --- a/request/graphql/schema/generate.go +++ b/request/graphql/schema/generate.go @@ -474,7 +474,14 @@ func (g *Generator) buildTypes( ttype = gql.NewList(t) } else { var ok bool - ttype, ok = fieldKindToGQLType[field.Kind] + k := field.Kind + mm := fieldKindToGQLType + ttype, ok = mm[k] + dd, okk := mm[client.FieldKind_BOOL_NILLABLE_ARRAY] + okk = okk + dd = dd + eq := k == client.FieldKind_BOOL_NILLABLE_ARRAY + eq = eq if !ok { return nil, NewErrTypeNotFound(fmt.Sprint(field.Kind)) }