Skip to content

API V3 Subproject Creation Bug fix #6275

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 6 commits into from
Oct 14, 2019
Merged

Conversation

saadmk11
Copy link
Member

fixes: #6271

@saadmk11 saadmk11 requested review from humitos and a team October 10, 2019 19:10
Copy link
Member

@stsewd stsewd left a comment

Choose a reason for hiding this comment

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

Changes look good. I'm leaving some suggestions to have more explicit tests. Also, I'm pushing some tests for the UI form, I was in the process of fixing this when I saw this PR p:

Copy link
Member

@stsewd stsewd left a comment

Choose a reason for hiding this comment

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

Oh, and looks like all validation errors from the subproject serializer are missing i18n, can you add it?

@saadmk11
Copy link
Member Author

saadmk11 commented Oct 10, 2019

Changes look good. I'm leaving some suggestions to have more explicit tests. Also, I'm pushing some tests for the UI form, I was in the process of fixing this when I saw this PR p:

Sure thanks :)

Oh, and looks like all validation errors from the subproject serializer are missing i18n, can you add it?

Okay :)

@saadmk11 saadmk11 requested a review from stsewd October 10, 2019 19:47
@humitos humitos self-assigned this Oct 11, 2019
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.

I was almost sure that I was going to make a mistake with this logic. I'm happy that you solved the issue. Thanks!

When working on this, I asked myself if it wouldn't be better to move the logic outside the Form and share it with the Serializer. After the bug that I introduced, I'd say it's clear that we have to do that instead of replicating the same logic. I want a function is_valid_as_subproject(project, subproject) raising different customized exceptions that we can handle properly on the Form and Serializer.

@saadmk11
Copy link
Member Author

saadmk11 commented Oct 11, 2019

I was almost sure that I was going to make a mistake with this logic. I'm happy that you solved the issue. Thanks!

When working on this, I asked myself if it wouldn't be better to move the logic outside the Form and share it with the Serializer. After the bug that I introduced, I'd say it's clear that we have to do that instead of replicating the same logic. I want a function is_valid_as_subproject(project, subproject) raising different customized exceptions that we can handle properly on the Form and Serializer.

I think we can have 2 methods that will check is_valid_as_subproject and is_valid_as_superproject or we can have 1 method that checks both like is_valid_project_relation(project, subproject). What do you suggest? :)

Should I update this PR with that or Its alright for now?

But not sure how to raise different customized exceptions that we can handle properly on the Form and Serializer without any hack. like passing the validation error class

@humitos humitos mentioned this pull request Oct 14, 2019
@humitos
Copy link
Member

humitos commented Oct 14, 2019

I think we can have 2 methods that will check is_valid_as_subproject and is_valid_as_superproject or we can have 1 method that checks both like is_valid_project_relation(project, subproject). What do you suggest? :)

Two methods are more explicit to me.

Should I update this PR with that or Its alright for now?

I think this refactor can be done in another PR. Do you want to work on that as well?

@humitos humitos merged commit 0e97aa4 into readthedocs:master Oct 14, 2019
@saadmk11 saadmk11 deleted the subproject-bug branch October 14, 2019 12:14
@saadmk11
Copy link
Member Author

saadmk11 commented Oct 14, 2019

I think this refactor can be done in another PR. Do you want to work on that as well?

@humitos Sure! 👍 I'll send a PR Soon

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.

v3 API doesn't check if a subproject relationship already exists
3 participants