Skip to content

Commit 4743388

Browse files
committed
Fix constant usage
1 parent 47a3727 commit 4743388

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Source/Common/ContextJsonConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public override JsonLdContext Read(ref Utf8JsonReader reader, Type typeToConvert
6363
{
6464
if (entry.TryGetProperty("name", out var nameElement))
6565
{
66-
name ??= nameElement.GetString() ?? "http://schema.org";
66+
name ??= nameElement.GetString() ?? Constants.HttpsSchemaOrgUrl;
6767
}
6868

6969
if (entry.TryGetProperty("@language", out var languageElement))

Source/Common/EnumHelper.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ namespace Schema.NET
99
/// </summary>
1010
internal static class EnumHelper
1111
{
12-
private const int HttpSchemaOrgLength = 18; // equivalent to "http://schema.org/".Length
13-
private const int HttpsSchemaOrgLength = 19; // equivalent to "https://schema.org/".Length
14-
1512
/// <summary>
1613
/// Converts the string representation of the name or numeric value of one or more
1714
/// enumerated constants to an equivalent enumerated object.
@@ -67,13 +64,13 @@ public static bool TryParseEnumFromSchemaUri(
6764
if (value is not null && value.StartsWith(Constants.HttpSchemaOrgUrl, StringComparison.OrdinalIgnoreCase))
6865
{
6966
#pragma warning disable IDE0057 // Use range operator. Need to multi-target.
70-
enumString = value.Substring(HttpSchemaOrgLength);
67+
enumString = value.Substring(Constants.HttpSchemaOrgUrl.Length);
7168
#pragma warning restore IDE0057 // Use range operator. Need to multi-target.
7269
}
7370
else if (value is not null && value.StartsWith(Constants.HttpsSchemaOrgUrl, StringComparison.OrdinalIgnoreCase))
7471
{
7572
#pragma warning disable IDE0057 // Use range operator. Need to multi-target.
76-
enumString = value.Substring(HttpsSchemaOrgLength);
73+
enumString = value.Substring(Constants.HttpsSchemaOrgUrl.Length);
7774
#pragma warning restore IDE0057 // Use range operator. Need to multi-target.
7875
}
7976
else

0 commit comments

Comments
 (0)