{"id":25003739,"url":"https://github.com/furkandeveloper/fluentoptionvalidation","last_synced_at":"2025-08-09T19:48:26.024Z","repository":{"id":275338650,"uuid":"925727572","full_name":"furkandeveloper/FluentOptionValidation","owner":"furkandeveloper","description":"This repo, provides option pattern validation with Fluent Validation","archived":false,"fork":false,"pushed_at":"2025-02-01T19:12:43.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T20:18:31.984Z","etag":null,"topics":["fluentvalidation","option","option-pattern","validation"],"latest_commit_sha":null,"homepage":"","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/furkandeveloper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-01T15:50:13.000Z","updated_at":"2025-02-01T19:12:47.000Z","dependencies_parsed_at":"2025-02-01T20:18:34.078Z","dependency_job_id":"5c516e55-39ac-424c-929c-f482c74d630a","html_url":"https://github.com/furkandeveloper/FluentOptionValidation","commit_stats":null,"previous_names":["furkandeveloper/fluentoptionvalidation"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/furkandeveloper%2FFluentOptionValidation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/furkandeveloper%2FFluentOptionValidation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/furkandeveloper%2FFluentOptionValidation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/furkandeveloper%2FFluentOptionValidation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/furkandeveloper","download_url":"https://codeload.github.com/furkandeveloper/FluentOptionValidation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246249221,"owners_count":20747168,"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":["fluentvalidation","option","option-pattern","validation"],"created_at":"2025-02-04T22:36:24.847Z","updated_at":"2025-03-29T22:12:36.134Z","avatar_url":"https://github.com/furkandeveloper.png","language":"C#","readme":"## Readme\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/215e58b1-12f1-4c1a-b22f-85fe9de2b6be\" style=\"max-width:100%;\" height=\"140\" /\u003e\n\u003c/p\u003e\n\n\n## Give a Star 🌟\nIf you liked the project or if **FluentOptionValidation** helped you, please give a star.\n\n### Purpose\n**FluentValidationOption(OptionValidationSharp)** provides option validation with Fluent Validation.\n\n### How To Use(?)\n\n### Install\n\n```bash\ndotnet add package OptionValidationSharp\n```\nExample appsettings.json file\n\n```json\n\"AppSettings\": {\n    \"ApplicationName\": \"MyApp\",\n    \"MaxUsers\": 500,\n    \"Url\": \"https://github.com\"\n  }\n```\n\nExample Option Class\n\n```csharp\npublic class AppSettings\n{\n    public string? ApplicationName { get; set; }\n    \n    public int MaxUsers { get; set; }\n    \n    public string? Url { get; set; }\n}\n```\n\nExample Option Validation Class\n\n```csharp\npublic class AppSettingsValidator : AbstractValidator\u003cAppSettings\u003e\n{\n    public AppSettingsValidator()\n    {\n        RuleFor(r =\u003e r.ApplicationName).NotEmpty();\n        RuleFor(r =\u003e r.MaxUsers).InclusiveBetween(1,100);\n        RuleFor(r =\u003e r.Url).NotEmpty();\n        RuleFor(r =\u003e r.Url)\n            .Must(url =\u003e Uri.TryCreate(url, UriKind.Absolute, out _))\n            .When(r =\u003e !string.IsNullOrWhiteSpace(r.Url));\n    }\n}\n```\n\nUse in Program.cs\n\n```csharp\nbuilder.Services.AddValidatorsFromAssembly(typeof(Program).Assembly);\n\nbuilder.Services.AddOptions\u003cAppSettings\u003e()\n    .Bind(builder.Configuration.GetSection(\"AppSettings\"))\n    .ValidateOptionSharp() // \u003c- 🔨 Validation Option with Fluent Validation\n    .ValidateOnStart();\n```\n\nResult:\n\n```bash\nfail: Microsoft.Extensions.Hosting.Internal.Host[11]\nHosting failed to start\nMicrosoft.Extensions.Options.OptionsValidationException: Options validation failed for type 'AppSettings'. 'Max Users' must be between 1 and 100. You entered 500.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffurkandeveloper%2Ffluentoptionvalidation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffurkandeveloper%2Ffluentoptionvalidation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffurkandeveloper%2Ffluentoptionvalidation/lists"}