Hey there, everyone that they share.
And from this video onwards, I will be skipping the information about explaining about the tags, what
summary does, what responses does.
Of course, everything, anything that new comes in like we have just seen the responses.
We haven't seen about the request and a whole bunch of headers.
So I'll explain those, but I won't be repeating this again.
So in case you are jumping around in the videos, you will find it difficult.
So follow the path and the flow of the course in case somebody else is jumping around and having an
issue in the comment section.
Don't forget to notify him that you have skipped the videos.
That's why it is creating an issue for you.
Okay, so let's move on now.
In the next one, we are going to take down first and foremost, one thing that is bothering us quite
a lot is we need to select all these things again.
Again, we need to do something about it.
We need to provide the default.
So how do we provide default?
It is like couldn't be much more easier than this.
Once you have defined the enum, it actually goes into the same indentation level as enum.
So let's go up here and all you got to do is simply name the default whatever you want to go.
In this case, I want to go for V one because we are working on the version one and same thing goes
up here.
I'm going to go ahead and say default.
And in my case it is HTTP only, not the https.
Once I do this, I go back up here, hit the reload and I can notice my computer.
The URL is now http, but still I have my enemies that if I want to I can go ahead and change them.
So this solves our one issue.
So that is great.
Now let's go back into the index case and what I will do now is I'll grab a copy of this one.
So let's go ahead and grab this one and there we go.
Now this time we want to have an AE object.
So we'll study about how, when objects are returned, how we can write schema for that and how the
response actually should look like.
So for this one, we are going to send a response and again, you can go ahead and use the resort JSON
in case you want to really send that.
I leave that as a simple exercise for you.
So in this case, we are going to just remove all of this.
Instead, I'll send a JSON like this.
I know we can use the courses that we have created.
We can send a first value or the second value of it.
We will use that.
Don't worry on that.
But this time we'll be going up and we'll be saying something like this.
So manually insert all the values name is going to be something like Learn Back End.
That's exactly what you are doing right now.
And let's go ahead and add the final one, which is going to be price, which let's just say is nine,
nine, nine.
Okay.
So this is the route that we have and we have to write the documentation for this one.
Now, usually what you will be doing in this case is first, make sure you always close these guys,
otherwise they will be too much of a big file.
Now you can also go ahead and close this from any of the point like get and all of that.
Now this is a completely different path that we're having.
Make sure one thing you always understand that if you're creating a new path, you come back up here,
you have to write that on the same indentation up here.
So all of this goes up here.
As soon as I hit the tab, notice it's going all the way crazy.
So sometimes you have to keep track of how many spaces or tabs you are giving and then start writing
the new path.
Like I have to write the AE object just here, otherwise it's going to go all crazy.
Now one of the thing that I absolutely love is the skills of copy pasting and the keyboard shortcuts,
so I can go ahead and select all of this because this is all kind of exactly in most of the request.
You are going to need some or the other form of this exact same structure.
So I go ahead and get a copy of it.
It somehow maintains my indentation level.
The errors are because it doesn't allow the repetition of the same path with the same values.
So I have to go ahead and say ae object.
Now this is all happy, but I can have one more space up here.
Notice it messed it up again.
So I need to make sure that this is all good.
So as soon as I saved this, and by doing only this much, you will now understand that what this tags
actually mean.
So I go back up here, hit a reload.
Now notice all of them are actually under the category of the strings.
That's all because of the tags.
Now, this is not a string.
This is more about objects.
So I'll create a new category for this by defining a new tag, which is object.
And I can go ahead and hit reload.
And now you can see that I have a string category and I have this object category.
So you can define, let's just say all the products under this category, all the roots, four categories,
maybe stocks or different payment routes, all in one category.
This actually makes life a little bit easier.
Not too much, but of course, a little bit.
Okay, moving on.
Now that you understand this, one returns.
Returns a unique course.
Yeah, that's fine.
Now we can see that we have responses again.
We can work similarly, like we have worked on 200.
We can work on 405 hundred and you can copy paste that.
I won't be doing that.
I'll show you that.
What is the difference between up here?
So description is all good content.
We will be still getting an application json.
The schema changes a little bit because this is now not a string but an object that will be coming up
and it supports string object arrays.
We'll see them later on.
But now this example cannot be like this.
It can be different.
I will not be giving an example in the case of objects, but rather I would like to show the scheme
that how it looks like, like schema in that scheme.
So there we go.
Now make sure you hit once we have this object type up here.
So let's go ahead and define the properties.
Now one thing to note down properties only come when there is a type of object, otherwise it doesn't
come.
This is specifically related to object because let me show you that this is an object.
So notice here and the line number 38, this is an object.
Now inside each object, there are properties and these key value pairs together are known as properties.
And this property has a key and a value.
That's why we call them so quite interesting one.
Okay, so how this is going to look like it will show us an ID and let's go ahead and define what is
going to be type of this one.
In this case, this is going to be a string.
We'll receive another one.
Let's call this one as name because that's what's coming in.
And let's also define the type of it which is also a string.
And there's another one which is coming up is price.
And there we go.
The type is going to be further string.
Now, if there is also an object coming up inside an object, so you can go ahead and define something
like something.
I'm running out of the name, so let's call it this cause again.
Then it can have a type of object and then you can go ahead and define properties again.
You get the idea what I'm trying to explain up here, I'm going to go ahead and remove these three guys.
Let's go ahead and save this.
Let's go back on to this one and hit a reload.
And now we have this object.
Let's expand this one and understand this one.
This is going to request a LC object.
Let's go ahead and try this out and execute.
And this gives us the response body as whatever we have sent it up here.
But if I go ahead and cancel this out and let me just try to hit a reload up here one more time.
Now notice here that it says that this is how the example value will come up.
So automatically it fills it up that you will receive an object which will have these key value pairs,
ID name and price as being defined.
But you can also go ahead and click on schema.
Usually nobody does because it is already mentioned up there, so it's pretty obvious.
But you can see that the ID is of type string, the name is of type string and the price is also type
of string, which should be a number.
Yep.
So let's go ahead and change that as a number.
Okay.
Let's go ahead and hit reload one more time.
And now we can see that Price is zero and I click on schema and notice it's a number.
Now similarly, you can work on the bad request that if the bad request will happen, what kind of error
response you'll be getting?
Either it's going to be response, the data dot message dot something, or it's going to be just a string.
You can define all of these parameters up here and now at this point you understand that how the default
values can be set up as well as different tags are being used.
And how you can define an object up here.
Told you it's really simple.
Let's keep the video short and in the next video we're going to see that how we can handle arrays.
Let's go ahead and move on in the next video.