Questions tagged [validation]

Tags for questions related to validating data.

Filter by
Sorted by
Tagged with
0 votes
1 answer
54 views

Validating data and logic outside the domain

I have a budget entity in my domain which can be closed by the user if the budget is open. This means if the budget opens today and closes in seven days, in between this time I can close it, not ...
Bernardo Benini Fantin's user avatar
10 votes
6 answers
3k views

How to ensure data consistency in system with multiple databases?

Let's say, in a rather big application suite with multiple more or less integrated products, data is stored across multiple databases. Some of them are SQL-ish DB clusters, some are MongoDB clusters. ...
cis's user avatar
  • 255
1 vote
1 answer
253 views

Centralize input validation across multiple Microservices

My company, which specializes in logistics and transportation, delegated the majority of the backend microservices to our team. All of the microservices (which our team inherited from "past ...
lecarpetron dookmarion's user avatar
0 votes
0 answers
51 views

How to group together common allowed descendants of a vertex in a tree data data structure?

I created an abstract class to represent a vertex in a tree structure. Later, a requirement was introduced where certain types of vertices are not allowed as descendants of certain other vertices. So ...
Cave Johnson's user avatar
1 vote
1 answer
219 views

Reduce Code Repetition for a Simple CQRS

We're currently exploring CQRS in our future applications. To give a bit of a background, we use a simple CRUD-style service before something like this. Old Pattern: Controller Command/Service Model ...
Lawrence's user avatar
  • 123
1 vote
1 answer
114 views

Wrapper class for min/max clamping and validation

I have a lot of classes that have numeric values that are configurable by the customer during runtime and should be clamped between a min and a maximum value. The value changes should also be logged. ...
Cédric Moers's user avatar
0 votes
1 answer
109 views

Reuse same code for validation and runtime integrity checks?

Scenario I have a system where a user can upload an Excel file which is validated and then used to provide data for the application. There are two distinct operations I need to handle with this file: ...
donquixote's user avatar
0 votes
1 answer
466 views

Validation in both controller and my service classes?

I use the Laravel framework. I've got controllers, like CustomerActivityController, and I've got a service layer with services like CustomerActivityService. Say I want to create a new customer ...
user2190492's user avatar
0 votes
1 answer
142 views

Serverside validation in a web application

Suppose I have a web application that processes a request as follows. A user fills in a form and submits it. (e.g., to register as a new user for my application) The request is passed to the ...
Safron's user avatar
  • 113
2 votes
2 answers
2k views

Should you limit the size of JSON array to avoid abuse? Or is this already covered by size limits?

I'm working with a basic REST API, through user interaction on the UI, the JSON object is built up, including Arrays and a POST is sent to an endpoint using this object as the request body. For ...
shicky's user avatar
  • 123
1 vote
1 answer
2k views

How to handle duplicate validation logic with CQRS pattern

I am implementing a CQRS pattern in ASP.NET Core with MediatR, and I am wondering what the general consensus is for handling duplicate validation logic for queries/commands which operate on the same ...
Mark Lisoway's user avatar
0 votes
3 answers
1k views

CRUD service with or without DTOs

I'm about to create a service providing a simple CRUD Json REST-API. The main requirement is that documents stored/received always conform to a schema provided as JSON schema. So here's the thing: ...
Jan Gassen's user avatar
0 votes
3 answers
705 views

Should I perform simple validation (not null, max length, etc.) in a web api controller and duplicate in a command handler?

I have a question about DDD. I wonder if I should add validation in a web api controller and duplicate it in a command handler? Is it good approach to validate a DTO and a command even if the ...
Aleksander Chelpski's user avatar
3 votes
2 answers
823 views

Maintaining referential integrity between Aggregate Roots

In his book "Implementing Domain-Driven Design" Vaughn Vernon suggests to reference aggregate roots only by ID. I see the following advantages of this approach: It is clear where the ...
deamon's user avatar
  • 876
4 votes
2 answers
830 views

Should similar standalone functions go in a class?

I'm working to create a library in python that myself and a few colleagues will use. I'm struggling to conceptually understand how to best organize some code that feels like it doesn't cleanly fit ...
coney1's user avatar
  • 87
2 votes
2 answers
74 views

Should client application clean the data that a server application can not internally process? (In SOA Systems)

Scenario : For some (comment) text field the server application is internally throwing errors when the field contains contains some specific characters. Where should the removal of characters be ...
jimjim's user avatar
  • 873
0 votes
1 answer
306 views

Should i specify that my methods "throws ConstraintViolationException" if the exception is actually thrown by a CDI interceptor?

Here is a sample method: @ApplicationScoped public class MyClass{ public void getUser(@Min(1) int id){ //get User logic } } I'm in a CDI environment with @ValidateOnExecution(type = ...
cidra's user avatar
  • 321
0 votes
1 answer
176 views

Should I cache database requests made in validation layer?

Imagine an http request in a RESTful API that needs to request the database to perform validations before proceeding, but some of those database requests would need to execute again if the validation ...
underthevoid's user avatar
2 votes
1 answer
683 views

Static validator in DDD value objects

I have a value object to hold a user id number as a string. This number has a unique format throughout my domain. So, it's being validated inside the object during instantiation and an exception is ...
BlackPanther's user avatar
3 votes
1 answer
2k views

Data validation between microservices

Consider a scenario (in .Net Core world), where a microservice A collects data from external sources and sends this data asynchronously (RabbitMQ) to microservice B (the reporting system) where this ...
Andreas H.'s user avatar
0 votes
0 answers
48 views

How to validate against changes to "illegal paths" in backend requests for complex data structures?

We are building a backoffice web application where people are making changes to an array of nested objects. Because of totally non relevant business reasons there are things that users cannot change ...
atoth's user avatar
  • 539
9 votes
4 answers
4k views

Is it a bad idea to do validation in the constructor?

Consider the following approach to validation of an API class (POJO or what have you, I mean a class which just acts as a container for some properties), we make all constructors private to the API ...
JustSomeGuy's user avatar
0 votes
2 answers
344 views

Eliminating duplication of validation metadata in client and server

I tried to find some insight in how to handle the duplication of client-side and server-side validation in my app. If, for example, I have an User Entity like this on my back end: type User struct { ...
Daniel Lopes's user avatar
-1 votes
1 answer
79 views

Client side validation with Jquery - MVC C# app

I am working on a very LEGACY MVC App using C# which is built from 2009. They dont have any client side validation at all. In other words, they dont use Validation mechanism provided by MVC framework ...
NinjaCoder's user avatar
0 votes
0 answers
27 views

Design a multiple Asp.Net Core apps Solution

I am having an .Net Core Solution consisting of 3 Projects: The Site (Asp.Net Core MVC WebApp) The API (Asp.Net Core API) The "Common" library for shared functionality. The Common library ...
Mats's user avatar
  • 163
1 vote
3 answers
874 views

Best practice with error messages say what is wrong, or how to remedy the error?

I've had a quick search and probably explaining the situation is why I can't find anythign useful to help me. It's best to describe the sitation with an example! Take a form where a user must input a ...
Crazy Dino's user avatar
4 votes
1 answer
3k views

Sharing form validation rules between backend and frontend (Having single source of truth)

I'm currently working on a web app using ASP.NET Core (C#) on the backend and Next.js (TypeScript) on the frontend. I have a lot of forms that need to be validated and I don't want to write validation ...
Konrad's user avatar
  • 1,559
0 votes
2 answers
1k views

How to handle validation errors from API response when using repository pattern

I've got the following: Clientside C# application. Contains forms for CRUD operations. It uses an API for all data operations. Input is validated on the client, and obviously also on the server (API). ...
user2190492's user avatar
1 vote
1 answer
38 views

Failed uploads layer

I am trying to find an optimal way to handle the following scenario: I have an application where there are a lot of file uploads on a certain endpoint, but the validation is rather strict as per the ...
Daniel Pop's user avatar
-1 votes
3 answers
505 views

When and how to check input parameters

My SmsRecipientDetails class constructor accepts String value as recipient phone number. I would like to accept number with spaces: assertDoesNotThrow(() -> new SmsRecipientDetails("123456789 &...
jnemecz's user avatar
  • 299
1 vote
2 answers
375 views

Identifying states when using state machine to validate a form field

Scenario is simple, a password field with few validation rules. The states I came up with are default ( when the form loads or reset button is pressed) filled ( should this even be a state ?) valid ( ...
ama's user avatar
  • 21
0 votes
5 answers
2k views

How Much Validation Is Necessary In An API?

What we usually have at work is an API that has a single consumer, usually a SPA web frontend, which is built by the guy sitting next to you. I completely see the need for authentication and ...
Uhmmer's user avatar
  • 75
0 votes
2 answers
217 views

Check if can delete before save

I am designing an application that works with REST API requests for dealing with information stored in a database. The user will add, edit, delete information in this client and after SAVE the ...
jav's user avatar
  • 109
1 vote
1 answer
987 views

Is it considered a bad practice to include methods in classes that comprise an EF model?

I am working on a project that uses Entity Framework Core. I have a class which represents an entity on which I'm trying to perform validation. Is it considered a bad practice to include a Validate ...
M.R.'s user avatar
  • 63
1 vote
1 answer
430 views

Best way to handle and combine client side and server side validations

I want to know if the way that I handle form validations is a good way. What I actually do is a very detailed client side validation to validate each field and with custom error message for the UI ...
Christian LSANGOLA's user avatar
1 vote
3 answers
1k views

DDD Validator Specification with dependency on repository

I have read this https://stackoverflow.com/questions/5818898/where-to-put-global-rules-validation-in-ddd and I have create my validator. But now I need to create a validator that must check the order ...
FedeC87p's user avatar
2 votes
3 answers
2k views

DDD - How to validate an entity is valid when said entity is a different domain which i dont have access to

I am wondering how I would validate some actions in my domain when a parameter of an action needs to be validated, but that parameter's entity is actually in a different domain so I can't retrieve it. ...
S. ten Brinke's user avatar
1 vote
2 answers
429 views

How to manage huge chunks of validation data inside a REST API?

TL;DR What are common practices to separate validation logic inside a rest API & thereby keep the code clean and straight forward? (code example) Context & Example Let's say I'm developing a ...
Michiel's user avatar
  • 163
0 votes
1 answer
930 views

Most appropriate HTTP return code when record locked for update due to invalid data

Context Typical restful CRUD service, including PATCH method, whose API validates fields (eg the "name" field may not contain digits). However, data in the database (from backdoor ETL load) ...
Bohemian's user avatar
  • 1,986
2 votes
1 answer
251 views

Event Sourcing/CQRS for Self-Related Entities

I'm building a platform that has an entity named content. There's a clear boundary around what defines content except that it can have relationships with other content entities. Up until now, there's ...
Alec Sanger's user avatar
1 vote
2 answers
189 views

Requirement Verification

According to what I understand, Requirement validation involves going over the SRS to ensure the requirements are correct with respect to the user's needs. Could you help clarify verifiable ...
Afia R. S.'s user avatar
2 votes
2 answers
837 views

Entity delete validation in a microservice environment

In a microservice environment there are two services: Service A and Service B. Service A manages an entity called x which has one to many relationship with service B's entity called y When a network ...
inckka's user avatar
  • 129
1 vote
1 answer
548 views

Can I put domain services inside domain entities?

Say I have a domain entity User: class User { constructor (username, email, password) { this.username = username this.email = email this.password = password } } Now, all users need a ...
kibe's user avatar
  • 738
2 votes
0 answers
482 views

Layers of validation for clean architecture in .Net Core web application

For a clean architecture where there is presentation layer (Javascript), web api layer, application/domain layer, infrastructure layer (EF Core ORM). Let's say it is an ATM system and the use case/...
John's user avatar
  • 29
5 votes
1 answer
3k views

DDD and MediatR - where the Validation and Business Logic go

I'm trying to get to grips with Domain Driven Design and MediatR. A reaction to being involved with applications that favour Services for almost everything. I see so much value in DDD and I'm trying ...
David C's user avatar
  • 273
1 vote
3 answers
2k views

Where to validate user input - Constructor, Validation object, or Factory method?

Let's say your application takes in a user request and you don't trust the front-end validation (because you never trust the front-end validation). In your controller or other handler, you want to ...
AgentConundrum's user avatar
47 votes
8 answers
9k views

Is it common practice to validate responses from 3rd party APIs?

I'm working on a PHP web application that depends on a few 3rd-party services. These services are well documented and provided by fairly large organisations. I feel paranoid when working with ...
Darren Findlay's user avatar
2 votes
1 answer
2k views

How to handle input validation in microservices for duplicated data

What would be the best practice of handling input validation in microservice? Especially for the duplicated data? To give context, say I have 3 services: User Typical user service with User object ...
GantengX's user avatar
  • 303
0 votes
1 answer
427 views

DDD - Complex value object

I have a Message class that represent some data sent by a smartwatch. A Message has a header (sender, length...) and a type; it can be a location update, an alarm message... There are about thirty ...
Hillel SAAL's user avatar
1 vote
2 answers
815 views

How to avoid duplicate data validations ( checks ) in web applications?

I'm learning about Software Architecture and especially about scaffolding large-scale architecture and patterns for modern web applications. I've noticed that I don't have a pattern for data ...
Menai Ala Eddine - Aladdin's user avatar

1
2 3 4 5 6