Skip to content

Commit

Permalink
Moved LocalDate/LocalTime to HotChocolate.Types and added LocalDateTi…
Browse files Browse the repository at this point in the history
…me (#7749)
  • Loading branch information
glen-84 authored Jan 29, 2025
1 parent d97d21a commit 4adca9e
Show file tree
Hide file tree
Showing 42 changed files with 3,698 additions and 1,849 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions src/HotChocolate/Core/src/Types.Scalars/ScalarResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,6 @@
<data name="IsbnType_IsInvalid_ParseValue" xml:space="preserve">
<value>IsbnType cannot parse the provided value. The provided value is not a valid ISBN number.</value>
</data>
<data name="LocalDateType_Description" xml:space="preserve">
<value>The `LocalDate` scalar type represents a ISO date string, represented as UTF-8 character sequences YYYY-MM-DD. The scalar follows the specification defined in RFC3339</value>
</data>
<data name="LocalDateType_IsInvalid_ParseLiteral" xml:space="preserve">
<value>LocalDateType cannot parse the provided literal. The provided value is not a valid Local Date.</value>
</data>
<data name="LocalDateType_IsInvalid_ParseValue" xml:space="preserve">
<value>LocalDateType cannot parse the provided value. The provided value is not a valid Local Date.</value>
</data>
<data name="LatitudeType_Description" xml:space="preserve">
<value>The Latitude scalar type represents represents a valid decimal degrees latitude number.</value>
</data>
Expand All @@ -207,15 +198,6 @@
<data name="LatitudeType_IsInvalid_ParseValue" xml:space="preserve">
<value>LatitudeType cannot parse the provided value. The provided value was not a valid decimal degrees latitude number.</value>
</data>
<data name="LocalTimeType_Description" xml:space="preserve">
<value>The LocalTime scalar type is a local time string (i.e., with no associated timezone) in 24-hr HH:mm:ss.</value>
</data>
<data name="LocalTimeType_IsInvalid_ParseLiteral" xml:space="preserve">
<value>LocalTimeType cannot parse the provided literal. The provided value is not a valid Local Time.</value>
</data>
<data name="LocalTimeType_IsInvalid_ParseValue" xml:space="preserve">
<value>LocalTimeType cannot parse the provided value. The provided value is not a valid Local Time.</value>
</data>
<data name="LocalCurrencyType_Description" xml:space="preserve">
<value>The LocalCurrency scalar type is a currency string.</value>
</data>
Expand Down
46 changes: 1 addition & 45 deletions src/HotChocolate/Core/src/Types.Scalars/ThrowHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,28 +178,6 @@ public static SerializationException LatitudeType_ParseLiteral_IsInvalid(IType t
type);
}

public static SerializationException LocalDateType_ParseValue_IsInvalid(IType type)
{
return new SerializationException(
ErrorBuilder.New()
.SetMessage(ScalarResources.LocalDateType_IsInvalid_ParseValue)
.SetCode(ErrorCodes.Scalars.InvalidRuntimeType)
.SetExtension("actualType", WellKnownScalarTypes.LocalDate)
.Build(),
type);
}

public static SerializationException LocalDateType_ParseLiteral_IsInvalid(IType type)
{
return new SerializationException(
ErrorBuilder.New()
.SetMessage(ScalarResources.LocalDateType_IsInvalid_ParseLiteral)
.SetCode(ErrorCodes.Scalars.InvalidSyntaxFormat)
.SetExtension("actualType", WellKnownScalarTypes.LocalDate)
.Build(),
type);
}

public static SerializationException LocalCurrencyType_ParseValue_IsInvalid(IType type)
{
return new SerializationException(
Expand All @@ -215,35 +193,13 @@ public static SerializationException LocalCurrencyType_ParseLiteral_IsInvalid(IT
{
return new SerializationException(
ErrorBuilder.New()
.SetMessage(ScalarResources.LocalDateType_IsInvalid_ParseLiteral)
.SetMessage(ScalarResources.LocalCurrencyType_IsInvalid_ParseLiteral)
.SetCode(ErrorCodes.Scalars.InvalidSyntaxFormat)
.SetExtension("actualType", WellKnownScalarTypes.LocalCurrency)
.Build(),
type);
}

public static SerializationException LocalTimeType_ParseValue_IsInvalid(IType type)
{
return new SerializationException(
ErrorBuilder.New()
.SetMessage(ScalarResources.LocalTimeType_IsInvalid_ParseValue)
.SetCode(ErrorCodes.Scalars.InvalidRuntimeType)
.SetExtension("actualType", WellKnownScalarTypes.LocalTime)
.Build(),
type);
}

public static SerializationException LocalTimeType_ParseLiteral_IsInvalid(IType type)
{
return new SerializationException(
ErrorBuilder.New()
.SetMessage(ScalarResources.LocalTimeType_IsInvalid_ParseLiteral)
.SetCode(ErrorCodes.Scalars.InvalidSyntaxFormat)
.SetExtension("actualType", WellKnownScalarTypes.LocalTime)
.Build(),
type);
}

public static SerializationException LongitudeType_ParseValue_IsInvalid(IType type)
{
return new SerializationException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ internal static class WellKnownScalarTypes
public const string IPv6 = nameof(IPv6);
public const string Isbn = nameof(Isbn);
public const string Latitude = nameof(Latitude);
public const string LocalDate = nameof(LocalDate);
public const string LocalCurrency = nameof(LocalCurrency);
public const string LocalTime = nameof(LocalTime);
public const string Longitude = nameof(Longitude);
public const string MacAddress = nameof(MacAddress);
public const string NegativeFloat = nameof(NegativeFloat);
Expand Down
Loading

0 comments on commit 4adca9e

Please sign in to comment.