Skip to content
This repository was archived by the owner on Aug 18, 2021. It is now read-only.
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

LightRepository won't correctly validate enumerable properties #26

Open
@guilhermeluizsp

Description

@guilhermeluizsp

Looking at the Validate method inside the LightRepository class, from line 151 we can notice that when it encounters a property which is an IList, it recursively validates its children:

https://github.com/Avanade/Liquid-Application-Framework/blob/d625dff6d3af90fc9aba210f8898564b7b4f02c7/src/Liquid.Repository/LightRepository.cs#L120-L186

If we take a closer look at line 160, we can spot the bug. It's checking if the property type is generic instead of the current item's type. This looks like a copy & paste typo.

So, this will not validate enumerables at all.

To prove this is really a bug, try passing the class below as an argument and you'll see that it will not validate the TestList property:

public class InheritsLightModel : LightModel<InheritsLightModel>
{
    //this property will not be validated
    public List<InheritsLightModel> TestList { get; set; }

    public override void Validate()
    {
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomplexity:lowThe complexity of the issue is lowpriorityThis issue should be acted upon before other issues.size:smallThe size of the issue is small

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions