An interesting question I've stumbled upon:
Let's assume a java application creates a data model, converts this data to a json object with two fields and uploads it to a server:
{
"FirstName": "Foo",
"LastName": "Bar"
}
Now a different technology, say js, php, etc on the server needs to process the data.
Both sides are well tested against a set of unit tests but naturally integration across different languages and technologies is hard to be tested in depth.
Is there a known principle or technique that can validate the data on both ends? I mean lets say there is a contract that says that LastName must not, by any chance be <2 chars in size. This is a business rule which is a hard constraint on the data.
Now the java implementation has a bug or simply overlooked the requirement for LastName. Both sides complete unit tests but they fail hard during integration.
Is there some technique that allows to specify such rules across languages? I am not talking about runtime rejection of malformed data but rather ensure consistency on both sides of an application.
LastNamewhenFirstNameis "World", etc