{"id":15823783,"url":"https://github.com/stefh/stef.validation","last_synced_at":"2025-05-08T20:28:40.540Z","repository":{"id":44886653,"uuid":"333721199","full_name":"StefH/Stef.Validation","owner":"StefH","description":"Guard methods for argument validation (NotNull, NotEmpty, ...)","archived":false,"fork":false,"pushed_at":"2025-03-26T09:51:57.000Z","size":45,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-06T22:28:08.800Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StefH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-28T10:17:57.000Z","updated_at":"2025-03-26T09:52:01.000Z","dependencies_parsed_at":"2025-04-19T07:40:08.843Z","dependency_job_id":"2425301d-eca7-4f11-8059-02043923774e","html_url":"https://github.com/StefH/Stef.Validation","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FStef.Validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FStef.Validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FStef.Validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FStef.Validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StefH","download_url":"https://codeload.github.com/StefH/Stef.Validation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253143879,"owners_count":21860959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-05T08:22:57.378Z","updated_at":"2025-05-08T20:28:40.533Z","avatar_url":"https://github.com/StefH.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stef.Validation\nGuard methods for argument validation (NotNull, NotEmpty, ...)\n\n## Packages\n| NuGet | NuGet |\n| - | - |\n| Stef.Validation | [![NuGet Badge](https://img.shields.io/nuget/v/Stef.Validation)](https://www.nuget.org/packages/Stef.Validation)\n| Stef.Validation.Options | [![NuGet Badge](https://img.shields.io/nuget/v/Stef.Validation.Options)](https://www.nuget.org/packages/Stef.Validation.Options)\n\n## Introduction\n\nHere is a sample constructor that validates its arguments without Guard:\n\n``` c#\npublic Person(string name, int age)\n{\n    if (name == null)\n    {\n        throw new ArgumentNullException(nameof(name), \"Name cannot be null.\");\n    }\n\n    if (name.Length == 0)\n    {\n        throw new ArgumentException(\"Name cannot be empty.\", nameof(name));\n    }\n\n    if (age \u003c 0)\n    {\n        throw new ArgumentOutOfRangeException(nameof(age), age, \"Age cannot be negative.\");\n    }\n}\n```\n\n\nAnd this is how we write the same constructor with Stef.Validation:\n\n``` c#\nusing Stef.Validation;\n\npublic Person(string name, int age)\n{\n    Guard.NotNullOrEmpty(name, nameof(name));\n\n    Guard.NotNullOrEmpty(name); // It's also possible to omit the `nameof(...)`-statement because CallerArgumentExpression is used internally.\n\n    Guard.Condition(age, a =\u003e a \u003e 0, nameof(age));\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefh%2Fstef.validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefh%2Fstef.validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefh%2Fstef.validation/lists"}