My question is about how to create a definition for an object that is handled by different web services.
A brief description of my current scenario and why I think it's a problem:
A PHP web application provides AJAX endpoints for populating various parts of my web app. The endpoint provides access to User and Project entities. A node.js application uses sockjs to deliver User and Project events in real time to my web app.
Here's the problem: The schema of the JSON objects delivered by the node.js service is slightly different to the same objects provided by the PHP endpoints. This is bad because it makes much my client size code hard to re-use, and there's lots of "if it came from node, access this property; if it came from AJAX, access this other property" type logic. Ugh!
The code base is too big to do a one time refactor and make sure all devs adhere to the new design.
I want a way to share information between my node.js app and my php app so they both know how they should define certain objects.
What is the most common way of solving this kind of problem?