-MikeI used to think the idea of XSD and equivalent were important, but I've since become disenchanted. I'd be interested to know the specific things you see them enabling and/or preventing? Thanks in advance.
Our solution was /$metadata. This worked reasonably well.
We defined a modeling mini-language, and a representation of that in XML. We could have gotten part of the value with just XSDs, but we wanted more generic clients. In particular, we wanted a client to not only know that there could be a “Manager” element inside of an “Employee” element, but to also know that “Manager” represented a relation to another PersonType entity.
A few years down the line, we’re seeing a number of advantages that came from making each service self-describing:
· Generic tools are able to ask a service what it supports and learn about what queries it’ll probably handle (this could be made better, and probably will in future releases, but it is being used successfully today).
· Clients can tell a little more about the meaning of the things it sees in resources, which allows generic clients to display things to users in a useful manner (e.g., if an element represents a navigation property, then show it as a link. But if it’s a regular property, just show it as text).
· This will allow us to dramatically reduce the amount of control information in each resource, yet still maintain zero service-specific machine understanding of services.
· This makes it easy to do client-side code generation (in statically-typed languages) for a particular service – the machine can understand the service.
· There is a service-central place to put information of relevance to clients (e.g., model version).
There are also several disadvantages:
· DTDs already have parsers in every language. If you define your own metadata format, then you need to either write all those parsers or be important enough that open source projects will appear and write them for you. We still have problems with this, and we’re a lot bigger than just one service.
· If you support client-side code generation in static languages, then people will use it. And those people tend to expect more backwards-compatibility support (while understanding their own code less – especially the generated code parts). So you might need to be more deliberate in your model changes. In other words, this can help open up a new market, but serving that market has costs.
· We really should have made a JSON representation for /$metadata too. Perhaps we will someday (I’ve seen individual efforts in this direction, but no one has yet tried to promote one to the protocol spec level).
There’s probably more learning available, but this is what I’ve got on top of mind.