Questions tagged [validation]

Tags for questions related to validating data.

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

How to validate an xml file containing thymleaf using an xsd file? [closed]

I have a problem concerning the validation of xml marker that contains a th:if. When I do <xs:element name="cc"> </xs:element> on my xsd file to test <cc > </cc> on ...
-1
votes
1answer
101 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
37 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
25 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
147 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
33 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....
1
vote
2answers
134 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 ...
0
votes
2answers
122 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?
0
votes
1answer
73 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 ...
4
votes
2answers
102 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
1answer
43 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
30 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
30 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
64 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
229 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
647 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
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 ...
-1
votes
4answers
571 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
vote
2answers
673 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 ...
-2
votes
1answer
43 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? ...
1
vote
1answer
52 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 ...
3
votes
3answers
175 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 ...
0
votes
3answers
230 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 ...
0
votes
0answers
290 views

Fluent validation - integrate in my business objects best practices

I am involved in the development of a price engine system. I have a set of business objects like Car, Engine, Wheels, etc I want to validate them using the framework Fluent Validation Here an example:...
2
votes
2answers
218 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 ...
0
votes
3answers
81 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 ...
66
votes
7answers
18k 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 ...
0
votes
3answers
178 views

How far do you go in server-side validation of POST/GET requests?

Our application had a few vulnerabilities detected by AppScan and we had to add server-side validation to catch SQL injection attempts. But my question is, how far do you go in server-side ...
2
votes
1answer
51 views

Should the ORM create the related objects (ForeignKey objects) when saving the entity?

This question is coming from a frustration when using the Entity Framework and ASP.NET MVC, but I assume it's a general frustration across more frameworks and languages. Lets say we have an object ...
23
votes
6answers
4k views

Is it ok to have validation layer before access control layer

I am creating an API strcutured web application and in this application we have different layers which are doing their own job. First layer is Validation layer which validate user input and if it ...
0
votes
1answer
228 views

JS Captcha in contact form validation to avoid spam bots

I am looking for opinions about how bulletproof could be this captcha system to avoid spam in a contact form. The form submit goes through ajax. So I generate 2 random numbers with javascript. The ...
-2
votes
3answers
92 views

How to handle submitted data - sanitization or validation or both?

As I was working on upgrading deprecated ereg_replace() statements in an e-cart sollution I was suddenly puzzled by questions regarding how to handle the submitted data I was working with. I was ...
1
vote
3answers
838 views

Validate JSON on server side

I'm working on Web Application (ASP.Net MVC) that will allow users to edit a JSON object in the browser and save it to database. To do so, JSON object will be sent from view to server side (...
2
votes
2answers
121 views

Designing for the validation of phone numbers

Let's say we have a registration system that finalises the creation of an account by SMSing the user their new account details. This system could be used by people all around the world, so let's say ...
6
votes
5answers
482 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 ...
1
vote
0answers
768 views

design pattern/oop for large validation rule set

I'm writing this in node.js I have some data that needs validating before anything can be done with this. The data is validated in two different ways. I can use JSONSchema to validate the structure ...
2
votes
1answer
81 views

Validation layer of clustered WebApi solution

Currently I have a design problem, which I am not sure how exactly to solve and what would be the best approach. So what I have is a ASP.NET Core WebApi project which is actually clustered solution. ...
2
votes
4answers
395 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 ...
0
votes
2answers
132 views

How to validate reference use?

I use "reference" term here like in C++ world, not like in C# (for example). I use non-C++ syntax on purpose -- this is general question, not about this particular implementation. Starting something ...
2
votes
3answers
105 views

The “scope” of knowledge about what the valid parameters are

I have a question which I'm not sure how to generalize and ask properly, so I'll try with an example. Suppose that I design a parking lot management system. In my system, I have the objects Car and ...
4
votes
4answers
740 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
2answers
3k views

Overall view validation with a datagrid and keeping to MVVM

I am struggling to find a good architecture for what must be a common problem Enable/Disable a button in a View that contains a datagrid, and has validation requirements on the cell, row and ...
4
votes
2answers
2k views

Multi-level validation in C#

I have a Console project reads inputs from CSV file and tries to save them to database. For that, I created a class Person that maps a CSV row. The CSV file has two columns Name and Age. Person ...
0
votes
1answer
307 views

Validation Rule or Business Rule

I am in a confusion where I cannot decide whether a rule is validation rule or Business rule. I have simple POJO with JSR 303 bean validation rules. public class VehicleDto { @NotNull(message = "...
1
vote
1answer
374 views

Best approach for name similarity

As part of validation, we perform name similarity check and allow only if the threshold is reached. I got some help from StackOverflow regarding the implementation and finally implemented JaroWinkler ...
0
votes
2answers
161 views

Where should I enforce that an entity has between 0 and 7 attributes

Background I need to implement a URL whitelist to limit the number of pages that a javascript widget can be deployed on. The requesting domain is already limited for an account, but I now want to ...
2
votes
2answers
255 views

Would an age between 0 and 17 cause validation to fail? [closed]

I recently asked a question about validation here: What is the "best" way to apprach validation from the perspective of a DDD purist? Please see the code below, which I borrowed from here: ...
0
votes
2answers
81 views

Validating requests to API have come from a valid source

I am currently working on a project where I am developing a library which will do HTTP POSTs to a backend service on my server. The data that the backend service receives is processed and stored in a ...
1
vote
2answers
74 views

Should an empty validation pass if no rules supplied? [closed]

If I have a validator class with a validate function that takes a ruleContainer as input. Should the validation pass if the container is empty ( least astonishment?) or should I throw an exception or ...
5
votes
4answers
2k views

With a REST API, is there a convention for clients validate a request without committing any changes?

This may be easiest to explain with an example use case. Let's say I have an e-commerce site where users can add items to their shopping cart. When adding items to the cart, users can type in the ...