Posts

Showing posts from November, 2021

Approach to the API Design

Image
API design is essential for efficient communication between software systems. It plays a critical role in enabling developers to integrate different systems, components, or services effectively. Well-designed APIs simplify the process of accessing and utilizing the functionalities provided by software systems. APIs serve as reusable components, allowing developers to leverage existing functionality and save time and effort. Good API design ensures that APIs are intuitive, easy to understand, and consistent. They provide clear and concise documentation, making it easier for developers to work with and integrate the APIs into their own applications. APIs act as a contract between the provider and consumer of services. Good API design promotes collaboration between teams or organizations by defining clear expectations and interfaces for communication. APIs create opportunities for innovation and the creation of new applications. They empower developers to build upon existing systems and s...

Implementing CQRS Validation using the MediatR Pipeline and FluentValidation

Image
Validation is a crucial aspect that must be addressed in your application. It is essential to ensure that each request is valid before proceeding with the processing. Another critical consideration is the approach to different types of validation. Input validation and business validation should be treated differently and require specific solutions. In this blog post, I will present an elegant solution for validation using MediatR and FluentValidation. Even if you are not using CQRS with MediatR, don't worry. The concepts and techniques I explain regarding validation can be easily adapted to other paradigms. Here's what I will cover in this week's newsletter: 1. Standard approach of validation  2. Input vs. business validation 3. Separating validation logic 4. Generic ValidationBehavior Now, let's dive in. The Standard Approach of Command Validation : Typically, validation is implemented just before processing the command. However, this tightly couples the validation wit...