I'm looking for a formal way for a front-end and a back-end team to communicate on the shape of a JSON web API. For example, let's say you are on a client-side team writing the JavaScript & HTML for a AJAX SPA app. Another team writes the back end -- say, in Java. It's important that the data you see returned from those services meets a certain 'shape.' For example, a call to
/Person/Read/79
should return
{
"id": 79
"firstName": "Anita",
"lastName": "Hero"
}
How can the server team communicate this 'interface' to the JavaScript team? something like;
interface person {
firstName: string;
lastName: string;
id: int;
}
I'm looking for a formal contract between the teams, so that the JavaScript team can build components, pages, and tests, confident that the server team will deliver real data in the expected shape.
I'm guessing this is already done in situations where there is are large teams on both sides, but I'm not aware of current approaches.
I'm currently aware of these standards, but I'm unsure which are active;
- WSDL is an XML-based description, but since XML web services are dying in favour of JSON, and WSDL always seemed heavyweight, is it irrelevant for JSON-based dev?
- WebIDL is the languge used to specify HTML5, so it's bang up to date, but are there any tools for it?
- JSONSchema looks promising but again, what's the tooling like?
- Swagger looks good -- thanks to @Laiv for the pointer.
So are there any descriptions of how this is communicated across distinct client-side and server-side teams?