Repository with sources and generator of https://larlet.fr/david/ https://larlet.fr/david/
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 5 gadiem
12345678910111213141516171819202122
  1. title: Specifications and APIs
  2. slug: specifications-apis
  3. date: 2016-09-15
  4. lang: en
  5. chapo: To me an API is a discussion between involved parties.
  6. > One does simply not generate specifications from code.
  7. >
  8. > <cite>[Darrell Miller](http://www.bizcoder.com/), [OpenAPI 3.0 - The evolution of a success story](http://www.meetup.com/fr-FR/api-montreal/events/233496023/?eventId=233496023) (I cannot remember the exact sentence so I meme-ize it, sorry)</cite>
  9. [OpenAPI](https://openapis.org/) 3.0 is the new rebranded, improved and community-driven [Swagger](http://swagger.io/) [specification](https://github.com/OAI/OpenAPI-Specification), a way to interface an HTTP API. It was interesting to get an overview of what’s new and currently discussed on the specification itself but a question from the audience had all my attention because I felt highly concerned with the work we’re doing at [data.gouv.fr](https://www.data.gouv.fr/) using Swagger for the API. The case described — generating the Swa^WOpenAPI file directly from (Python) code — is exactly our process to [document the API](https://www.data.gouv.fr/fr/apidoc/) and even consume it on the JS side.
  10. That was the moment Darrell made a break and explained that you have to *take care* of your specification/contract; it has to be hand-written, not generated. That’s what killed SOAP with the complexity added by automated generators (and consumers). That made me think about the ascendant relation of an API with the server taking all responsibilities and clients which are accepting constraints. It doesn’t have to be that way. When you write the documentation of your API you take the time to think about the necessity of a given resource or verb. You can define an API based on actual needs from clients. You take the time to check your analytics to deprecate unused resources and so on.
  11. **To me an API is a discussion between involved parties.** They should share responsibilities and constraints over time like in any relation. There is no such thing as engraved endpoints and we should be better at versioning these relations to lead towards the best paths for both sides. We can avoid performing [many requests](http://githubengineering.com/the-github-graphql-api/) ([cache](/david/cache/d9457ea0fba660a5011e8671f44f212c/)) for a given action, this is adaptation to a given context but it has to be discussed and constantly challenged. *The other way around is something as generalist and unoptimized as GraphQL.* Everybody is enthusiast about that shiny-new-Facebook technology because they lack communication skills and they hope that it will avoid that necessary conversation between developers on both ends. It will just add an extra layer of complexity.
  12. That being said, I’ve been a long-time advocate of REST/hypermedia which is another way to avoid that discussion too. Today I’m more inclined to focus on a few pertinent scenarios. Maybe is it related to a change in my personality with more empathy for my peers? :-)
  13. > You don’t pay engineers to write code, you pay them to understand subtleties and edges of the problem. The code is incidental.
  14. >
  15. > <cite>Ted Dziuba</cite>