Questions tagged [validation]

Tags for questions related to validating data.

Filter by
Sorted by
Tagged with
-1
votes
0answers
39 views

Where to validate mandatory parameters? In the Function body or already with a constructor? [duplicate]

I have a set of mandatory parameters: "Authorization" and "Domain". So far I created a constructor which forces the class to be instantiated with both parameters: public class1(string Authorization,...
1
vote
1answer
41 views

Still catch “duplicate entry” exception of database even after pre-validation of user input?

Say, you pre-validate if a username already exist in a registration form in the application layer. E.g., You send back a nice "username already exist" error message to the user. While unlikely, there'...
17
votes
9answers
17k views

When should pointers be checked for NULL in C?

Summary: Should a function in C always check to make sure it is not dereferencing a NULL pointer? If not when is it appropriate to skip these checks? Details: I've been reading some books about ...
1
vote
3answers
55 views

What http error to return in case of validation and business rules in a domain driven design api

I have a .net core api trying to implement it according to domain drive design principles. In the domain layer there is a public Create method that contains all validation and business rules. If one ...
0
votes
1answer
94 views

Verify That Filters on a Dataset are Exclusive

Suppose I have a data table of, say, cars with a bunch of properties for each record. Example: |Vin|Year|Make|Model|Color|Mileage| I want to allow users to define (arbitrarily complex) filters which ...
1
vote
1answer
108 views

Independence axiom and ideal design explained

I am studying a book about software design called: Nonfunctional Requirements in Systems Analysis and Design which talks about the Axiomatic Design Methodology. This methodology has two axioms. One ...
572
votes
1answer
71k views

Is the use of “utf8=✓” preferable to “utf8=true”?

I have recently seen a few URIs containing the query parameter "utf8=✓". My first impression (after thinking "mmm, looks cool") was that this could be used to detect a broken character encoding. So, ...
4
votes
2answers
139 views

What is the relationship between IV&V professionals, Testers and QA engineers?

In the context of SDLC, I know that Verification and Validation is about verifying the deliverable input from previous phase and validating the output of the current one. And that testing is a phase ...
1
vote
2answers
158 views

How to Validate a Child Object Based on Parent Object's Data

Taking into consideration that I'm making an attempt at Domain-Driven Design and overall good separation of concerns when it comes to business logic, data access logic, etc... Question: How do you ...
1
vote
2answers
978 views

ModelState Validation vs JQuery vs Remote

I was stuck with some validations for quite a while. I have been thoroughly searching the internet to find ways to apply the validations I require. I came across many methods for validations even ...
1
vote
1answer
70 views

Using the objects retrieved at the time of request validation

I hope the question title already answers the subject here. Lets say I have a number of ids that needs to be validated in a request. Example: request uri: [POST] /album/{album_id}/song Request ...
2
votes
4answers
214 views

Is it a bad practice to query remote resources inside validation?

Watching this talk about Symfony Forms and validation, at 23:06, I got stuck with a doubt I couldn't find a satisfying answer to: Is it a bad practice to execute a query (or a web request, or a side ...
0
votes
1answer
146 views

Domain Driven Design Validation Logic

I am trying to implement DDD along with Hexagonal Architecture. One of the things that I am struggling with is validations. I had explored a lot of articles on where the validation should be but it ...
2
votes
1answer
59 views

Best practice in synchronized form data validations (Web apps - Client-Server)

Here we go again with topic what was asked many times all over internet, but I not found any good enough answer: What are best practices in making client and server side validations synced? I was ...
2
votes
4answers
624 views

Is it practical to have perfect validation score on HTML?

I was in a heated discussion the other day, about whether or not it's practical to have a perfect validation score on any HTML document. By practical I mean: Does not take a ridiculous amount of time ...
4
votes
5answers
980 views

Should I assert the preconditions of functions in a public API?

I am writing a library for some data structures in C that will be used in embedded systems. I have had issues designing and coming up with a solid error handling plan. This API is only subject to ...
0
votes
4answers
195 views

Prefixing a number with + on html inputs

When asking for positive number inputs on html, is it valid to allow + on the textbox? Like +42? Surely the + sign gets removed during server-side processing. But will allowing + be fine on the html ...
1
vote
2answers
880 views

REST API Input Validation Strategy

I am implementing a REST API and need to validate the JSON API inputs for the CREATE and UPDATE endpoints. The goal is to send a 400 error prior to doing any processing if the inputs are not valid. ...
4
votes
7answers
5k views

Why validate XML?

I am looking for an explanation on just why XML needs to be validated. I have been testing DTD's and Schema's for the past month and recently tried to find out why I am doing this. I know it makes the ...
7
votes
5answers
748 views

Message validation in async messaging-based services

I'm looking for information on the best approach to message validation in asynchronous-messaging-based services (i.e. services that pull messages from some sort of message queue or broker, rather than ...
0
votes
1answer
54 views

To And From Date Validation in Model

In my Springboot project I need to perform a validation of the type validFromDate<validToDate. I was wondering whether would it be a good or bad practice to place a validation in the model itself (...
3
votes
2answers
491 views

How to implement Repository that supports ORM's validation?

Domain Driven Design(DDD) has an abstract repository pattern to handle saving and fetching/finding entities in storage (db, external service, doesn't matter). My question is if Repository Pattern has ...
-1
votes
1answer
102 views

If we write validation in sever side, don't it become two times of writing same code? What is the standard software engineering solution for it? [duplicate]

I am not asking whether to do server-side validation or not. My question is whether any solution or better practice exist in the software world to address this repetition of code.
0
votes
0answers
43 views

How do you expose the field that caused the error?

Context: field errors Given an input in the form: { "list": [ { "username": null }, { "username": "test" }, { "username": "" } ] } Some APIs expose errors in the ...
0
votes
0answers
38 views

Call external API during validation (Rails)

I need to validate a value with data from an external API. The easiest way would be to add a validation rule in my model, call the external API and do my check. But it feels very dirty to call an API ...
0
votes
4answers
319 views

Should validation be inside or outside function?

Which one is better? A if ( complexDataCheck(...) ) { doJob(...) } vs B doJob() func doJob(...) { if not(complextDataCheck(...)) return error; ... } In A, the function does one and ...
1
vote
0answers
47 views

Javax Validation Annotations in Spring - is it always appropriate? [closed]

I've recently become more fond of javax validation annotations and creating custom ones when I feel they may be appropriate. But... I can't figure if it's design-appropriate to use them for everything....
5
votes
3answers
608 views

How to report multiple errors as a result of validation?

I have a class that transforms a complex model, for example an abstract syntax tree or intermediate model. The model can be either valid, invalid or partially invalid, i.e. it contains errors but some ...
0
votes
1answer
102 views

How to manage user serial keys for an application

I have an application in C# where several users access it. Each user will have a serial key associated with his username in a table users in a local MySQL database. Example of the table users: User ...
1
vote
2answers
143 views

Is it a bad practice or uncommon to save “Invalid operation attempted” events in an Event Store when doing Event Sourcing?

I have a simple toy project that deals with Banking operations (cash deposit, withdrawals, wire transfers, open and close accounts). I am wondering whether there is something wrong about saving ...
17
votes
4answers
6k views

Managing client-side and server-side validations in one place

I'm 100% on board with the case that one should definitely use both client-side and server-side data validations. However, in the frameworks and environments I've worked in, the approaches I've seen ...
0
votes
2answers
129 views

Can a service provider proof it is running a particular open source product? [closed]

Part of our project includes an open source GO server that we have open sourced for transparency. How can we prove that we havent made any alterations to the code before we deployed it?
1
vote
1answer
48 views

Form validation or model based verification on client side

I'm actually wondering what are the pros and cons of these two ways to handle client side validations / verifications. Let's imagine an application where there is a contact form that needs these ...
2
votes
1answer
48 views

What is the purpose of adding a schema validation in responses?

Many of the server scripting packages/tools out there have the option to have a schema validation before the response is sent out to the clients. E.g. the fastify package for a Node.js has a pretty ...
0
votes
1answer
36 views

Designing Validations Database driven configuration Vs hardcoding validations

So I am debating what approach to follow. My scenario is : Will receive a POJO which I need to validate ( REST end point ) Now I can explicitly validate specific fields ( which I know / are stated ...
1
vote
1answer
70 views

Check if object exists before updating/deleting

In an application that doesn't use an ORM, is it good practice to check whether an object exists before attempting to update/delete it? For example: @Route(method="DELETE", path="/posts/\d+") ...
0
votes
3answers
241 views

Should a method decide whether to execute or not? [closed]

I couldn't find a question on SE but it has probably been asked elsewhere already (in case, please mark it). A method containing code to run just with specific external conditions can: decide ...
5
votes
6answers
759 views

How far should I take email address validation when the cost of bad emails is high?

When it's more important to prevent typos than to cover 100% of all possible email addresses, what syntactic email validations do you do? Imagine this: You're with the local gas & electric ...
7
votes
6answers
1k views

Why is it bad to use exceptions for handling this type of validation? It seems like it makes the code so much cleaner

I'm working on a .NET Core REST API and I'm writing a service class to create new user accounts. I have the following code: public async Task<UserDto> RegisterNewUserAccount(...
1
vote
2answers
1k views

DDD - How to do informative validation (specifically on entity creation)?

For my domain entities currently, all validation errors cause exceptions to be thrown. I don't like this as it doesn't allow me to compile all validation errors before exiting a method. I'd like to ...
1
vote
2answers
57 views

Where should tests and checks be implemented in a mathematical modelling process?

I have a mathematical model with two main "stages" 1. data loading (only a few KB of data) and 2. running a model on the data. I want to implement some tests and checks to ensure the data being fed ...
103
votes
25answers
27k views

How far should one take e-mail address validation?

I'm wondering how far people should take the validation of e-mail address. My field is primarily web-development, but this applies anywhere. I've seen a few approaches: simply checking if there is ...
2
votes
4answers
447 views

JavaScript only validation on AJAX form submit

I've been mulling this question over for a few days in my head and I can't come to a solid answer. We understand that client side validation for forms is not enough, because you can easily turn ...
-1
votes
4answers
947 views

In a Domain Driven Development DDD, have a validation on a DTO that calls a external service is wrong, if yes, where should it be?

I have this question, is more about pattern and in theory what is wrong or not instead of if is possible or not (because it is). In a DDD design, I have a DTO that I am validating, to check not nulls,...
-1
votes
1answer
50 views

Should we delegate user input sanitization/validation?

Consider this code: new FrameworkClass( [ 'query' => $_POST[ 'input' ] ] ); FrameworkClass is supposed to do input sanitization and validation. Should we just trust 3rd party code to do it's job? ...
3
votes
3answers
199 views

What to do when an aggregate is given a bad event?

What is usually done when an aggregate is asked to apply an "impossible" event to its state? For example, if a ShoppingCart aggregate has already applied a CustomerAckRec (The customer has ...
1
vote
1answer
411 views

Loading Aggregate Root from Database with Validations

Here is a similar question Where to validate domain model rules that depend on database content? I am asking this new question because I have more descriptions and I don't want to change the ...
0
votes
2answers
256 views

Formatting a string by converting to a number then back to a string

I'm not sure whether this qualifies as code smell, or if there may be some better way of performing the same task, but, basically, I want to format a 10 digit string, using C#, and have the following ...
66
votes
7answers
21k views

If functions have to do null checks before doing the intended behaviour is this bad design?

So I don't know if this is good or bad code design so I thought I better ask. I frequently create methods that do data processing involving classes and I often do a lot of checks in the methods to ...
2
votes
2answers
233 views

Should I fix known bad domains in user emails?

Checking my Sendgrid account I've noticed many drops due to "Known bad domain". Those bad domains often seem to have been caused due to user mistake. ***@gmal.com ***@gmail.com.br ***@hotmal.com I ...

1
2 3 4 5