OpenAPI Specification ( Swagger ) Crash Course in Spring Boot

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello and welcome to one on one code my name is nashawi and this is the open specification crash course in this course we're gonna describe first what is open api specification version 3.0 and why do we need it then we're going to get some hands-on basic construction and annotation and syntax of open api specification we will do that by implementing the open api dependency and annotation in java spring boot application and by the end of this project we will be able to build an api with the swagger the ui and open api specification implemented and spring put and finally we will demonstrate some benefits of having an open api specification document with other api tools like postman for example so without any further ado let's get started so let's start with the open api specification definition or oos what is olas ois defines the standard language agnostic interface to restful abi which allow both humans and computers to discover and understand the capabilities of the service without access to source code or access to documentation or through network traffic inspection when properly defined a consumer can understand and interact with the remote service with a minimal amount of implementation logic in order to understand this definition we need to ask ourselves why we need to apply this specification in our api imagine you will first you will have a document which described the whole api disregards the programming language it's built in so basically if you have a spring boot application with a rest api and you apply this open abi specification standards you can extract a json file for example which contain all the information of your api and all the responses all the tags everything you can use this document for example to generate the code or the boilerplate code for your api within different programming language like node.js also you can use this document to benefit a large set of open api compatible tools like apostman so basically you apply standards you extract those standards and those drum standards are readable by all the api tools or any api tools open api compatible and you can benefit a large set of those i will show example at the end also the ability to have your avi routing operation built in different programming language with a click of the button as we said as i mentioned for about you will have one document you can use this document to do a lot of stuff we will get to that in this course okay now how we will cover this subject or this crash course there are two main ways to create an open api specification the first one we it's you by using the swagger editor to build json or yaml file then use swagger code generator to create a boilerplate code with your preferred code language for both backend or front-end so basically this is the first approach we open a website it's the swagger.io we use the editor over there to start building the schema and building the yaml file or json file of the open api specification then we generate the boilerplate code for your code the preferred code language the second way is to implement the open api library dependency in your project whether you're using for example java or neon node there is like dependency for the open api you can implement it in your project and then you start to write the swagger or open api annotation and start to document and build your api we're gonna go with the second approach in here in this course and by that i mean we're gonna have a spring boot application with uh some controllers and web dependency we're gonna add the open api dependency to this project and we're going to start to apply and write swagger and open api annotation and this endpoint to describe it now that this is like i'm showing you now the final result of this course we're going to have this uh kind of project and uh we are going to have also the swagger user interface implemented so basically this is the project we're going to have it here we're going to have endpoints described endpoints here with everything parameters or request body or responses so this is the final result of this course and worth to mention this project or this repository is uploaded to github you can find the final result in the final branch and the main in the main branch you will find the starter project so you can download it to start working with this course so enough with fury let's start to build the code so let's start in order for us to start applying the open abi swagger specification on a spring boot application for sure we're gonna need a spring boot application with web and dependency inside of it so here i have prepared a github repository which has a spring boot application and only web independency inside of it we're going to download it and i'm gonna open let's unzip it now i have this object project let me open my intellij i'm using intellij you can use whatever ide you want file open and from open we can go to the project and hit open you can see here we have a normal spring boot application here as a bom xml we only have the starter web independency and and i have defined some of controllers post mapping controllers for create to do and delete map delete to do item delete mapping also we have get all to do items which is a get mapping endpoint and we have update to do item which is a boot mapping endpoint we i have defined this endpoint so we can start applying some open api specification to it and we have one data model which is to do item and we use this data model for example when we request buddy uh when the endpoint request body so actually basically you want to send a request to this endpoint with a request body as a data model in order to for for example in here in order to update a certain object or certain database entry so we have only one database model this is the main class of the springboot application uh the first thing to do i'm gonna run this application and see what we have as i said we have a crude endpoint api example i have prepared some collection on uh postman this just for testing purposes we're gonna need it at the start but once we apply the open api identification we're gonna start to use swagger in it so now if you can see uh here i have the first one on the swagger a crash course which is the create our application is running if i send to localhost slash 8080 slash to do i will get response it's fake data as we said but uh but we just put it for the testing purposes and if i send put a request to the update i will also get uh some response get all the same i will got some list of json object and get by id it's a crude example and we have delete that at the end so basically now we have a working uh operational spring boot application with couple of routers the first thing to do if we want to start to use open api specification and swagger is to add the open api dock dependency to the bom.xml we can do that by going to maven open api doc and we can go open the mavenrepository.com and we can see here the last version is 1.6.4 we can copy the dependency and we add it to the bom.xml file and dependency tag section now if we refresh and rerun the project now we will have out of the box uh swagger uh user interface and you we can access it by going to localhost whatever port that you use the slash swagger.i slash index.html now if i open it you can see i have user interface out of the box this definition has read all the endpoints that i have but as you can see it's like it has a weird naming and we need to start specify the name a couple of things in order to make this document viable for sure as a swagger interface it gives you a lot of functionality to your project we can for example test each one of this we we used postman at the start to to send request you're using the swagger user interface you can do that here out of the box for example here i'm gonna send to get to do item any request and i'm gonna say execute and you can see that i'm having the same response so basically now i have my own user interface to test my own endpoints inside this abi so as i said you can see that the naming is not like correct we need to start to customize this user interface and we need to start to see the section of this swagger and user interface first at the sections of this user interface we have the search button over there you can search if you have a lot of end points in here and you need to search for specific one you can search for it here after that we have the project title which here in this case here it's open api definition for sure we're going to change it we have the version of the project and this is a green box here determine which open api specification version that we are using in this case we are using open api specification version 3. under that you can see there's a small link which is this is the link for the actual open api specification document json file you can take this json file and apply it on multiple uh tools to build api we can we're gonna see some application for this uh the document after this section we're gonna we have the servers section which include all the servers that you're using in our cases now we have only one server because we are using only locally on the localhost but for example if you are running your uh project on cloud also you can have another server in here and you can like switch between them in order to test and in order also to identify all the endpoints that you have if it's working or not uh after that in this section we have the actual endpoints here and each one of this on points as you can see has its own title and this is doesn't make sense also we're going to use tags to fix this one uh after that this is the method type and the endpoint for example this this is the get to do item by id endpoint it's using the get and this is the url for this endpoint so it's whatever uh host that you're using slash to do's slash the the to-do item id which is a path variable id after that we have the parameters in here and responses section in in the bottom parameters if you did tr if you try to try out you can see that you can put whatever variable that you want in here and you can execute it and you can do a clear in the responses section you can see that we have uh an example of c url sending method from the cmd if you want to use it you can copy and paste for example if we open a cmd and we take this is the crl command and apply it we can get out of the box response after that the request url is in total after you executed and the server response in here as a code and details so this is basically the whole thing at the end of the section of this uh user interface swagger user interface you see the schemas or the data models in our case we have only one data models which is to do item as i should show you and it's basically a bujo class which has couple of attributes and structure constructor this is like here if you have any other data models used inside of it you can see it in this section so let's start to customize this user interface and let's start to add some open api definition to our project in order to describe the whole api the first thing we're going to do is changing the project name here and changing the version and we can do that by going to our main class which is let me close this one first which is the swagger the runner class and under the add spring boot application you will add at open api definition this is the first uh annotation of uh open api or or swagger inside your project what we can add here uh one thing to mention uh any of this annotation if you hit command and after that you press the mouse click you can and enter inside the interface itself or inside the annotation itself and you can see what is the available attributes and values that you can use in our example here we have the open api definition interface we have inside of it and info uh attributes we have tag attribute servers security requirement so basically each one of this one you can access it by just hitting command on uh mark or control on a pc and you can access uh this uh attributes inside so you can check all the lists inside we're gonna focus uh on this course only on the basics because it's a crash course and we're not gonna like do in details one of one by one of this attributes so as we said open either definition we open brackets the first thing we can define is info tag and this is in the info the same in here inside this info this will take at info interface or annotation inside this info we can define the title first which is going to be and for in our case here let's call it to do project to do items project for example or api we can also add the version inside we after the comma and version let's put for example 1.0.0 now let's try to run the project and see what we got in here if we refresh you can see now we have changed the project name and we have set a version for our specification all those changes will be reflected inside as we said the json file of the open specification itself so here now we have open api specification 3.0.0 we have the info tag of the project which we define the title to do item api and version 1.0.0 this is the first thing to do next we want to define some of the global surface servers as we said the glo now we are working only on one server but what if you have another uh copy of this project or another clone of this project running on some container based in the cloud and you want to also test do some endpoint after the pipeline is executed so to do that we're gonna add also inside the open api definition let me take some lines and new lines here in order to separate things and make it more clear we can here say servers and if we check inside the servers you can see it takes a server array which has an interface of their server annotation with the url and description and some variables if you want to define any variables and extension so i'm going to use alt first i'm going to open uh curly brackets to determine that it's going to be an array and couple of those items gonna sit inside this tag and i'm gonna open the first one which is uh at server annotation inside this i'm gonna put the url in our case here the first one is the local host which we're using right now it's going to be localhost 8080 and we're going to add another one which is going to be anything let's put for example here my domain and we can say sorry at server url we can say http [Applause] 101.com now if we rerun the project you can see now we have two servers localhost 8080 and 101. now because we're on default localhost if we try to execute we're going to get that some result because our uh our project is already running but for example there's no uh project version running on this 101.com if i choose it right now and i try out again i'm gonna get some errors because it's failed to fetch and possible reason course or network failure this is because this api is not exist so here here's how we can define uh global servers although worse to mention you can always override those global servers in each or one of this endpoint for example if you have one endpoint that use only one server you can override this one here by using the operation tag so this is the at open api definition tag in the main class okay moving forward now let's start describing our endpoint one by one and i'm gonna focus on one endpoint which is gonna be the update to do item because this one has all the property that we wanna define and it's also include uh most of the things that we want to discuss inside this crash course so as we said we have a five endpoints uh we're gonna start at the uh the first uh by the fair defining some tags as you can see each one of this endpoint has its own tag or n on our own category let's call it and it doesn't make sense because all of those uh end points uh belonging to the to-do's slash to-do's and it all working with one data model so it makes more sense if we have all of those endpoints inside one tag only and we can do that by always uh using the add operation this is a wrapper this wrapper is a swagger 3 wrapper and we use it now before that we used to have uh we used to use each tag separately for example if we want one tag we can put it outside this is still working but it's going to be deprecated after a while it's better now if you want to describe your end point you always start with one big wrap wrapper class let's call it a wrapper interface which is going to be operation inside this operation everything will be inside of it so actually anything we want to define to describe this endpoint it will be inside the operation so now we can define tags and it's if we see inside this operation we have a lot of attributes now we are talking about the tags attribute which is going to be this one it's a string array so basically we open a curly brackets and we can add tags it's array because each one of this endpoint can have more than one tag or one category so it's not only a single category now i'm gonna put to do item as uh or to do items here as our first tag if i refresh now you can see now i have to do items tag okay i wanna put everything all the other endpoints inside the stack so i'm gonna copy and paste the whole operation tag in here all end points and here and also here and for sure you can see we hard writing uh manual writing the name of this tag but you always can use application.properties to set some [Music] variable which is going to be global so now if i rerun the project again you will see we have all the endpoints under the to-do items which is better and make more sense and as we said each endpoint can have multiple tags so for example if i want or this one put to appear in two places i can add let me go to the update i can add another tag in here which is going to be let's call it to do items 2. now this endpoint will appear in two places you can see to do items the same one here and the same look on the inside this tag and we can also add some description for this tags if we want but this is not gonna be from the add operation tag this is going to be from the main class and we can get inside the open api definition open comma here and we have the tags uh array which will take a tag for example and inside this one we'll take the name this name should correspond to the tag name which you defined before so if you want to put some description for to do items it should be to do items after that we can have a description this is the to do items description now if i refresh again you can see now we have a description for it so this is the tags moving forward the next thing we're gonna do to describe our endpoint is uh start putting some tags inside that operation uh so we can have more description for this is this endpoint uh we can put an operation id as a start and this is for referencing purposes maybe you have some callbacks you have some other endpoints to communicate with this one this one so you defined a unique operation id for this one and you can use it in the future it's out of scope of this course but you have this uh property here to be defined and i'm gonna define it here and let's say this the operation id is gonna be update to do we can also add a description we have two sections actually for the description we have the summary the summary will appear in here and the description will appear under the title of this endpoint so if we said summary this is the summary and if we said description now if i re-refresh and re-run the project you can see in our endpoint we have now this is the summary and this is the description you can hear it start to describe what this endpoint do uh now if i want if we want to study this one this endpoint you can see that we have couple of things in this endpoint first as a request this endpoint required a pass variable which is this one to do item id and this uh also needs a cookie which is gonna be can edit a cookie value cookie parameters and it has also a header which is called fromhost and it has his client inside the the query which the query we mean by that everything comes after uh the question mark in the url so basically in order for this uh request to be fulfilled if you want to send to this end point you need to provide a path variable you need to provide a cookie and you need to provide a header and a query and i put everything inside this endpoint so we can start to describe one by one and we can see how we can do that and the request body section is uh where you send your form uh information or details for example if this endpoint is responsible to update a certain object you're gonna put the object here and the request body it can be uh json json is the must uses the used request body so let's take with json and you can see the schema here and this is as you can see the swagger and the user interface read this one out of the box we didn't define anything but because we have here in this endpoint uh the annotation at request body and we bind it to the to-do item model so swagger uh automatically knows that this is the data model that we are using and it's gonna be the request body in here and this is a very good thing in this user interface because now if we want to try this one we just need to add some uh fill some data fields and as you can see it also give us the request body as a json object we just need to hit execute and everything is going to work moving forward let's start first to describe our request body we can have some description for this request body we can even change the schema of this request body for any reason and we can do that by using first inside the operation as i said everything is going to go inside the operation wrapper so we put comma and we say here the request body and now we can start to define the request body and if we open it here you can see the request body will take a request body interface or annotation which will take description content and if it's required or not so at request body and here we have to be careful with one thing this is like a common mistake when you start using uh swagger or open abi definition as a request body we have two libraries the original library from spring framework and the swagger library in this annotation it's okay to use the spring framework original annotation but when you define the request body in here you have to use the swagger one this makes some problems and you can find this answers on stack overflow so here now we import this one we can say inside the request body first we can put some description this is the request body description for example now if i rerun and refresh in here you can see now we have some description for our uh request body we can also define the content as you can see here out of the box as i said uh swagger has already defined the content of this request body but if the for any reason you want to change this content we can do that for by inside doing that inside the request body you can see we instill inside the brackets of request body we do comma i'm gonna i have a new line here so i can start writing and here i can say content inside this content i can take the content interface also inside this one i can say the schema is gonna be at schema also and in order to change this one we only have now one data model i'm gonna insert a new data model just for testing purposes let's call it customer it's gonna be simple let's put only one variable inside of it or one attribute string customer id and let's do some constructor here so this can can be read as a data model for sure you always can use a helping library like like lombok lombok is great for these things but now it's out of the scope of this course so now we have another data model now as i said if i want to change the content model here or the schema i can say at here implementation is equal to customer dot class now if we rerun you can see that now the request body has a different schema which is customer id and as i said it doesn't make sense to change it but i only showing you how you can do that so this is the request body tag the next attribute we're going to do now is starting defining our parameters as we said here we have a couple of parameters in here in this case path variable cookie value request header and request parameter the only exception is at request body it as you can see the request body has its own attribute here to be defined but all other this parameters can be used with only one attribute which is parameters so parameters can include the description of all of this uh different kind of uh let's call it inputs so now i'm going to start by defining the pass or by the putting some description for this one which is the path variable to the item we can do that always by using one thing is add parameters add parameter interface open brackets and inside a parameter interface we have to define the name the name should correspond to the same name in here so the description will be matched otherwise you will have a problem and i'm gonna take it copy and paste after we define the name now we are binding this parameter to the other one we can set a description and we can set an example so description in here this is like the i'm gonna put the path variable and as we said we can put example for how what what the input is going to be for example as we have to do a item id let's put five five four uh i didn't put example in here and five five four now if we run again you can see now we have a description for this parameter which is the past variable an example of what it's gonna be and if you wanna try out the example will be filled automatically here so all you have to do is put some examples and you can start using this endpoint this is as i said inside the parameters array and it's going to correspond to the all of those things let me show you something inside of this one add parameters you can also define something called in it doesn't make sense to change the place of this uh parameters because you already defined it and spring boot are the bus variable and the swagger already know it but also i'm going to show you if you want to change the place of this parameter for example from past variable to a request header or cookie value you can do that by doing in which will take parameters in enum for example and let me show you what is parameters in enum it will have values header query path and cookie uh now as we said it's inside the dot path and it doesn't make sense to change it but if you want to change it for any reason this is how you can change the place of this parameters when you check once you change it here it's going to be reflected inside the body uh for the other parameters in here it's gonna be the same process so basically copy and paste change the name put some description as you want and put some example for it okay moving forward the next attribute is hidden attribute for any reason sometimes you want to hide the whole endpoint hold from your user interface and you can do that by using hidden and it's a boolean value so you can set it to true it's by default false if you set it to true your endpoint will be disappeared right now from the user interface in here you can see it's disappeared so let's remove it because we are using this endpoint uh the other the next thing we can define now is the external documents sometimes you will have some description for your endpoint in this user interface but also you will have documentation maybe more extended documentation in other place so you can define an external documentation with which gonna be an external link for your documentation you can do that by using external docs attribute and this one will take an external documentation interface so we can do at external documentation and inside external documentation we can define the url for this documentation let's give it for example here one on dot com slash docs and also if you want you can put other things like description and extensions let's put a description in here let's say for more details check the link now if we refresh again you can see now we have find more details for more details check the links and if you had press it it will take you to the external dock okay moving forward the next thing we can describe is the responses as you see now we almost describe the whole request but uh thing like we describe what kind of attributes and what kind of parameters this request required in order to function properly we describe the request body we change the type of this request buddy now we can also describe what kind of responses that we are expected as you know the http responses code 200 means successful 400 mean bad request 404 mean it's not found we can describe all of this in here so uh how we can do that it's also inside at operation rubbers as i say everything goes inside at operation rubbers and we will have a responses attribute array this responses attribute array we will it will take at abi response user interface inside this one we can define first the response code which in my case now i'm going to define the first response which is the successful response and it's going to be 200 inside this one we can also define the content of the response itself and in our cases i'm going to use the i'm going to say that the response of this api is going to be the the same uh uh example the same request body that we used so if basically if we you send an or json object here uh it will like gonna be it's gonna be like published also in here because as you can see i'm taking the request body and i'm sending it again so because we may change the schema when we start to describe the request body i'm gonna remove this one here so we can uh get back to our original schema or i can put the schema in here let me put the schema once more time okay now i'm gonna remove the content just to check again and see what's happened now we're back to the original schema which is the request body as you can see to do item model so i'm gonna expect the same response here you can see now because we didn't describe it we don't have the same response in here so as we said the response code is 200 we can define the content and i'm gonna do content at content as we did before at the scheme is going to be at schema and the implementation will be from the to-do item as we did before now if i rerun again you can see now we have the response code 200 which is successful and we will get this one as a example of the value that we can come we can also put some description success succeeds response for example [Applause] you can see now we have this is a success response as a description we can all also define that the output will be in certain media type as you can see here we have the wild card which is it's going to be anything we can do what we can do we can say in here inside the schema tag let's take it here we can say inside the schema that the media the media type will be uh media type and this is uh enum from a framework and this is you can see the media type we have json we have uh other like form url encoded value etc so the media type in here is going to be json now we are defining that the output will be in json format when this response code 200 is successfully done so let's refresh now you see that the media type is application.json if you have a couple of responses valuable variable here for example because we can only define a one abi response for each status code like 200 in here and maybe there are some cases where sometimes you will have this as a response and another maybe data model as a response it doesn't make sense but i'm going to show you as i said how you can do it you can put inside the ad content scheme at content interface well example which is array this array will take an example object and so let's open curly brackets let's say example object and this example object will take name and value let's put name and value in here and let's see what's going to happen so name succeeds one let's call it and value is going to be object for example and let's put another one succeeds to and fi value for example maybe it will be string if we refresh again you can see now under the 200 status code we have example one and example two if we change between example one and example two we will have a different value in here so this is how we define api responses now getting to the last and important thing here which is the authentication we haven't spoke about any authentication until so far now other your api endpoint will sure use some kind of authentication maybe http basic maybe bearer token maybe oauth flow i don't know uh you can define this one by doing two things first you can define the global authentication in which the project will be used and you can see it as a description and you can after that say at each endpoint which authentication system this endpoint will use so it's it's an endpoint specification but you defined it on the global term uh to understand to describe this more let's start by going to the main class and we want to define a security schema so we use add security schema inside the security schema we will have first the name and this name is um you can choose whatever name you want but choose something describe which one you use in my case here i'm going to use the bureau token authentication system with gwt so i'm going to name it here peerer gwt as i said you can do you can name it wherever you want this is required now we have the name for the schema we should define also the type the type should be a security schema enum and if we open the script schema even arm here we can see that we have api key we have http we have open aida connect and we have oauth2 in our case we're going to use the http so dot http now we define the type we should define the schema the schema in this case it's going to be mirror and as you know the bearer token is inside the header so it doesn't no need to define this one but if you want to change it for any reason you can use in as we said parameter and before dot maybe you this now that your pr talking is inside the cookie maybe it's inside uh query for any reason if you want to change it how you can this is how you can change it here we can keep it at default in header so i'm not going to define that after that we need to set the appearer format and in our cases the pr format is going to be gwt use it all capital and i'm going to put here let me take a new line i'm gonna put here some description which is mirror token for the project now we define the security scheme if we rerun the project now as you can see now before i refresh here we don't have any authorization system and we don't have any indication that we have any authorization system inside this project now if i refresh again you can see now we have this here as otherwise if we press on it you will see that it's pure gwt as i define the name in here and this is the description i added and this is the type it's http error we even can put some value here to be used so far as i said we defined the global authorization system but not even one of those endpoints are using it so because sometimes you will have public endpoints and where you will have a private endpoints so that makes sense that it's uh endpoint specific uh identification and not like definition sorry and not like a global so for example now i'm gonna say that this put end point should use the builder authentication and i can define that by going to the same endpoint here which is update to do item and it's also inside that operation tag i will take comma and i will say security inside the security here you can see it takes a security requirement and this is an array sometimes you will have more than one secure authentication system or security system in your project and you can define the couple and you can use it a couple of those authentication in each endpoint so getting back to the our end point i'm gonna say here it's at uh first it's a an array and it will take a security requirement inside the security requirement we should define the name the name should correspond to the name of the uh to the name of the security scheme that you want to use in our case here we said we can set the name for prgwt so if you want your endpoint to use this one it should be the same name so prgwd now if i rerun the project you can see here there's nothing or any indication that this endpoint are using this authorization if i refresh now we have the lock icon here which determined that this endpoint need or required an authentication and if you want to use it you can put for example if you have any authentication system we didn't install an authentication system because it's out of the scope of this course but if you already set one and you have now the bearer token which is going to be something like that for example you can add it here and set otherwise now every time you want to try out this endpoint the value which we set here will be sent inside the header authentication so this is how you define an open api specification and this is how you describe your endpoint inside swagger a spring boot or open api document project now as we promised in the first of the course we will see some of the application how we can benefit from the json file which is the open specification json file as we said we can access the open specification document by hitting the link in here now this is the json file we can do a file and we can do save page as and i'm going to put it as api documentation it's going to be dot json file now we have this documentation json file which is agnostic of any programming language so the first benefit is we can use this one with the swagger code generation to generate some boilerplate code and also to preview the api itself and we can do that by going to google and say swagger code gen you can see we will get to the code generator and from swagger.io we go to editor and we press live demo here as you can see we have [Music] already the code generation if you make import file and you do this one now you have your file in here uh the best thing the first good thing here that you can if you for example having any meeting with any client and you don't have your project with you and you want to show the result of your documentation for the client or maybe other part of the team without having a fully spring boot application running you can use the editor here in the code generation in swagger.io to see to review your uh swagger documentation this is a fully functional you can use it you can try it out and this is a very good thing also you can use the servers is as you defined it in here this is the first benefit the second one as we said this documentation is a an agnostic of any which programming language that you use you can see we built that using uh spring boot and java but what if for any reason you want to change the programming language of your api and maybe use for example node gs with express this is also the good thing once you have the json file we can use the swagger.io and we can generate a server this is going to generate for us a boilerplate code project out of the box for whatever programming language that you want in my case here i want it for a node.js server now as you see it generated file if i open it and unzip it and get inside now i have node.js folder project with express and i have the same controllers and same functionality as my api here with the click of the button now you can tweak some maybe uh of the properties inside but now with the click of button you have another uh programming language project for your api this is a very cool thing if you think about it also this is we build a server and we build a node gs here with express as a server as a backend but all you can also use this open api specification to generate a client a front-end for example an angular front-end to consume your api in here and you can do that by also generate client in my case here i'm gonna generate typescript angular and i if i open it and unzip it you can and see that we have a fully functional angular project with also a boilerplate code we have the models in here we have abis which will have the routing inside of it for each one of the endpoint that we already defined in our api so this is the first application or the mini application with the swagger.io which is very great and which gives you a lot of things to do the next application that we're gonna uh preview is that you can use this uh json file with the postman and uh you can create the whole api and whole documentation inside postman for guys who like to work with the postman and just like by feeding this json file to the system over there so opening postman we can do that by hitting file import and feed the json file to postman as you can see uh postman identified this project as open abi 3.0 and this is the project name and it will create a whole api and whole documentation for it i'm going to press import and now you can see inside the api we have to do items abi and we have a definition full definition for an api also as json we have a documentation built by postman out of the box also we can also use the code generation of postman to do the same as we said we do with the swagger.io so the at skype limit actually you can use a lot of abi tools you can even max mock services here you can do whatever you want with this json file so this is a great tool actually and you will see also in the collection bostmann out of the box also create a to-do item api for us which has all the get and post and delete things that we already did that's it for this video thank you for watching if you find this information useful don't forget to hit like and subscribe thanks and bye bye
Info
Channel: One O One Code
Views: 11,420
Rating: undefined out of 5
Keywords:
Id: 0vqgWQIVfMI
Channel Id: undefined
Length: 54min 28sec (3268 seconds)
Published: Thu Jan 27 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.