Skip to content

Type Name Generators

Rico Suter edited this page Jun 30, 2017 · 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(
        JsonSchema4 schema, 
        string typeNameHint, 
        IEnumerable<string> reservedTypeNames)
    {
        ...
    }
}

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