Yes, specifications can be used to guide developers that will make use of the API themselves. Additionally, the specifications can be used to develop an implementation of the specification. This is where Iâm suggesting a subtle difference.
You can write the API in Java, as we have done for the current WebAPI and then generate documentation from it using automated tools, and this works well. However, its based on an existing implementation, meaning that youâve written the code based on a general understanding of what needs to be developed and then documented what it is that you have developed.
Alternatively, before you begin developing an implementation, you can design a specification that can be shared with the community and that design can be collaborated on until there is a consensus of what should be developed. In the case of using OpenAPI 3.0 (essentially, the next version of what was formerly known as Swagger) you can take that specification document (serialized as either YAML or JSON) and generate code in any of a dozen or so languages that you could then use for your implementation.
When there were very few developers working on OHDSI software it didnât matter as much to have a specification available as we were creating the reference implementation and releasing it without much contribution from others. Today we have a much more vibrant community of developers many of which are interested in writing their own implementation of tools to develop things like Concept Sets and Cohort Definitions. To do so some have been forced to reverse engineer designs out of calls to the WebAPI to see what it is that it returns and then create implementations in their preferred development paradigm to mimic that behavior.
Developing a stubbed (incomplete) implementation and and documenting it could in fact work as a means for sharing a specification. It definitely is a subtle difference and I am not trying to imply otherwise, however I do prefer the approach of publishing a pure implementation agnostic specification.
To make a rough analogy, the W3C doesnât develop a web browser that renders web pages they way they think it should and the document that approach and share it with the world. Instead they develop standards and recommendations which others can then adopt as part of their implementations.
In response to @Chris_Knollâs question:
So, one question I have is, if weâre taking about putting together official specification, is the objective to provide the blueprints to make an implementation in an arbitrary technology stack?
Yes, this would be one of the objectives. As a use case, there is interest in document based repositories for Concept Sets and Cohort Definitions, instead of requiring they use relational databases for storage. A specification for the Concept Set API would allow someone to implement it however they see fit for their technology stack.