Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenAPI vs JSON:API

I couldn't find any resources on the use case differences between JSON:API & OpenAPI

From my understanding, JSON:API is more focused on the business data while OpenAPI is more about REST itself?

Any pointers would be great, thanks!

like image 399
Webber Avatar asked Nov 13 '20 22:11

Webber


People also ask

What is the difference between OpenAPI and REST API?

REST APIs vs. The most common open API architectures fall into two categories: REST APIs and SOAP APIs. SOAP and REST offer different methods to invoke a web service. SOAP-based APIs typically use XML as a data exchange format, while RESTful APIs typically use JSON back and forth.

Is OpenAPI a JSON Schema?

OpenAPI Schema is a Vocabulary of JSON Schema 2020-12 The OpenAPI Schema Object is a JSON Schema vocabulary which extends JSON Schema Core and Validation vocabularies. As such any keyword available for those vocabularies is by definition available in OpenAPI, and will work the exact same way. Booyeah.

Is OpenAPI the same as Swagger?

OpenAPI and Swagger used to refer to the same thing. While there are differences today (OpenAPI refers to RESTful API design and Swagger refers to a set of SmartBear tools), this blog will use the terms interchangeably. If you develop software today, chances are you are developing web APIs as well.

Does swagger use JSON Schema?

Swagger supports only subset of JSON Schema Draft 4 Specification of Swagger 1.2 and 2.0 states, it supports only subset of JSON Schema Draft 4 (s. here). This means, that: one cannot rely, that each valid JSON Schema can be completely supported by Swagger.


2 Answers

You can use OpenAPI to describe API's, and JSON:API is a standard to structure your apis. If you use JSON:API, you can still use OpenAPI to describe it.

So OpenAPI's goal is really to provide a full description on how your API can be called, and what operations are available. JSON:API gives you a strong opinion on how to structure it.

like image 91
Evert Avatar answered Nov 18 '22 16:11

Evert


Think about it as OpenAPI is a “Data Format” and JSON API is a “Data Contract”.

More on this here: https://apisyouwonthate.com/blog/json-api-openapi-and-json-schema-working-in-harmony

like image 26
mrded Avatar answered Nov 18 '22 17:11

mrded