0

I'm using NJsonSchema for schema generation from C# types.

public sealed class Config
{
    [JsonConstructor]
    public Config([RegularExpression("Name.*123")] string name)
    {
        Name = name;
    }

    public string Name { get; }
}

And trying to generate like this:

var schema = JsonSchema.FromTypeAsync<Config>().Result;

But generator uses class properties instead of constructor for schema generation. How to specify to use constructor?

Said
  • 689
  • 6
  • 20
Hopeless
  • 579
  • 1
  • 8
  • 25

0 Answers0