DamianEdwards / DamianEdwards/MiniValidation

Support required modifier

Open
#76 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
390
Forks
35
PR merge metrics
No merged PRs in 30d

Description

It would be nice if the required modifier could be considered a way of making properties required. You could think of the following:

class Model
{
    public required string MakeRequired { get; init; } // When analyzing this property, add a default instance of a RequiredAttribute to the list of validation attributes/

    public required int ValueType { get; init; } // Ignore, adding a required attribute will not change a thing.
  
    public required string? NullableReference { get; init; } // Ingore, it must be set, but null is considered valid option.

    [Any]
    public required int[] SomeObject { get; init; } // Ignore, AnyAttribute inherits from RequiredAttribute and should prevail.
}

What do you think?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests, but provides C# property examples for the proposed behavior. Start by tracing how MiniValidation analyzes property metadata and validation attributes, then compare non-nullable reference types, value types, nullable references, and existing RequiredAttribute-derived attributes. Done means the required modifier is handled according to all four examples with coverage for each case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.