Differences Between Swagger 2.0 and  Open API Specification 3.0

S.No. Swagger 2.0Open API Specification  3.0
 1.Version of specification Ex: Swagger 2.0Version of specification Ex: openapi: 3.0.0
 2.Swagger2.0 does not support multiple server in serversOpenapi 3.0.0 support multiple server in servers
 3.Swagger2.0 you could only describe examples using a JSON or YAML objectIn Openapi  3.0 you can describe multiple examples of any format using a JSON string
 4.Swagger 2.0 we can’t add reference external examplesOpenapi  3.0  we can also add reference external examples
 5.In Swagger 2.0, the API endpoint URL definition is broken into 3 components : host, basePath and schemas and the endpoint URL is a combination of these component values.In OpenAPI 3, this was only allowed in the actual endpoint URLs. You define the templates with a “variable” property.
 6.In swagger 2.0 body and formData parameter are used .In Openapi  3.0body and formData parameter types have been removed and replaced with requestBody.
 7.In swagger 2.0  Cookie authentication is not supported in version 2.0In Openapi  3.0  cookie parameter type was added in version 3.0
 8.Swagge 2.0 does not support the oneOf or anyOf keywordsOpenapi  3.0 support  oneOf or anyOf keywords
 9.Swagger 2.0 authentication types: Basic authentication API key (as a header or a query string parameter) OAuth 2Openapi  3.0 authentication types: HTTP authentication BasicBearer   other HTTP schemes as defined by RFC 7235 and   API keys Cookie authentication OAuth 2OpenID Connect Discovery
 10Swagger 2.0provides definitions , parameters, responsesOpen API spec 3.0 provides components object which can contain schemas, parameters, responses, examples, security schemes, links, request bodies, headers and callbacks
 11Swagger 2.0 support MIME types  Openapi  3.0 support MIME  types in a single spec.  

Structural Differences between swagger 2.0 vs opeapi 3.0

Ref Linkhttps://blog.readme.com/an-example-filled-guide-to-swagger-3-2/

Image courtesy of Admin | APISetu | Blog

Author

Leave a Reply

Your email address will not be published. Required fields are marked *