Skip to content

Commit 00e1c5f

Browse files
authored
Added @specifiedBy to LocalDate scalar (#8868)
1 parent 7faac2e commit 00e1c5f

File tree

28 files changed

+71
-44
lines changed

28 files changed

+71
-44
lines changed

src/HotChocolate/Core/src/Types/Properties/TypeResources.Designer.cs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/HotChocolate/Core/src/Types/Properties/TypeResources.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<value>Unable to register a DataLoader with your DataLoader registry.</value>
5050
</data>
5151
<data name="DateTimeType_Description" xml:space="preserve">
52-
<value>The `DateTime` scalar represents an ISO-8601 compliant date time type.</value>
52+
<value>The `DateTime` scalar represents an exact point in time. This point in time is specified by having an offset to UTC and does not use a time zone.</value>
5353
</data>
5454
<data name="DateType_Description" xml:space="preserve">
5555
<value>The `Date` scalar represents an ISO-8601 compliant date type.</value>
@@ -982,7 +982,7 @@ Type: `{0}`</value>
982982
<value>The `LocalDateTime` scalar type is a local date/time string (i.e., with no associated timezone) with the format `YYYY-MM-DDThh:mm:ss`.</value>
983983
</data>
984984
<data name="LocalDateType_Description" xml:space="preserve">
985-
<value>The `LocalDate` scalar type represents an ISO date string, represented as UTF-8 character sequences YYYY-MM-DD. The scalar follows the specification defined in RFC3339</value>
985+
<value>The `LocalDate` scalar represents a date without a time-zone in the ISO-8601 calendar system.</value>
986986
</data>
987987
<data name="LocalTimeType_Description" xml:space="preserve">
988988
<value>The LocalTime scalar type is a local time string (i.e., with no associated timezone) in 24-hr HH:mm:ss.</value>

src/HotChocolate/Core/src/Types/Types/Scalars/DateTimeType.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@
77
namespace HotChocolate.Types;
88

99
/// <summary>
10-
/// This GraphQL Scalar represents an exact point in time.
11-
/// This point in time is specified by having an offset to UTC and does not use time zone.
10+
/// <para>
11+
/// This scalar represents an exact point in time. This point in time is specified by having an
12+
/// offset to UTC and does <b>not</b> use a time zone.
13+
/// </para>
14+
/// <para>
15+
/// It is a slightly refined version of
16+
/// <see href="https://tools.ietf.org/html/rfc3339">RFC 3339</see>, including the
17+
/// <see href="https://www.rfc-editor.org/errata/rfc3339">errata</see>.
18+
/// </para>
1219
/// </summary>
1320
/// <seealso href="https://scalars.graphql.org/andimarek/date-time.html">Specification</seealso>
1421
public class DateTimeType : ScalarType<DateTimeOffset, StringValueNode>

src/HotChocolate/Core/src/Types/Types/Scalars/LocalDateType.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
namespace HotChocolate.Types;
77

88
/// <summary>
9-
/// The `LocalDate` scalar type represents an ISO date string, represented as UTF-8
10-
/// character sequences YYYY-MM-DD. The scalar follows the specification defined in
11-
/// <a href="https://tools.ietf.org/html/rfc3339">RFC3339</a>
9+
/// <para>
10+
/// This scalar represents a date without a time-zone in the
11+
/// <see href="https://en.wikipedia.org/wiki/ISO_8601">ISO-8601</see> calendar system.
12+
/// </para>
13+
/// <para>
14+
/// The pattern is "YYYY-MM-DD" with "YYYY" representing the year, "MM" the month, and "DD" the day.
15+
/// </para>
1216
/// </summary>
17+
/// <seealso href="https://scalars.graphql.org/andimarek/local-date.html">Specification</seealso>
1318
public class LocalDateType : ScalarType<DateOnly, StringValueNode>
1419
{
1520
private const string LocalFormat = "yyyy-MM-dd";
21+
private const string SpecifiedByUri = "https://scalars.graphql.org/andimarek/local-date.html";
1622
private readonly bool _enforceSpecFormat;
1723

1824
/// <summary>
@@ -26,6 +32,7 @@ public LocalDateType(
2632
: base(name, bind)
2733
{
2834
Description = description;
35+
SpecifiedBy = new Uri(SpecifiedByUri);
2936
_enforceSpecFormat = !disableFormatCheck;
3037
}
3138

src/HotChocolate/Core/test/Execution.Tests/__resources__/Crypto.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ type HistoryEdge {
350350
}
351351

352352
"""
353-
The `DateTime` scalar represents an ISO-8601 compliant date time type.
353+
The `DateTime` scalar represents an exact point in time. This point in time is specified by having an offset to UTC and does not use a time zone.
354354
"""
355355
scalar DateTime
356356

src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscoveryTests.InferDateTime.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
schema {
1+
schema {
22
query: QueryWithDateTime
33
}
44

@@ -10,5 +10,5 @@ type QueryWithDateTime {
1010
"The `@specifiedBy` directive is used within the type system definition language to provide a URL for specifying the behavior of custom scalar definitions."
1111
directive @specifiedBy("The specifiedBy URL points to a human-readable specification. This field will only read a result for scalar types." url: String!) on SCALAR
1212

13-
"The `DateTime` scalar represents an ISO-8601 compliant date time type."
13+
"The `DateTime` scalar represents an exact point in time. This point in time is specified by having an offset to UTC and does not use a time zone."
1414
scalar DateTime @specifiedBy(url: "https:\/\/scalars.graphql.org\/andimarek\/date-time.html")

src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscoveryTests.InferDateTimeFromModel.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ directive @specifiedBy("The specifiedBy URL points to a human-readable specifica
5151
"The `Date` scalar represents an ISO-8601 compliant date type."
5252
scalar Date
5353

54-
"The `DateTime` scalar represents an ISO-8601 compliant date time type."
54+
"The `DateTime` scalar represents an exact point in time. This point in time is specified by having an offset to UTC and does not use a time zone."
5555
scalar DateTime @specifiedBy(url: "https:\/\/scalars.graphql.org\/andimarek\/date-time.html")

src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscoveryTests.TypeDiscovery_Should_InferStructs.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type QueryTypeWithStruct {
2121
"The `@specifiedBy` directive is used within the type system definition language to provide a URL for specifying the behavior of custom scalar definitions."
2222
directive @specifiedBy("The specifiedBy URL points to a human-readable specification. This field will only read a result for scalar types." url: String!) on SCALAR
2323

24-
"The `DateTime` scalar represents an ISO-8601 compliant date time type."
24+
"The `DateTime` scalar represents an exact point in time. This point in time is specified by having an offset to UTC and does not use a time zone."
2525
scalar DateTime @specifiedBy(url: "https:\/\/scalars.graphql.org\/andimarek\/date-time.html")
2626

2727
scalar UUID @specifiedBy(url: "https:\/\/tools.ietf.org\/html\/rfc4122")

src/HotChocolate/Core/test/Types.Tests/Types/Directives/SpecifiedByDirectiveTypeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type Query1 {
5757
"The `@specifiedBy` directive is used within the type system definition language to provide a URL for specifying the behavior of custom scalar definitions."
5858
directive @specifiedBy("The specifiedBy URL points to a human-readable specification. This field will only read a result for scalar types." url: String!) on SCALAR
5959
60-
"The `DateTime` scalar represents an ISO-8601 compliant date time type."
60+
"The `DateTime` scalar represents an exact point in time. This point in time is specified by having an offset to UTC and does not use a time zone."
6161
scalar DateTime @specifiedBy(url: "https:\/\/scalars.graphql.org\/andimarek\/date-time.html")
6262
""")
6363
.UseField(next => next)

src/HotChocolate/Core/test/Types.Tests/Types/Directives/__snapshots__/SpecifiedByDirectiveTypeTests.EnsureSpecifiedByDirectiveExistsInSdl.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ type Query1 {
99
"The `@specifiedBy` directive is used within the type system definition language to provide a URL for specifying the behavior of custom scalar definitions."
1010
directive @specifiedBy("The specifiedBy URL points to a human-readable specification. This field will only read a result for scalar types." url: String!) on SCALAR
1111

12-
"The `DateTime` scalar represents an ISO-8601 compliant date time type."
12+
"The `DateTime` scalar represents an exact point in time. This point in time is specified by having an offset to UTC and does not use a time zone."
1313
scalar DateTime @specifiedBy(url: "https:\/\/scalars.graphql.org\/andimarek\/date-time.html")

0 commit comments

Comments
 (0)