Mentorship-backend: Bug:Use HTTPStatus code values instead of enum representation, in mentorship_relation API in Swagger UI

Created on 23 Dec 2020  路  14Comments  路  Source: anitab-org/mentorship-backend

Describe the bug

The values shown on Swagger UI of mentorship_relation API should be in number format instead of Enum Representations of Status Codes. For example 200 instead of HTTPStatus.OK.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://mentorship-backend-temp.herokuapp.com/
  2. Scroll down to mentorship_relation
  3. See enum representation.

  4. image

Expected behavior
Use of Values of Status Codes instead of Enum Representations in Swagger UI

Desktop (please complete the following information):

  • OS: Ubuntu 20+
  • Browser FireFox Web Browser
  • Version --
Coding Bug

All 14 comments

@isabelcosta can you have a look at the issue and assign this to me?
Thanks.

Sounds good, I will assign it to you @Aaishpra

Sounds good, I will assign it to you @Aaishpra

Thanks, will start working on this as soon as i setup the project 馃槃

To enhance your issue, I added a screenshot of how it shows up now with enum representation

To enhance your issue, I added a screenshot of how it shows up now with enum representation

Thanks a lot 馃槉

@isabelcosta @devkapilbansal @vj-codes I have some doubts, regarding how to proceed further in this issue. Since the swagger.json file was deleted by #804, I managed to find two links to find the swagger.json this and after setting up the project locally this after that I tried to save the swagger.json file (found from the link after local setup) under the docs section and editing it but nothing happens.
For example
If I edit something in mentorship_relation.py
image
I see a change on my local server
image
But nothing happens if I change anything in swagger.json

This is my first time working with Swagger, so I might be completely wrong with my approaches. Can you people help me with this?

@Aaishpra you should look into mentorship.py file
There you can see that it is returning HTTPStatus.Ok but it should return something like HTTPStatus.OK.value. To get better idea look into the existing PRs on hard coded status codes
Some of them are #924 #860

@Aaishpra you should look into mentorship.py file
There you can see that it is returning HTTPStatus.Ok but it should return something like HTTPStatus.OK.value. To get better idea look into the existing PRs on hard coded status codes
Some of them are #924 #860

Ohh now i get it, so we have to make changes in mentorship_relation.py file only.
Not in the swagger.json

Yes, you need to make changes in UI only
Cc:- @isabelcosta

@devkapilbansal @isabelcosta i changed all the HTTPStatus.x to HTTPStatus.x.value in mentorship_relation.py and I think this has worked correctly
image
Shall I submit PR if this looks right to you people?

@Aaishpra please open issues for other files too

@devkapilbansal @isabelcosta i changed all the HTTPStatus.x to HTTPStatus.x.value in mentorship_relation.py and I think this has worked correctly
image
Shall I submit PR if this looks right to you people?

@Aaishpra it looks nice :)
if you could do what @devkapilbansal said as well, that would be great 馃檶

Sure, I will open the issues for user and admin api @devkapilbansal @isabelcosta

@devkapilbansal @isabelcosta i changed all the HTTPStatus.x to HTTPStatus.x.value in mentorship_relation.py and I think this has worked correctly
image
Shall I submit PR if this looks right to you people?

@Aaishpra it looks nice :)
if you could do what @devkapilbansal said as well, that would be great raised_hands

Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

isabelcosta picture isabelcosta  路  47Comments

bartekpacia picture bartekpacia  路  23Comments

paritoshsinghrahar picture paritoshsinghrahar  路  25Comments

epicadk picture epicadk  路  19Comments

paritoshsinghrahar picture paritoshsinghrahar  路  24Comments