Skip to content

Type Name Generators

Rico Suter edited this page May 20, 2019 · 13 revisions

You can provide an implementation of ITypeNameGenerator via the CodeGeneratorSettingsBase.TypeNameGenerator setting to customize the class or interface name generation.

Usage

Just implement an own class implementing ITypeNameGenerator and assign an instance of the class to the settings' property:

public class MyTypeNameGenerator : ITypeNameGenerator
{
    public string Generate(
        JsonSchema schema, 
        string typeNameHint, 
        IEnumerable<string> reservedTypeNames)
    {
        ...
    }
}

settings.TypeNameGenerator = new MyTypeNameGenerator();
Clone this wiki locally