Skip to content

API v3: added support for tags in API #9513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Nov 1, 2022

Conversation

SyedMa3
Copy link
Contributor

@SyedMa3 SyedMa3 commented Aug 17, 2022

Details

Closes issue #7354

Changes

Added support for tags to use in API.
Added 'default_version', 'default_branch' fields in ProjectCreateSerializerBase for user's convenience.


📚 Documentation previews 📚

@SyedMa3 SyedMa3 requested a review from a team as a code owner August 17, 2022 18:06
@SyedMa3 SyedMa3 requested a review from humitos August 17, 2022 18:06
@SyedMa3
Copy link
Contributor Author

SyedMa3 commented Aug 18, 2022

@humitos
The test FAILED readthedocs/api/v3/tests/test_projects.py::ProjectsEndpointTests::test_import_project_with_extra_fields is not compatible with adding default_version field in project creation API. Can you please look into this?

And, can you also please explain the failed checks.
Thanks.

@SyedMa3
Copy link
Contributor Author

SyedMa3 commented Aug 25, 2022

@humitos @stsewd Gentle reminder ping!

Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think this PR is good. Before merging it, I think there are some things that would be good to include on it:

  • Update the API documentation including the tags fields where required
  • Add or update test cases to match these changes
  • Return the tags for the project on get/listing endpoints in case they are not already returning them (probably need to use the TaggitSerializerField there as well)
  • Remove new fields added that are not related to tags (eg. default_*)
  • Run the pre-commit linter on this PR to blackify the code

Again, thanks for your contribution and hoping to move this PR forward 💪🏼

@SyedMa3
Copy link
Contributor Author

SyedMa3 commented Aug 30, 2022

@humitos
Can you please help me in the documentation part? I am not able to set it up.

When I do

 $ cd docs
 $ make livehtml

it gives an error:

sphinx-autobuild --port 4444 -b html -d _build/user/doctrees   . _build/user/html
make: sphinx-autobuild: No such file or directory
make: *** [Makefile:67: livehtml] Error 127

What am I doing wrong here?
I have followed the steps from here (https://dev.readthedocs.io/en/latest/docs.html).

@humitos
Copy link
Member

humitos commented Aug 30, 2022

@SyedMa3 It seems that you don't have the virtualenv enabled and that's why it does not find the sphinx-autobuild command.

@SyedMa3 SyedMa3 requested a review from a team as a code owner September 1, 2022 05:20
@SyedMa3 SyedMa3 requested a review from ericholscher September 1, 2022 05:20
@humitos
Copy link
Member

humitos commented Sep 1, 2022

The PR looks good! The only thing that seems missing to me is to update/add a test case for the feature you are adding here. Would you like to take a look at that?

@SyedMa3
Copy link
Contributor Author

SyedMa3 commented Sep 1, 2022

The PR looks good! The only thing that seems missing to me is to update/add a test case for the feature you are adding here. Would you like to take a look at that?

My bad! I am new to "testing". But i'll look into it and do it.

@SyedMa3
Copy link
Contributor Author

SyedMa3 commented Sep 4, 2022

@humitos
I am encountering a problem in asserting the tags. The solution I implemented is, converting the project.tags.names() into a list. But the order of elements is not always same, since project.tags.names() is a QuerySet. So the fix for that is sorting. But is this fix optimal?

@humitos
Copy link
Member

humitos commented Sep 5, 2022

@SyedMa3 can you use there the same queryset returned by the serializer? I'd assume they are using order_by= so it's always the same response.

I took a look at the code and it seems it supports an order_by attribute when defining the field: https://github.com/jazzband/django-taggit/blob/master/taggit/serializers.py#L48. We could use that everywhere and keep consistency all over across our code and responses as well.

@benjaoming
Copy link
Contributor

ping @SyedMa3 - are you still available for this PR? It seems a lot of good work has gone in to it and it's really close!

@SyedMa3
Copy link
Contributor Author

SyedMa3 commented Oct 20, 2022

ping @SyedMa3 - are you still available for this PR? It seems a lot of good work has gone in to it and it's really close!

Hi @benjaoming , sorry I had uni exams, so I was focusing on that and forgot about this. I will restart working on this. Thanks for the reminder!

@benjaoming
Copy link
Contributor

@SyedMa3 hope they went well! welcome back :)

@SyedMa3
Copy link
Contributor Author

SyedMa3 commented Oct 24, 2022

@humitos @benjaoming I have made changes, and the tests have passed. Can you look into it and ping me if there should be any changes.

@SyedMa3 SyedMa3 requested review from humitos and removed request for ericholscher October 24, 2022 13:19
Copy link
Contributor

@benjaoming benjaoming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that test cases were added and everything is looking great 👍

I have just a question about the example in the documentation. Maybe it would be nice to clarify somewhere what it means to add the tags field, and if omitting it will delete all tags or just not update them?

@SyedMa3 SyedMa3 requested review from benjaoming and removed request for humitos October 25, 2022 04:10
@benjaoming benjaoming requested a review from humitos October 25, 2022 15:20
@SyedMa3 SyedMa3 requested review from humitos and removed request for benjaoming October 30, 2022 09:58
Copy link
Contributor

@benjaoming benjaoming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the reviews. This looks good 👍

@benjaoming benjaoming merged commit 384d379 into readthedocs:main Nov 1, 2022
@SyedMa3
Copy link
Contributor Author

SyedMa3 commented Nov 1, 2022

@humitos @benjaoming Thank you for your guidance. I am just getting started in open source contribution and this helped me a lot.

@benjaoming
Copy link
Contributor

@SyedMa3 what a great start!! Really appreciate that you took the time to get around all the angles with respect to testing and documentation updates 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants