Skip to content

FV When causes swagger to not be updated. #134

@niemyjski

Description

@niemyjski

I'm using the latest beta version on .NET 7 latest with the latest stable FV. I have the following record and validation rule and I noticed that my swagger doesn't include any of the not empty or length data (I was expecting these to be populated along side the nullable flag to control if they are optional):

public record MyModel(string? InviteToken = null);

public class MyModelValidator : AbstractValidator<MyModel>
{
    public MyModelValidator ()
    {
        RuleFor(u => u.InviteToken).NotEmpty().Length(40).When(m => m.InviteToken is not null);
    }
}

Looking at the generated swagger.json

            "MyModel": {
                "required": [
                ],
                "type": "object",
                "properties": {
                    "invite_token": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions