1
00:00:00,480 --> 00:00:03,540
Instructor: So let's talk about OpenAPI.

2
00:00:03,540 --> 00:00:08,100
So OpenAPI is the De-Facto standard for API documentation.

3
00:00:08,100 --> 00:00:11,673
There are a few, but OpenAPI is a leader by far.

4
00:00:12,510 --> 00:00:17,510
OpenAPI specifies a description format for REST API.

5
00:00:18,060 --> 00:00:20,850
We will talk about the details of the format in a minute,

6
00:00:20,850 --> 00:00:25,080
but before it, if the name OpenAPI is not familiar,

7
00:00:25,080 --> 00:00:27,900
you have probably heard about Swagger.

8
00:00:27,900 --> 00:00:30,840
Swagger is the original name of OpenAPI,

9
00:00:30,840 --> 00:00:33,330
and the name was changed recently.

10
00:00:33,330 --> 00:00:36,030
Okay, so what OpenAPI describes?

11
00:00:36,030 --> 00:00:39,570
What contained in the format of OpenAPI?

12
00:00:39,570 --> 00:00:42,630
So OpenAPI describes the endpoints,

13
00:00:42,630 --> 00:00:47,630
and by endpoints, we usually mean the URL and the verb,

14
00:00:48,540 --> 00:00:51,450
and the parameters, which are the parameters

15
00:00:51,450 --> 00:00:54,750
that can be included in every API,

16
00:00:54,750 --> 00:00:57,420
the authentication stream, if any

17
00:00:57,420 --> 00:01:00,300
and some general information about the API,

18
00:01:00,300 --> 00:01:04,860
like the publisher description, title, version, and so on.

19
00:01:04,860 --> 00:01:07,920
Now, OpenAPI can be used to provide documentation

20
00:01:07,920 --> 00:01:09,990
and the test bed for developers.

21
00:01:09,990 --> 00:01:11,400
So what test bed is,

22
00:01:11,400 --> 00:01:14,670
test bed is an automatically generated test client

23
00:01:14,670 --> 00:01:16,140
for the REST API.

24
00:01:16,140 --> 00:01:20,670
So if you provide documentation generated by OpenAPI,

25
00:01:20,670 --> 00:01:23,130
then this documentation automatically creates

26
00:01:23,130 --> 00:01:26,370
also a REST client that the developers

27
00:01:26,370 --> 00:01:28,890
can use to test the API.

28
00:01:28,890 --> 00:01:32,760
Now from my experience, this test bed is an amazing tool

29
00:01:32,760 --> 00:01:35,610
in understanding exactly how to work with the API.

30
00:01:35,610 --> 00:01:39,270
In addition, OpenAPI can generate client libraries.

31
00:01:39,270 --> 00:01:43,350
So not only does it tell you how to use API

32
00:01:43,350 --> 00:01:46,500
but you can also get from it a client library

33
00:01:46,500 --> 00:01:50,460
in various platforms such as Java, .NET, Python, and more.

34
00:01:50,460 --> 00:01:53,070
That will make the call to the API.

35
00:01:53,070 --> 00:01:54,570
In addition to that,

36
00:01:54,570 --> 00:01:57,540
OpenAPI can also generate the API itself.

37
00:01:57,540 --> 00:01:59,700
This approach is called Design-First

38
00:01:59,700 --> 00:02:02,880
and it means that you first write the documentation

39
00:02:02,880 --> 00:02:04,920
using the OpenAPI platform,

40
00:02:04,920 --> 00:02:08,683
and OpenAPI then generates the API to be exactly

41
00:02:08,683 --> 00:02:12,900
compliant with the documentation that you just wrote.

42
00:02:12,900 --> 00:02:15,420
This is a very interesting approach, I must admit.

43
00:02:15,420 --> 00:02:18,870
I don't know of many organizations that use it, but again

44
00:02:18,870 --> 00:02:22,500
keep it in mind and it's important to be familiar with it.

45
00:02:22,500 --> 00:02:26,250
And of course OpenAPI can do much more than that.

46
00:02:26,250 --> 00:02:27,083
Now,

47
00:02:27,083 --> 00:02:30,030
the OpenAPI documentation can be automatically generated

48
00:02:30,030 --> 00:02:31,890
and this is a preferred approach.

49
00:02:31,890 --> 00:02:35,280
We will demonstrate it towards the end of this section

50
00:02:35,280 --> 00:02:38,550
and it is compatible with many API platforms.

51
00:02:38,550 --> 00:02:40,020
So you can assume that,

52
00:02:40,020 --> 00:02:42,600
no matter what is your development platform,

53
00:02:42,600 --> 00:02:46,380
you can automatically generate the OpenAPI documentation

54
00:02:46,380 --> 00:02:47,733
from this platform.

