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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace HotChocolate.Adapters.Mcp.Extensions;
public sealed class TypeExtensionsTests
{
[Theory]
[InlineData(typeof(ByteArrayType), "dmFsdWU=")]
[InlineData(typeof(Base64StringType), "dmFsdWU=")]
// A DateTime with UTC offset (+00:00).
[InlineData(typeof(DateTimeType), "2011-08-30T13:22:53.108Z")]
// A DateTime with +00:00 which is the same as UTC.
Expand Down Expand Up @@ -42,7 +42,7 @@ public void ToJsonSchemaBuilder_ValidValues_MatchPattern(Type type, string value
}

[Theory]
[InlineData(typeof(ByteArrayType), "invalidBase64")]
[InlineData(typeof(Base64StringType), "invalidBase64")]
// The minutes of the offset are missing.
[InlineData(typeof(DateTimeType), "2011-08-30T13:22:53.108-03")]
// No offset provided.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,9 @@ await storage.AddOrUpdateToolAsync(
new Dictionary<string, object?>
{
{ "any", null },
{ "base64String", null },
{ "boolean", null },
{ "byte", null },
{ "byteArray", null },
{ "date", null },
{ "dateTime", null },
{ "decimal", null },
Expand Down Expand Up @@ -705,9 +705,9 @@ await storage.AddOrUpdateToolAsync(
new Dictionary<string, object?>
{
{ "any", new { key = "value" } },
{ "base64String", "dGVzdA==" },
{ "boolean", true },
{ "byte", 1 },
{ "byteArray", "dGVzdA==" },
{ "date", "2000-01-01" },
{ "dateTime", "2000-01-01T12:00:00Z" },
{ "decimal", 79228162514264337593543950335m },
Expand Down
18 changes: 9 additions & 9 deletions src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/TestSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public sealed class Query

public ResultNullable GetWithNullableVariables(
JsonElement? any,
[GraphQLType<Base64StringType>] byte[]? base64String,
bool? boolean,
sbyte? @byte,
[GraphQLType<ByteArrayType>] byte[]? byteArray,
[GraphQLType<DateType>] DateOnly? date,
DateTimeOffset? dateTime,
decimal? @decimal,
Expand All @@ -45,9 +45,9 @@ public ResultNullable GetWithNullableVariables(
=>
new(
any,
base64String,
boolean,
@byte,
byteArray,
date,
dateTime,
@decimal,
Expand All @@ -70,9 +70,9 @@ public ResultNullable GetWithNullableVariables(

public ResultNonNullable GetWithNonNullableVariables(
JsonElement any,
[GraphQLType<NonNullType<Base64StringType>>] byte[] base64String,
bool boolean,
sbyte @byte,
[GraphQLType<NonNullType<ByteArrayType>>] byte[] byteArray,
[GraphQLType<NonNullType<DateType>>] DateOnly date,
DateTimeOffset dateTime,
decimal @decimal,
Expand All @@ -95,9 +95,9 @@ public ResultNonNullable GetWithNonNullableVariables(
=>
new(
any,
base64String,
boolean,
@byte,
byteArray,
date,
dateTime,
@decimal,
Expand All @@ -120,9 +120,9 @@ public ResultNonNullable GetWithNonNullableVariables(

public ResultDefaulted GetWithDefaultedVariables(
JsonElement any,
[GraphQLType<NonNullType<Base64StringType>>] byte[] base64String,
bool boolean,
sbyte @byte,
[GraphQLType<NonNullType<ByteArrayType>>] byte[] byteArray,
[GraphQLType<NonNullType<DateType>>] DateOnly date,
DateTimeOffset dateTime,
decimal @decimal,
Expand All @@ -145,9 +145,9 @@ public ResultDefaulted GetWithDefaultedVariables(
=>
new(
any,
base64String,
boolean,
@byte,
byteArray,
date,
dateTime,
@decimal,
Expand Down Expand Up @@ -323,9 +323,9 @@ public sealed record ObjectWithOneOfField(

public sealed record ResultNullable(
JsonElement? Any,
[property: GraphQLType<Base64StringType>] byte[]? Base64String,
bool? Boolean,
sbyte? Byte,
[property: GraphQLType<ByteArrayType>] byte[]? ByteArray,
[property: GraphQLType<DateType>] DateOnly? Date,
DateTimeOffset? DateTime,
decimal? Decimal,
Expand All @@ -348,9 +348,9 @@ public sealed record ResultNullable(

public sealed record ResultNonNullable(
JsonElement Any,
[property: GraphQLType<NonNullType<Base64StringType>>] byte[] Base64String,
bool Boolean,
sbyte Byte,
[property: GraphQLType<NonNullType<ByteArrayType>>] byte[] ByteArray,
[property: GraphQLType<NonNullType<DateType>>] DateOnly Date,
DateTimeOffset DateTime,
decimal Decimal,
Expand All @@ -373,9 +373,9 @@ public sealed record ResultNonNullable(

public sealed record ResultDefaulted(
JsonElement Any,
[property: GraphQLType<NonNullType<Base64StringType>>] byte[] Base64String,
bool Boolean,
sbyte Byte,
[property: GraphQLType<NonNullType<ByteArrayType>>] byte[] ByteArray,
[property: GraphQLType<NonNullType<DateType>>] DateOnly Date,
DateTimeOffset DateTime,
decimal Decimal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
query GetWithDefaultedVariables(
"Any description"
$any: Any! = { key: "value" }
"Base64String description"
$base64String: Base64String! = "ZGVmYXVsdA=="
"Boolean description"
$boolean: Boolean! = true
"Byte description"
$byte: Byte! = 1
"ByteArray description"
$byteArray: ByteArray! = "ZGVmYXVsdA=="
"Date description"
$date: Date! = "2000-01-01"
"DateTime description"
Expand Down Expand Up @@ -49,9 +49,9 @@ query GetWithDefaultedVariables(
) {
withDefaultedVariables(
any: $any
base64String: $base64String
boolean: $boolean
byte: $byte
byteArray: $byteArray
date: $date
dateTime: $dateTime
decimal: $decimal
Expand All @@ -73,9 +73,9 @@ query GetWithDefaultedVariables(
uuid: $uuid
) {
any
base64String
boolean
byte
byteArray
date
dateTime
decimal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"GetWithNonNullableVariables description"
query GetWithNonNullableVariables(
"Any description" $any: Any!
"Base64String description" $base64String: Base64String!
"Boolean description" $boolean: Boolean!
"Byte description" $byte: Byte!
"ByteArray description" $byteArray: ByteArray!
"Date description" $date: Date!
"DateTime description" $dateTime: DateTime!
"Decimal description" $decimal: Decimal!
Expand All @@ -26,9 +26,9 @@ query GetWithNonNullableVariables(
) {
withNonNullableVariables(
any: $any
base64String: $base64String
boolean: $boolean
byte: $byte
byteArray: $byteArray
date: $date
dateTime: $dateTime
decimal: $decimal
Expand All @@ -50,9 +50,9 @@ query GetWithNonNullableVariables(
uuid: $uuid
) {
any
base64String
boolean
byte
byteArray
date
dateTime
decimal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"GetWithNullableVariables description"
query GetWithNullableVariables(
"Any description" $any: Any
"Base64String description" $base64String: Base64String
"Boolean description" $boolean: Boolean
"Byte description" $byte: Byte
"ByteArray description" $byteArray: ByteArray
"Date description" $date: Date
"DateTime description" $dateTime: DateTime
"Decimal description" $decimal: Decimal
Expand All @@ -26,9 +26,9 @@ query GetWithNullableVariables(
) {
withNullableVariables(
any: $any
base64String: $base64String
boolean: $boolean
byte: $byte
byteArray: $byteArray
date: $date
dateTime: $dateTime
decimal: $decimal
Expand All @@ -50,9 +50,9 @@ query GetWithNullableVariables(
uuid: $uuid
) {
any
base64String
boolean
byte
byteArray
date
dateTime
decimal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"any": {
"key": "value"
},
"base64String": "ZGVmYXVsdA==",
"boolean": true,
"byte": 1,
"byteArray": "ZGVmYXVsdA==",
"date": "2000-01-01",
"dateTime": "2000-01-01T12:00:00.000Z",
"decimal": 79228162514264337593543950335,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"any": {
"key": "value"
},
"base64String": "dGVzdA==",
"boolean": true,
"byte": 1,
"byteArray": "dGVzdA==",
"date": "2000-01-01",
"dateTime": "2000-01-01T12:00:00.000Z",
"decimal": 79228162514264337593543950335,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"data": {
"withNullableVariables": {
"any": null,
"base64String": null,
"boolean": null,
"byte": null,
"byteArray": null,
"date": null,
"dateTime": null,
"decimal": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"key": "value"
}
},
"base64String": {
"type": "string",
"pattern": "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$",
"description": "Base64String description",
"default": "ZGVmYXVsdA=="
},
"boolean": {
"type": "boolean",
"description": "Boolean description",
Expand All @@ -25,12 +31,6 @@
"description": "Byte description",
"default": 1
},
"byteArray": {
"type": "string",
"pattern": "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$",
"description": "ByteArray description",
"default": "ZGVmYXVsdA=="
},
"date": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
"integer"
]
},
"base64String": {
"type": "string",
"pattern": "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$"
},
"boolean": {
"type": "boolean"
},
"byte": {
"type": "integer"
},
"byteArray": {
"type": "string",
"pattern": "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$"
},
"date": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
Expand Down Expand Up @@ -140,9 +140,9 @@
},
"required": [
"any",
"base64String",
"boolean",
"byte",
"byteArray",
"date",
"dateTime",
"decimal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
],
"description": "Any description"
},
"base64String": {
"type": "string",
"pattern": "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$",
"description": "Base64String description"
},
"boolean": {
"type": "boolean",
"description": "Boolean description"
Expand All @@ -20,11 +25,6 @@
"type": "integer",
"description": "Byte description"
},
"byteArray": {
"type": "string",
"pattern": "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$",
"description": "ByteArray description"
},
"date": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
Expand Down Expand Up @@ -151,9 +151,9 @@
},
"required": [
"any",
"base64String",
"boolean",
"byte",
"byteArray",
"date",
"dateTime",
"decimal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
"integer"
]
},
"base64String": {
"type": "string",
"pattern": "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$"
},
"boolean": {
"type": "boolean"
},
"byte": {
"type": "integer"
},
"byteArray": {
"type": "string",
"pattern": "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$"
},
"date": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
Expand Down Expand Up @@ -140,9 +140,9 @@
},
"required": [
"any",
"base64String",
"boolean",
"byte",
"byteArray",
"date",
"dateTime",
"decimal",
Expand Down
Loading
Loading