Tags for questions related to validating data.

learn more… | top users | synonyms

0
votes
0answers
8 views

How to properly test if a m3u8 video-stream is online and working properly?

I'm trying to define a method to properly define if an m3u8 video-stream is online and working correctly. What methods could I use? I want to make a cronjob that daily or hourly checks the validity of ...
0
votes
1answer
33 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
1answer
136 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 ...
1
vote
3answers
61 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 ...
1
vote
1answer
63 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 ...
7
votes
2answers
126 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 ...
1
vote
2answers
166 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 ...
3
votes
2answers
164 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: ...
6
votes
2answers
313 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
1answer
64 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 ...
1
vote
1answer
75 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 ...
1
vote
0answers
60 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 ...
1
vote
0answers
53 views

Is there any way to take advantage of portable ViewModels for ASP.Net?

Microsoft supports portability when taking advantage of the MVVM pattern: https://msdn.microsoft.com/en-us/library/hh563947(v=vs.110).aspx This means that I can create a ViewModel that is reusable in ...
0
votes
2answers
81 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 ...
41
votes
8answers
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
2answers
74 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 ...
1
vote
3answers
159 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<...
3
votes
5answers
360 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 ...
4
votes
1answer
235 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 ...
0
votes
0answers
33 views

Where should user input be validated? [duplicate]

I am working on a webbased user interface using AngularJS. As a database I am using MongoDB which can be accessed through an Python-eve-API. The API is able to validate the passed data as stated in ...
23
votes
4answers
3k 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 ...
2
votes
2answers
108 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
0answers
25 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
2answers
206 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
1answer
44 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 ...
1
vote
0answers
99 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 ...
2
votes
2answers
384 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
2answers
125 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
0answers
71 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, ...
2
votes
2answers
111 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
1answer
58 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 ...
5
votes
2answers
259 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
1answer
80 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
3answers
883 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 ...
1
vote
1answer
156 views

Rails validation: Which method is preferred

In Ruby on Rails there are two ways to validate, for instance, the presence of input fields. Say I want to make sure the user has filled out my fields called value and name. I could put in my model ...
2
votes
0answers
184 views

What's the best pattern to validate a conditional entity? [duplicate]

I'm developing an ASP.NET MVC 5 website and I have a view with a grid. In this grid I have a column which represents an URL property. This url is a link to download some files, but this url should be ...
2
votes
4answers
91 views

If I have a method that needs verification in order to proceed, do I call it inside the method or before? [duplicate]

This has been bothering me. This is more of a pragmatic problem than technical. Imagine I have a SaveOrderChanges method which, as its name implies, will save the order changes when the user submits ...
1
vote
1answer
125 views

File validation rules

I have an application that can accept CSV files to run some operations. The files look like: CREATE USER:username,last_name,first_name,age user1,Smith,John,23 user2,Poppins,Mary,257 There are a ...
1
vote
2answers
178 views

When writing a library or an API, when should and when shouldn't I validate or automatically correct errors in data provided by another developer?

I have a fairly good understanding of when data validation should and shouldn't exist when it comes when writing an application that is only dealt with by an end-user, and all the different tiers of ...
4
votes
3answers
112 views

How do I model this relationship so that it is valid by construction?

Imagine a device class that represents a physical real world mobile device, with fields like Enabled, Platform, Model IMEI, etc. Then, an operation class, which is something that needs to be done to a ...
29
votes
7answers
4k views

Should I validate a method call's return value even if I know that the method can't return bad input?

I'm wondering if I should defend against a method call's return value by validating that they meet my expectations even if I know that the method I'm calling will meet such expectations. GIVEN User ...
1
vote
2answers
563 views

Pattern for validating rules having different signatures

I have a class in charge of responding to an input event and maybe triggering another event. To decide, it has several rules to check. I'm trying to get away from a class looking like this: public ...
2
votes
1answer
98 views

Use of validators for simple validations

I've been working in Liferay code, and I've come across this construct a few times: List<?> list; ... if (Validator.isNotNull(list)) { //do stuff }} The source code for Validator.java ...
0
votes
1answer
339 views

Always set form input max length?

Background I'm looking to put together a single page web application with many form inputs. I've run into issues with other web pages where there is an ugly SQL error sent to the user if the ...
7
votes
2answers
632 views

What is best practice to handle whitespaces when letting the user edit the configuration, the name=value pairs?

For instance, you let the user define the notorious path variable. How do you interpret apppath = C:\Program Files\App? This looks like a programming language adopted practice to ignore the white ...
1
vote
0answers
124 views

How to consume inconsistent REST API with Mongo DB backend?

We are using a third party REST API and we are building one of the pages on our ASP.NET site around the data it delivers. We get results in JSON, and interact with it mostly using .NET MongoDB Driver. ...
1
vote
3answers
187 views

Coerce bad input or always crash early

The general consensus seems to favor the Crash Early approach, the most reputable source being the acclaimed Pragmatic Programmer book. And while I understand and agree with the advice in many ...
1
vote
2answers
484 views

Why all consider UAT a validation activity? It contradicts the original idea

Virtually any book dealing with software testing mentions that user acceptance testing (UAT) is an ultimate validation activity, often quoting Boehms informal definition: "Validation: Are building the ...
3
votes
6answers
1k views

Domain Model, validation, and pushing errors to the model

Looking into DDD and something I noticed is that business logic should be in the model, otherwise you just have property bags. That said how do you handle pieces of validation that require a trip to ...
5
votes
8answers
479 views

Do objects with validation logic in their domain really represent their real world counterparts?

I asked a question about whether validation behavior should be treated the same as other types of behavior in regard to the concept of OOP being "data + behavior". I got some good answers back that ...