Skip to content

Commit

Permalink
fix(): Remove illegal characters before returning to reserved list (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenyaSICKAG committed Jun 12, 2024
1 parent 6c1807d commit c3380c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/NJsonSchema/DefaultTypeNameGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ public virtual string Generate(JsonSchema schema, string? typeNameHint, IEnumera
}

var typeName = Generate(schema, typeNameHint);
typeName = RemoveIllegalCharacters(typeName);

if (string.IsNullOrEmpty(typeName) || reservedTypeNames.Contains(typeName))
{
typeName = GenerateAnonymousTypeName(typeNameHint, reservedTypeNames);
}

return RemoveIllegalCharacters(typeName);
return typeName;
}

/// <summary>Generates the type name for the given schema.</summary>
Expand Down

0 comments on commit c3380c1

Please sign in to comment.