Outsourcing validators to separate class-lib is not possible
See original GitHub issueI have the following project setup:
My requests, responses and validators are living outside of the API project that references FastEndpoints
in a project called Contract
. This is done to allow for easy integration of requests, responses and validators into the API and Blazor frontends.
Due to changes in #141 AbstractValidator<T>
instances are no longer registered by FastEndpoints
, so this doesn’t work any longer.
Installing FastEndpoints
into the Contract
class lib is not an option as this will break Blazor WASM with the following error:
Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(427, 5): [NETSDK1082] There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.
Issue Analytics
- State:
- Created a year ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Getting validators in classLibrary automatically with .net ...
When there is a "Validations" folder under InventoryManagement.Services, validations do not work. But when I import the "Validations" folder ...
Read more >Adding a Procedure to Multiple Objects - Microsoft: FoxPro
If all the textboxes are based on the same class, you could simply add the required code to the Valid of the class,...
Read more >Michele Chubirka's Post
ClassLib.SILGlobals to save the global variables to the current session. These variables are stored in the sessionvars SQL table. When another request is...
Read more >Modern API Design with ASP.NET Core 2
Finally, you'll examine not only how to deploy your code to on-premises servers or ... NET Core–based and another that is based on...
Read more >SignalR on .NET 6 - the Complete Guide
5 - Sending messages to individual clients or groups of clients . ... has limited bandwidth to work with, you may not even...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
guys give
v5.0.0-beta7
a whirl…so… by default only validators inheriting from
FastEndpoints.Validator<TRequest>
are auto discovered and registered.if someone wants to include
FluentValidation.AbstractValidator<TRequest>
validators as well, all they gotta do is:an exception will be thrown during startup if more than one validator is found for a single request dto. in which case the user needs to be explicit about which exact validator must be used in the endpoint configuration like so:
beta docs updated: https://dev--fast-endpoints.netlify.app/docs/validation#abstract-validator-classes
so… what do you think? have i missed anything?
you can ignore the generator for now. I’ll look in to it later. for now it can be a limitation of the generator package. i.e. it will discover all validators.