Hello services-list,
since my very first contact with JSON, I was asking myself: Why can't people simply use XML? In the meantime I got aware of the advantages, especially for fast prototyping and high performance applications. However, when applications get larger, more complex and more mature the absence of schema information is problematic.
For example, I found writing the parser for the WikiData dump [1] quite exhausting. Alternatives like Json-lib work well for testing, but I was quite worried about stability after hitting a log tail bug [2]. Moreover, in the PHP Math extension it's often uncomfortable to figure out which JSON properties are set under certain circumstances [3]. Yesterday, I discovered another problem related to a missing JSON schema [4] which finally motivated me to start this effort to discuss about JSON schema options.
For the communication between services, we use spec files. This is a great thing. But would it not be even better to use a JSON schema even within services. So one could throw exceptions right at the place where the problem occurs. I'm aware that there are approaches for a JSON schema like [5], but I'm not sure if that is convenient to use in practice.
To keep the discussion focused, we could use "how HTTP errors are supposed to look" [6] as a running example to discuss how JSON schema definition and validation could work.
Best Physikerwelt
PS: This is my first post the services-list. I hope it fits well to the idea of this list.
[1] https://github.com/physikerwelt/WikidataListGenerator/blob/master/src/main/j... [2] https://twitter.com/physikerwelt/status/683286844721741824 [3] https://phabricator.wikimedia.org/T119300 [4] https://phabricator.wikimedia.org/T126057 [5] http://jsonschema.net [6] https://github.com/wikimedia/service-template-node/blob/master/doc/coding.md...