Skip to content

Commit

Permalink
Optimize JSON schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
kingcean committed Feb 29, 2024
1 parent a7312e5 commit c18983b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Core/Text/Json/Values.cs
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ internal static JsonNodeSchemaDescription ConvertToObjectSchema(JsonObjectNode j
{
if (json == null) return null;
var type = json.TryGetStringTrimmedValue("type") ?? string.Empty;
return type switch
return type.Trim().ToLowerInvariant() switch
{
"object" => new JsonObjectSchemaDescription(json),
"string" => new JsonStringSchemaDescription(json),
Expand Down
2 changes: 2 additions & 0 deletions Core/Text/JsonSchema/Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ public JsonNodeSchemaDescription(JsonNodeSchemaDescription copy) : base(Internal
internal JsonNodeSchemaDescription(JsonObjectNode json)
: this(json, false)
{
if (json == null) return;
ExtendedProperties.SetValueIfNotEmpty("type", json.TryGetStringValue("type"));
}

/// <summary>
Expand Down

0 comments on commit c18983b

Please sign in to comment.