diff --git a/src/Linq2GraphQL.Client/Common/CustomScalar.cs b/src/Linq2GraphQL.Client/Common/CustomScalar.cs index 4a847f4f..988068eb 100644 --- a/src/Linq2GraphQL.Client/Common/CustomScalar.cs +++ b/src/Linq2GraphQL.Client/Common/CustomScalar.cs @@ -2,14 +2,14 @@ { public class CustomScalar { - internal string InternalValue { get; set; } + internal object InternalValue { get; set; } public override string ToString() { - return InternalValue; + return InternalValue?.ToString(); } - public virtual string Value + public virtual object Value { get { return InternalValue; } diff --git a/src/Linq2GraphQL.Client/Converters/CustomScalarConverter.cs b/src/Linq2GraphQL.Client/Converters/CustomScalarConverter.cs index 5a70f6bf..a5adf98b 100644 --- a/src/Linq2GraphQL.Client/Converters/CustomScalarConverter.cs +++ b/src/Linq2GraphQL.Client/Converters/CustomScalarConverter.cs @@ -27,7 +27,7 @@ public override TScalar Read(ref Utf8JsonReader reader, Type typeToConvert, Json public override void Write(Utf8JsonWriter writer, TScalar value, JsonSerializerOptions options) { - writer.WriteStringValue(value.InternalValue); + writer.WriteStringValue(value.InternalValue?.ToString()); } } diff --git a/test/Linq2GraphQL.TestClientNullable/ExtendedScalars/MacAddress.cs b/test/Linq2GraphQL.TestClientNullable/ExtendedScalars/MacAddress.cs index 228fa230..1831ff18 100644 --- a/test/Linq2GraphQL.TestClientNullable/ExtendedScalars/MacAddress.cs +++ b/test/Linq2GraphQL.TestClientNullable/ExtendedScalars/MacAddress.cs @@ -16,7 +16,10 @@ public MacAddress(string value) Value = value; } - public override string Value + + + + public override object Value { get {