JKValidator 1.0.0

Package Description

Install-Package JKValidator -Version 1.0.0
dotnet add package JKValidator --version 1.0.0
<PackageReference Include="JKValidator" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JKValidator --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: JKValidator, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install JKValidator as a Cake Addin
#addin nuget:?package=JKValidator&version=1.0.0

// Install JKValidator as a Cake Tool
#tool nuget:?package=JKValidator&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

JKValidator NuGet Library

JKValidator is a simple C# properties validator.

Behind JKValidator:

JK stands for JOEVER and KEVIN , Kevin initially started the code implementation on 2018, together with Joever. 
The inspiration of this validator is to eradicate the old school way of validating the property
and to create standard property validator for Microsoft. 
We want to help developers who wants to change or improve their way of validating the properties, so we decide to publish this library on nuget.

NuGet: https://www.nuget.org/packages/JKValidator/

Usability:

JKValidator supported both dependecy injection and static method way of implementations. Available Property Validators:

  1. Boolean
  2. DateTime
  3. Double
  4. Int
  5. Object
  6. String
  7. TimeSpan

Requirements:

  1. NET Core 3.1
  2. Visual Studio or VS Code

How to download:

  1. Go to Tools and select Manage Nuget Packages and Search for JKValidator library.
  2. OR Install-Package JKValidator -Version 1.0.1

For Depency Injection:

  1. Add IValidators on IServiceCollection in Startup.cs
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped<IValidators, Validators>();
        }

For Static class:

  1. Just simply instantiate the Validators inside your method.
        public static ValidationError Test()
        {
            Validators v = new Validators();

            v.IsString("JK", "object", true);
            if (v.ContainsError())
                return v.AsValidationError();
            return null;    
        }

Validator methods:

  1. .IsString(model.FirstName, "firstName", true)
  2. .IsString(model.FirstName, "firstName", true).Min(3).Max(10)
  3. .IsString(model.LastName, "@Test123", true).IsAlphaNumericSymbol()
  4. .IsString(model.LastName, "jk@gmail.com", true).IsEmail();
  5. .IsNumber(model.One, "one", true)
  6. .IsBool(model.IsTrue, "isTrue", true)
  7. .IsDateTime(model.DateTime, "dateTime", true)
  8. .IsObject(model.Object, "object", true)

Results

{
    "statusCode": 400,
    "title": "Validation Failed",
    "message": "The form contains invalid fields",
    "payload": [
        {
            "name": "lastName",
            "errors": [
                "Property is required and must be set."
            ]
        }
    ],
    "tag": null,
    "type": "Error"
}

JKValidator NuGet Library

JKValidator is a simple C# properties validator.

Behind JKValidator:

JK stands for JOEVER and KEVIN , Kevin initially started the code implementation on 2018, together with Joever. 
The inspiration of this validator is to eradicate the old school way of validating the property
and to create standard property validator for Microsoft. 
We want to help developers who wants to change or improve their way of validating the properties, so we decide to publish this library on nuget.

NuGet: https://www.nuget.org/packages/JKValidator/

Usability:

JKValidator supported both dependecy injection and static method way of implementations. Available Property Validators:

  1. Boolean
  2. DateTime
  3. Double
  4. Int
  5. Object
  6. String
  7. TimeSpan

Requirements:

  1. NET Core 3.1
  2. Visual Studio or VS Code

How to download:

  1. Go to Tools and select Manage Nuget Packages and Search for JKValidator library.
  2. OR Install-Package JKValidator -Version 1.0.1

For Depency Injection:

  1. Add IValidators on IServiceCollection in Startup.cs
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped<IValidators, Validators>();
        }

For Static class:

  1. Just simply instantiate the Validators inside your method.
        public static ValidationError Test()
        {
            Validators v = new Validators();

            v.IsString("JK", "object", true);
            if (v.ContainsError())
                return v.AsValidationError();
            return null;    
        }

Validator methods:

  1. .IsString(model.FirstName, "firstName", true)
  2. .IsString(model.FirstName, "firstName", true).Min(3).Max(10)
  3. .IsString(model.LastName, "@Test123", true).IsAlphaNumericSymbol()
  4. .IsString(model.LastName, "jk@gmail.com", true).IsEmail();
  5. .IsNumber(model.One, "one", true)
  6. .IsBool(model.IsTrue, "isTrue", true)
  7. .IsDateTime(model.DateTime, "dateTime", true)
  8. .IsObject(model.Object, "object", true)

Results

{
    "statusCode": 400,
    "title": "Validation Failed",
    "message": "The form contains invalid fields",
    "payload": [
        {
            "name": "lastName",
            "errors": [
                "Property is required and must be set."
            ]
        }
    ],
    "tag": null,
    "type": "Error"
}

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 73 1/16/2021