text
stringlengths
0
1.49k
To do so, I had to analyze the Twitter Firehose and so on, and Ruby didn't get me far enough, so I started looking for something else and I found Scala. Scala at that time only had Lift as a web framework. People said it was very interesting, but from my point of view it was a web framework that conflated all kinds of ...
There was a proof of concept at the time which had just been renamed to [Scalatra](https://github.com/scalatra/scalatra), so I started contributing, and after a while I was one of the main contributors on that open source project. It was fairly successful, but Scala itself has problems. The language is good, but the co...
In the meantime, through Scalatra I got into [Swagger](https://swagger.io/), because we have to document the API's. The company that invented Swagger hired me, so that's how I got deeper and deeper into that entire Swagger and OpenAPI story. When I switched to Go there was nothing there, so I figured people in Go also ...
**Erik St. Martin:** Let's back up just a second and let's give a little bit of a rundown on what Swagger is, for anybody who may not have used it or are familiar with it.
**Ivan Porto Carrero:** Swagger is currently known as [OpenAPI](https://github.com/OAI/OpenAPI-Specification), I guess, but it started its name as Swagger. The reason it was named Swagger is because the only alternative he had was something that is the acronym of WADL... So in the office, people were like "Why WADL if ...
Everybody who writes an API ends up having the same problem - now you have a bunch of clients who are talking to your API; you still wanna be able to evolve your API over time, you bring new people on board, they don't know how to use your API, they don't know what the inputs are, what the outputs are, especially if yo...
\[08:03\] Essentially, it's just a schema for your input and output parameters that captures what some people look at as a contract for your API. Once you have a machine-readable version of something like that, you can take it in many different forms. The very first thing that we then did was make a UI for it, because ...
From there, obviously, machine-readable makes it also that it's easy to generate clients for your API, because you now know exactly what goes in and out of the API, so you can generate a client for it. If you then take that a little bit further and you make the API specification easy to define, from there you could als...
So that's a rundown of what Swagger is. Of course, there are marketplaces now where you can look at all of the API's other companies expose, and so the bigger dream here is if every API exposes a five-year spec, you never have to download a client SDK anymore; you can just always generate one.
**Erik St. Martin:** Yeah, one of my favorite things too is like whenever you use a new API for something, you're always kind of poking around at it and trying things out... And the fact that you can just go into the Swagger UI and kind of play with the example requests and submit them and see how they return and thing...
**Ivan Porto Carrero:** Yeah.
**Carlisia Thompson:** Ivan, describe in a bit more detail how do you go from the Go code to having that beautiful HTML API documentation, and what do you need? Do you need to boot up a server to serve that HTML? How does it work?
**Ivan Porto Carrero:** What you need is you download the binary, a Swagger binary, and you add some vocabulary in your document comment. Because there are two main use cases here - generating a specification from an existing codebase, which I suspect, but I really have no way of tracking that -- I suspect most people ...
In that case, what I've tried to do is define a number of documentation comments that also look good when you just do GoDoc, to describe what is in your API. So you document your routes with some of the expectations that are required for Swagger, you document your models, and you just write doc comments, basically. The...
\[12:17\] From there, you take the Swagger binary and you do `swagger surf`, and point it to the spec document that you just created, and it will serve up an HTML UI for you.
**Carlisia Thompson:** So if I want to have a system where I can share this documentation with my entire team, should I have them download Swagger? Should they download the binary and run -- for example, I can have the Swagger documentation file on GitHub somewhere, maybe together with my project; they download that, t...
**Ivan Porto Carrero:** You don't have to download a server necessarily, as long as you publish the Swagger JSON somewhere.
**Carlisia Thompson:** Yeah, not a server, the binary... The Swagger binary, the tool.
**Ivan Porto Carrero:** Yeah, once you have a Swagger JSON document, you don't really need the binary anymore, because there is...
**Carlisia Thompson:** Oh, because it's generated already.
**Ivan Porto Carrero:** Yeah, you have the Swagger JSON, so if you push the Swagger JSON onto like a gist, or something, then people could use the raw URL and use it with \[unintelligible 00:13:32.10\] to leverage the UI that is published there, and just paste that in the address box there, and then it will serve you t...
**Carlisia Thompson:** If I have it on a GitHub repo, would I get the nice interaction?
**Ivan Porto Carrero:** No, you need to have your API running. The best way to do it is -- what was originally specified (or part of the specification was) it would always be at the root/swaggerjson of your API. So if you run your server, you have to make sure that it serves the Swagger spec somewhere. Get a richer API...
**Carlisia Thompson:** Gotcha. Thank you.
**Ivan Porto Carrero:** If you use a Swagger binary to generate your server from a Swagger spec you define upfront then you get all of that for free, because it's part of the server that gets generated.
**Brian Ketelsen:** There are several Go routers or multiplexers that have varying forms of support for the Swagger spec. Some of them, like [go-restful](https://github.com/emicklei/go-restful), will automatically generate the Swagger bits. And some of them require you to do things like doc comments to generate Swagger...
**Ivan Porto Carrero:** Cool.
**Erik St. Martin:** Yeah, and it actually exists in more projects than people probably realize. I'm fairly certain both [Docker](https://www.docker.com/) and [Kubernetes](https://kubernetes.io/) have Swagger support.
**Ivan Porto Carrero:** \[15:52\] Yeah. Actually, the Docker API, the last time I looked - but things might have changed again - uses the generated version of it, so they use it to generate their models. Then Kubernetes uses it through Go RESTful, but then custom resources in Kubernetes \[unintelligible 00:16:11.00\] t...
There were varying libraries to do JSON Schema within Go, but most of them had some problems and I tried to submit some PRs, they never got accepted, so I decided to fork and just make it work the way I wanted it to work.
So yeah, it's in many places. Last week there was a project - \[unintelligible 00:17:00.03\] or something; I can post it in the Slack channel - that generates a whole series of tests for your API. So it will then try to fast-test your API when you generate it, based on the Swagger spec.
**Brian Ketelsen:** Oh, that's nice.
**Ivan Porto Carrero:** Yeah, I agree.
**Brian Ketelsen:** So now you're at VMware, working on the PKS team?
**Ivan Porto Carrero:** Yeah.
**Brian Ketelsen:** I think it's kind of amusing that half of the tech industry is employed now in some way, shape or form around Kubernetes.
**Ivan Porto Carrero:** Yeah. Well, when I joined VMware, I started making noise about Kubernetes, and after several false starts, we landed on doing this PKS thing. Kubernetes has been this interesting evolution. It's like "Let's do open stack, but not open stack, let's make it a lot better, make it all-out containers...
**Erik St. Martin:** Yeah, it's really exploded. I think that it was a really awesome initiative to begin with. A common conversation I have with people with adoption of Kubernetes is just maintenance of the infrastructure in itself is work. People will be quick to implement it, but then they find they're struggling wi...
**Brian Ketelsen:** GCE... GKE!
**Ivan Porto Carrero:** [GKE](https://cloud.google.com/kubernetes-engine/), yeah!
**Erik St. Martin:** Yeah. That's kind of like the perfect world, right? You get all the benefits of Kubernetes, you only have to focus on developing apps that are kind of cloud-native and run on it, and you don't have to worry about the infrastructure.
**Ivan Porto Carrero:** Yeah. At VMware it's a fairly interesting mix here, because by definition people are worrying about the infrastructure, because we have this vSphere product... So the people we go to typically know how to deal with hardware and all of the failure scenarios that come from there.
It's this interesting thing - Kubernetes allows you to package your app and deploy the containers and do all of that service discovery, all of the coordinated stuff you are actually required to run these larger infrastructures, but I think most people are surprised by how much Linux you have to know to really operate i...
**Erik St. Martin:** \[20:19\] Yeah, it's a lot of fun. I think that there should be experts in that stuff, too. Don't get me wrong, but a lot of businesses, especially smaller businesses - they're worried about having to scale fast, and things like that... And then once you start hitting odd scenarios and stuff like t...
It's a fun world, right? Some of us enjoy doing that, but not everybody has the extra resources to be able to do that. And like you said, with the on-prem people and stuff like that that are used to running vSphere and things like that - they've already got that expertise on their team. And not every team is fortunate ...
**Ivan Porto Carrero:** Yeah. I'm very interested to see what's gonna happen with [Istio](https://istio.io/), because that's a very puzzling project to me. I understand the problem it's trying to solve, but I think most businesses who look at these solutions are latency-sensitive and I don't know how Istio is going to ...
**Erik St. Martin:** Yeah, there's a lot of interesting things that have popped up in maybe the last six to nine months. You've got Istio, [Envoy](https://www.envoyproxy.io/) that came out of Lyft... That's super interesting. And all of these are so early, and they work and they solve problems, but I'm really intereste...
**Ivan Porto Carrero:** Yeah, I think that's one of the unsolved problems so far - how can we tell you what's broken right now, and how do you get out of it? \[laughs\]
**Brian Ketelsen:** Yeah.
**Erik St. Martin:** I think one of the hardest parts right now is everything's moving so fast and there's so many cool projects popping up, it's kind of like that analysis paralysis - which one of these will be the thing? You could adopt Istio, and in six months nobody's using Istio, there's some new thing. Everything...