Skip to content

add check for page-size #345

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 10 commits into from
Mar 30, 2025
Merged

add check for page-size #345

merged 10 commits into from
Mar 30, 2025

Conversation

rizul2108
Copy link
Collaborator

@rizul2108 rizul2108 commented Mar 12, 2025

Description:

This PR fixes #341.

Before:

When setting the --page-size flag to values greater than 100 in list commands, the Harbor API returned a 422 error since the maximum allowed page_size is 100.

./ harbor-cli project list --page-size 101
FATA[0000] failed to get projects list: response status code does not match any response statuses defined for this endpoint in the swagger spec (status 422): {}

After:

Added a validation check to limit the --page-size flag to a maximum of 100, preventing the 422 error and ensuring consistent behavior across all list commands.

./harbor-cli project list --page-size 101
Error: page size should be less than or equal to 100

rizul2108 and others added 3 commits March 12, 2025 16:24
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
@rizul2108
Copy link
Collaborator Author

Should I add such check for all list commands ? @bupd

@bupd
Copy link
Collaborator

bupd commented Mar 12, 2025

yes

Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Copy link
Collaborator

@bupd bupd left a comment

Choose a reason for hiding this comment

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

lgtm

@bupd bupd added the enhancement New feature or request label Mar 15, 2025
@bupd
Copy link
Collaborator

bupd commented Mar 22, 2025

merge conflicts

@rizul2108
Copy link
Collaborator Author

conflicts resolved

@rizul2108
Copy link
Collaborator Author

@bupd @Vad1mo it can be merged now

Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
@Vad1mo Vad1mo merged commit 801dd8e into goharbor:main Mar 30, 2025
5 checks passed
rizul2108 added a commit to rizul2108/harbor-cli that referenced this pull request Apr 3, 2025
* add check for page-size

Signed-off-by: Rizul Gupta <[email protected]>

* fix lint error

Signed-off-by: Rizul Gupta <[email protected]>

* add page-size check for all list commands

Signed-off-by: Rizul Gupta <[email protected]>

* small fix

Signed-off-by: Rizul Gupta <[email protected]>

* fix lint error

Signed-off-by: Rizul Gupta <[email protected]>

* fix lint issues

Signed-off-by: Rizul Gupta <[email protected]>

* fix lint issues

Signed-off-by: Rizul Gupta <[email protected]>

---------

Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
rizul2108 added a commit to rizul2108/harbor-cli that referenced this pull request Apr 3, 2025
* add check for page-size

Signed-off-by: Rizul Gupta <[email protected]>

* fix lint error

Signed-off-by: Rizul Gupta <[email protected]>

* add page-size check for all list commands

Signed-off-by: Rizul Gupta <[email protected]>

* small fix

Signed-off-by: Rizul Gupta <[email protected]>

* fix lint error

Signed-off-by: Rizul Gupta <[email protected]>

* fix lint issues

Signed-off-by: Rizul Gupta <[email protected]>

* fix lint issues

Signed-off-by: Rizul Gupta <[email protected]>

---------

Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
@rizul2108 rizul2108 deleted the page-size-error branch April 18, 2025 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when setting page size
3 participants