Questions tagged [validation]
Tags for questions related to validating data.
266
questions
2
votes
3
answers
216
views
Validating Arguments in Constuctor
In general, I like to favour immutability where possible and not allow objects to be created in an invalid state or get into an invalid state. Sometimes though it feels like it might go too far.
...
0
votes
2
answers
113
views
Design Gaps Validation
Does anybody face the issue with Design Validation and related overheads?
When we deliver a Solution we have a lot of so-called Streams (usually 3-8, average 5).
Each Stream is responsible for its ...
20
votes
4
answers
12k
views
Clean architecture validation in domain vs data persistence layer?
I'm studying up on clean and as a result am quite dramatically rethinking a great deal of how I design and write software.
I've thing I'm still wrestling with however, is for business rules like "on ...
4
votes
4
answers
4k
views
How to avoid double data validation in an application with web interface?
I am learning software design by building a CRUD web application (ASP.NET MVC with Entity Framework). I split it into two projects: first is Core library, that contains business logic, second is Web ...
4
votes
3
answers
293
views
Are periodic validation or verification tests required after the software is released?
I'm working as a programmer in a load cell manufacturing company.
We develop our own software for load cell manufacturing and testing purposes.
Quality Assurance Department of our company has ...
3
votes
2
answers
3k
views
Should a backend Restful API implement data validation
I am working a project which involves back-end Restful API and single-page front-end app. I am wondering if the back-end API has to implement all sort of data validation logic , which is also to be ...
1
vote
0
answers
164
views
MVC remote validation approach
I have a model, the model has 2 strings; foo and bar.
foo is what it is, it will be one of x amount of possible values (it's not an enum, though).
bar is entered by the user, so I want to validate ...
11
votes
3
answers
1k
views
How to perform input validation without exceptions or redundancy
When I'm trying to create an interface for a specific program I'm generally trying to avoid throwing exceptions that depend on non-validated input.
So what often happens is that I've thought of a ...
-1
votes
1
answer
140
views
method to check nested transaction
So I am writing a method to check and throw if a new transaction is being made in another transaction.
I first came up with straight forward checkNestedTransaction, but this seems vague since I cannot ...
1
vote
0
answers
41
views
Database Constraint from another table column
Let's consider the following objects :
Article which can be of different types
Equipment which point to an Article, some fields on equipment are only used for some types.
I want to add constraint ...
0
votes
1
answer
47
views
Validating an app's feature
I am currently coding a productive study app. In my app, the user can input a list of productive, non-productive and necessary tasks which he will be doing throughout a period of time. The user is ...
3
votes
4
answers
4k
views
How should I report multiple errors as a result of validation?
Say, I have a function, RegisterUser() which takes in an user's registration details such as their username, name and password and registers them if there is no invalid data. For such functions, it is ...
1
vote
5
answers
463
views
Should a client check for valid parameters?
I'm writing a Java client library for a simple API service and I was wondering how much should I be strict for invalid values.
For example for an endpoint a parameter should not exceed a certain ...
4
votes
2
answers
2k
views
Spring MVC - Handling validation errors using AJAX
I'm new to Spring MVC, hence the question may appear trivial.
I have a login form which is submitted via ajax and in return I receive a ModelAndView (displaying existing list of contacts of the user) ...
0
votes
1
answer
849
views
Specification pattern or entity / value object validation
I m trying to understand the core concepts of DDD and I m having some troubles dealing with validations.
In fact, I m actually wondering where and when should I use specification pattern instead of ...
10
votes
2
answers
23k
views
Name validation best practices
I have a form and I was wondering about best practices when validating names (specifically throwing out characters which do not typically make up a name e.g. 123%^*$£ though theoretically could) and ...
3
votes
2
answers
1k
views
ASP.NET MVC: where to put data-entry logic which hits the database
We do simple data entry validation with attributes on the viewmodel. Think format of an email address, mandatory clientname, format of a date, the housenumber being numeric etc.
Now there are also ...
2
votes
3
answers
204
views
Does it make sense to validate data taken from the database?
This is intended to be a general language-agnostic question. It is written around a weird example simply because I could not find a better way to ask. Also, the "pseudocodes" provided look like a ...
0
votes
3
answers
127
views
Defensive coding against an 'official' WSDL service specification
Earlier today I was asked to diagnose an issue in some development code. It turned out that the issue was caused by a new stub implementation returning random data which did not match the service ...
3
votes
1
answer
3k
views
What is the correct way to test performance of methods?
I made a few classes for processing and validating data in xlsx and csv.
However, I am curious in testing how fast the methods I wrote in C# for the heavy lifting are.
Here's what I currently am ...
0
votes
3
answers
618
views
Automation testing strategy with changing test cases
Say, for example, you have a program that sends a message to a server and that server validates it.
Note: The server validation process can have additional test cases due to it being implemented in ...
11
votes
2
answers
3k
views
Where should you validate the state of "other" aggregates?
Scenario:
A customer places an order, then, after receiving the
product, provides feedback on the order process.
Assume the following aggregate roots:
Customer
Order
Feedback
Here are the business ...
6
votes
2
answers
563
views
How to work with/around an API that does not return errors?
I am currently working on a project which requires data fetching from a 3rd party closed API (over SOAP).
Currently I'm in a situation where I have to do argument and data validation inside our ...
6
votes
2
answers
4k
views
Designing validation classes
This is a follow-up of this question. I decided to implement what the accepted answer suggests, however, I realized I also needed individual public methods for each member the entity to be validated ...
4
votes
2
answers
1k
views
Write unit tests for the libraries, or just the application?
Background
I am fairly new to unit testing, and have been recently using the Visual Studio Test Manager to create my Unit Tests. The way that I have currently been doing things is as follows:
Create ...
19
votes
2
answers
20k
views
Data validation: separated class or not?
When I have a lot of data that needs to be validated, should I create a new class for the sole purpose of validation or should I stick with in-method validation?
My particular example contemplates a ...
0
votes
1
answer
101
views
Universal Form Handler
I'm building a API that gets called from web / mobile applications written using Ionic (web languages on mobile), which uses Angular.js.
We want to be able to do server side validation of forms but ...
7
votes
2
answers
5k
views
Guidelines for returning None vs. raising Error for Python string-validating functions
Let's say we have a function that checks if a given pattern occurs in a string. The default behaviour is that if the pattern matches, then it returns the pattern. So far so good but what is the ...
5
votes
3
answers
2k
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
2
answers
136
views
How can I test code that verifies data sanity?
I have a large data structure that gets read in from XML. I've been given a large list of constraints that should hold between data members. For example, one of the constraints might look like
...
44
votes
8
answers
4k
views
Should I throw an exception in case of a meaningful value outside of the range or handle it myself?
I have written a struct that represents latitude/longitude coordinates. Their values range from -180 to 180 for longtitudes and 90 to -90 for lattitudes.
If a user of that struct gives me a value ...
0
votes
2
answers
2k
views
Handling delay in entry of OTP for log in validation
There's an application, which accepts a user id and password to login. Validation of the id and password is processed by another system. Now after password validation, the application generates a One ...
4
votes
2
answers
865
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
vote
3
answers
564
views
How far should I validate user input in my own created API?
I got something here that bogs my mind a bit.
Let's say I write me this API (in TS), check out some of these properties:
export class MyAPI{
propertyThatShouldContainSuffix:Array<...
28
votes
6
answers
31k
views
In which layer should validation be located?
I'm creating a Rest API using Spring Boot and I am using Hibernate Validation to validate request inputs.
But I also need other kinds of validation, for example when update data needs to checked, if ...
7
votes
1
answer
6k
views
Writing a valid test case for validating XMLs
How would I write a unit test, say JUnit, for validating an XML file?
I have an application that creates a document as an XML file. In order to validate this XML structure, do I need to create an XML ...
25
votes
4
answers
6k
views
Is client-side validation really all that important, always? [duplicate]
Through the years I've worked in web development it's been ingrained in me that client-side validation is absolutely and completely necessary in all web applications. Seems to me like all the people ...
3
votes
2
answers
539
views
How can a method handle validation and entity creation without output parameters?
I have 3 simple classes. A Reference, a Parent, and a Child. The Child knows the Reference and Parent instances it's associated with. Here they are, initialization and other data/methods omitted:
...
0
votes
2
answers
133
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 ...
3
votes
2
answers
261
views
Should I add a layer to keep object always valid and immutable?
I am developing COM. A factory need to be initialized first by providing a ID. I can not pass arguments to IFactory instance via CoCreateInstance. So IFactory may need add a init method to be called ...
0
votes
1
answer
73
views
Should formatter do validation?
Say I have a SSN field in a form. I want SSN to be in format of xxx-xx-xxx.
I may just have a SSN formatter checking whether the input are all digits and adding dashes when necessary.
Another ...
2
votes
2
answers
1k
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 ...
6
votes
2
answers
3k
views
Justifying programmatically ensuring frontend and backend validations are synchronised
Like many Javascript-based rich web apps these days, I have some complicated validation rules implemented on the front-end. The same rules are supposedly repeated exactly on the Java backend but I ...
3
votes
2
answers
136
views
How do I prevent attackers from duplicating submissions?
I want to create a polling website. A client requests to answer the poll using POST, and the server responds with the candidates. The client then sends a POST with the candidate information and the ...
1
vote
0
answers
88
views
What's the right way to approach validations? [closed]
I'm a rails developer, and have noticed that while defining validations I find myself confused about the scope I'm trying to cover.
For example, I have basic cases where a field of data (ex: name, ...
3
votes
2
answers
147
views
Why use a unique hashkey for form submissions?
I have multiple forms and use AJAX to submit them. I asked my boss if he needed any specific format for the form ID and he told me to generate a unique hash and keep it in session; check it whenever ...
0
votes
1
answer
74
views
How to work with fail reason [duplicate]
Imagine that I have a method like User::validate($data), and mostly the developer expects only that is returns a boolean (true mean "ok, validated with success"). But, in some specific cases, he need ...
6
votes
2
answers
2k
views
Where should business logic go in a layered architecture?
First of all, i'm not talking about validation in the sense of the nullability or length of a field like in this and this questions where we can use isValid() methods in business classes or an ...
1
vote
1
answer
492
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 ...
4
votes
3
answers
6k
views
Java & REST API: How do I check for duplicate before inserting record?
I am developing an application in Java to parse and upload records from a CSV to an online database, via a REST API.
While I know for sure that there are no duplicate records in each CSV file, I ...