
This week I read a blog post from Postman titled “OpenAPI vs. Swagger”. You can find that here.
What is OpenAPI?
OpenAPI 3 is an API specification within YAML which outlines a RESTful API, similar to Swagger. We’ve used both Swagger and OA3 in class, and we’ve seen that they are so similar that files made using either can be displayed using the Swagger Viewer. One further note: OA3 is considered a “newer” version of Swagger 2. Being newer, it is substantially different from its predecessor.
What are the key similarities between OpenAPI 3.0 and Swagger 2?
- Both can display JSON and YAML data.
- Both utilize the JSON schema (though different kinds of the schema)
- Info block in both specifications display the same information about the API.
- Both organize their paths and HTTP methods the same way.
- OpenAPI 3.0 additionally supports describing all data with the JSON Schema
What are the key differences between OpenAPI 3.0 and Swagger 2?
- Reusable components
- Swagger 2.0: reusable components must be defined under specific fields: ‘definitions’, ‘parameters’, ‘responses’, ‘securityDefinitions’
- OpenAPI 3.0: reusable components are now in the ‘components’ block to avoid ambiguity with actual security elements
- Also new types of reusable components, such as ‘examples’ and ‘headers’.
- Data models per media types
- Swagger only allows one schema for the request and response bodies. However, in OpenAPI 3.0, you can define one schema for each (as we saw in class while working on the pantry).
- Callbacks and webhooks
- OpenAPI 3.0 supports asynchronous communication, such as the ‘awaits’ keyword, so the API does not have to provide data tied to such a keyword itself.
- Improved security
- OpenAPI 3.0 adds a new universal ‘security’ field and ‘securitySchemes’ to define security procedures and security modes.
- OpenAPI 3.0. removed Basic Auth and fixed OAuth2.0 support missing from Swagger 2.0.
- More summaries
- OpenAPI 3.0 adds a new ‘summary’ and ‘description’ field to describe paths.* level, whereas Swagger 2.0. only had a short ‘description’ field at the info level.
- The summary allows for a short description of the API, whereas the description field allows more detailed explanations of individual elements of the API.
- OpenAPI 3.0 adds a new ‘summary’ and ‘description’ field to describe paths.* level, whereas Swagger 2.0. only had a short ‘description’ field at the info level.
Why did I choose this blog?
During this semester, I was given an introduction into many of the tools that front-end/back-end developers will be using when working on product, such as JSON, REST, OpenAPI, and YAML. As we approach the capstone next semester, I figure we’ll be using these frameworks even more, so it would be to my benefit to get more acclimated to them now.
That’s all for this week.
Kevin N.
From the blog CS@Worcester – Kevin D. Nguyen by Kevin Nguyen and used with permission of the author. All other rights reserved by the author.

