Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/TestSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public sealed class Query
public ResultNullable GetWithNullableVariables(
JsonElement? any,
bool? boolean,
byte? @byte,
sbyte? @byte,
[GraphQLType<ByteArrayType>] byte[]? byteArray,
[GraphQLType<DateType>] DateOnly? date,
DateTimeOffset? dateTime,
Expand Down Expand Up @@ -71,7 +71,7 @@ public ResultNullable GetWithNullableVariables(
public ResultNonNullable GetWithNonNullableVariables(
JsonElement any,
bool boolean,
byte @byte,
sbyte @byte,
[GraphQLType<NonNullType<ByteArrayType>>] byte[] byteArray,
[GraphQLType<NonNullType<DateType>>] DateOnly date,
DateTimeOffset dateTime,
Expand Down Expand Up @@ -121,7 +121,7 @@ public ResultNonNullable GetWithNonNullableVariables(
public ResultDefaulted GetWithDefaultedVariables(
JsonElement any,
bool boolean,
byte @byte,
sbyte @byte,
[GraphQLType<NonNullType<ByteArrayType>>] byte[] byteArray,
[GraphQLType<NonNullType<DateType>>] DateOnly date,
DateTimeOffset dateTime,
Expand Down Expand Up @@ -324,7 +324,7 @@ public sealed record ObjectWithOneOfField(
public sealed record ResultNullable(
JsonElement? Any,
bool? Boolean,
byte? Byte,
sbyte? Byte,
[property: GraphQLType<ByteArrayType>] byte[]? ByteArray,
[property: GraphQLType<DateType>] DateOnly? Date,
DateTimeOffset? DateTime,
Expand All @@ -349,7 +349,7 @@ public sealed record ResultNullable(
public sealed record ResultNonNullable(
JsonElement Any,
bool Boolean,
byte Byte,
sbyte Byte,
[property: GraphQLType<NonNullType<ByteArrayType>>] byte[] ByteArray,
[property: GraphQLType<NonNullType<DateType>>] DateOnly Date,
DateTimeOffset DateTime,
Expand All @@ -374,7 +374,7 @@ public sealed record ResultNonNullable(
public sealed record ResultDefaulted(
JsonElement Any,
bool Boolean,
byte Byte,
sbyte Byte,
[property: GraphQLType<NonNullType<ByteArrayType>>] byte[] ByteArray,
[property: GraphQLType<NonNullType<DateType>>] DateOnly Date,
DateTimeOffset DateTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
"byte": {
"type": "integer",
"description": "The `Byte` scalar type represents non-fractional whole numeric values. Byte can represent values between 0 and 255.",
"description": "The Byte scalar type represents an 8-bit signed integer with a minimum value of -128 and a maximum value of 127.",
"format": "int32"
},
"byteArray": {
Expand Down Expand Up @@ -296,7 +296,7 @@
"null",
"integer"
],
"description": "The `Byte` scalar type represents non-fractional whole numeric values. Byte can represent values between 0 and 255.",
"description": "The Byte scalar type represents an 8-bit signed integer with a minimum value of -128 and a maximum value of 127.",
"format": "int32"
},
"byteArray": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"byte": {
"type": "string",
"description": "The `Byte` scalar type represents non-fractional whole numeric values. Byte can represent values between 0 and 255."
"description": "The Byte scalar type represents an 8-bit signed integer with a minimum value of -128 and a maximum value of 127."
},
"byteArray": {
"type": "string"
Expand Down Expand Up @@ -227,7 +227,7 @@
"null",
"string"
],
"description": "The `Byte` scalar type represents non-fractional whole numeric values. Byte can represent values between 0 and 255."
"description": "The Byte scalar type represents an 8-bit signed integer with a minimum value of -128 and a maximum value of 127."
},
"byteArray": {
"type": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"byte": {
"type": "integer",
"description": "The `Byte` scalar type represents non-fractional whole numeric values. Byte can represent values between 0 and 255.",
"description": "The Byte scalar type represents an 8-bit signed integer with a minimum value of -128 and a maximum value of 127.",
"format": "int32"
},
"byteArray": {
Expand Down Expand Up @@ -287,7 +287,7 @@
},
"byte": {
"type": "integer",
"description": "The `Byte` scalar type represents non-fractional whole numeric values. Byte can represent values between 0 and 255.",
"description": "The Byte scalar type represents an 8-bit signed integer with a minimum value of -128 and a maximum value of 127.",
"format": "int32",
"nullable": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"byte": {
"type": "string",
"description": "The `Byte` scalar type represents non-fractional whole numeric values. Byte can represent values between 0 and 255."
"description": "The Byte scalar type represents an 8-bit signed integer with a minimum value of -128 and a maximum value of 127."
},
"byteArray": {
"type": "string"
Expand Down Expand Up @@ -215,7 +215,7 @@
},
"byte": {
"type": "string",
"description": "The `Byte` scalar type represents non-fractional whole numeric values. Byte can represent values between 0 and 255.",
"description": "The Byte scalar type represents an 8-bit signed integer with a minimum value of -128 and a maximum value of 127.",
"nullable": true
},
"byteArray": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public sealed record Object3NonNullable(
public sealed record ComplexObject(
[property: GraphQLType<AnyType>] object? Any,
bool? Boolean,
byte? Byte,
sbyte? Byte,
[property: GraphQLType<ByteArrayType>] byte[]? ByteArray,
[property: GraphQLType<DateType>] DateOnly? Date,
DateTimeOffset? DateTime,
Expand All @@ -205,7 +205,7 @@ public sealed record ComplexObject(
public sealed record ComplexObjectInput(
[property: GraphQLType<NonNullType<AnyType>>] object Any,
bool Boolean,
byte Byte,
sbyte Byte,
[property: GraphQLType<NonNullType<ByteArrayType>>] byte[] ByteArray,
[property: GraphQLType<NonNullType<DateType>>] DateOnly Date,
DateTimeOffset DateTime,
Expand Down
13 changes: 12 additions & 1 deletion src/HotChocolate/Core/src/Types.Json/JsonObjectTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ internal static void InferResolver(
};
return;

case ScalarNames.Byte:
case ScalarNames.UnsignedByte:
def.PureResolver = ctx =>
{
var property = ctx.GetProperty(propertyName);
Expand All @@ -208,6 +208,17 @@ internal static void InferResolver(
};
return;

case ScalarNames.Byte:
def.PureResolver = ctx =>
{
var property = ctx.GetProperty(propertyName);

return property is null or { ValueKind: JsonValueKind.Null }
? null
: property.Value.GetSByte();
};
return;

case ScalarNames.ByteArray:
def.PureResolver = ctx =>
{
Expand Down
Loading
Loading