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 Mar 14, 2024
1 parent 3585d60 commit c8875cc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/NJsonSchema/DefaultTypeNameGenerator.cs
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 c8875cc

Please sign in to comment.