Skip to content

Commit 1b7514b

Browse files
authored
Merge pull request #64 from Linq2GraphQL/customscalar-object
CustomScalar works with object
2 parents fa6f498 + 922717c commit 1b7514b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/Linq2GraphQL.Client/Common/CustomScalar.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
{
33
public class CustomScalar
44
{
5-
internal string InternalValue { get; set; }
5+
internal object InternalValue { get; set; }
66

77
public override string ToString()
88
{
9-
return InternalValue;
9+
return InternalValue?.ToString();
1010
}
1111

12-
public virtual string Value
12+
public virtual object Value
1313
{
1414
get { return InternalValue; }
1515

src/Linq2GraphQL.Client/Converters/CustomScalarConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public override TScalar Read(ref Utf8JsonReader reader, Type typeToConvert, Json
2727

2828
public override void Write(Utf8JsonWriter writer, TScalar value, JsonSerializerOptions options)
2929
{
30-
writer.WriteStringValue(value.InternalValue);
30+
writer.WriteStringValue(value.InternalValue?.ToString());
3131
}
3232

3333
}

test/Linq2GraphQL.TestClientNullable/ExtendedScalars/MacAddress.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ public MacAddress(string value)
1616
Value = value;
1717
}
1818

19-
public override string Value
19+
20+
21+
22+
public override object Value
2023
{
2124
get
2225
{

0 commit comments

Comments
 (0)