jezzsantos / saastack

A comprehensive codebase template for starting your real-world, fully featured SaaS web products. On the .NET platform
The Unlicense
44 stars 13 forks source link

Support enumerations in request objects #42

Closed jezzsantos closed 3 months ago

jezzsantos commented 3 months ago

Lets say I have this definition of a request:

/// <summary>
///     Tests the use of enums in the request
/// </summary>
[Route("/testingonly/general/enum", OperationMethod.Post)]
public class PostWithEnumTestingOnlyRequest : IWebRequest<StringMessageTestingOnlyResponse>
{
    public TestEnum? AnEnum { get; set; }

    public string? AProperty { get; set; }
}

public enum TestEnum
{
    Value1,
    Value2,
    Value3
}

The serializer cannot handle the enum definition in the request.

However it can handle this request:

[Route("/testingonly/general/enum", OperationMethod.Post)]
public class PostWithEnumTestingOnlyRequest : IWebRequest<StringMessageTestingOnlyResponse>
{
    public string? AnEnum { get; set; }

    public string? AProperty { get; set; }
}