Skip to content

Adding input validations for subcommands of rhoas service-registry list#1163

Merged
rkpattnaik780 merged 3 commits intoredhat-developer:mainfrom
amoghrajesh:amogh-patch
Oct 1, 2021
Merged

Adding input validations for subcommands of rhoas service-registry list#1163
rkpattnaik780 merged 3 commits intoredhat-developer:mainfrom
amoghrajesh:amogh-patch

Conversation

@amoghrajesh
Copy link
Contributor

@amoghrajesh amoghrajesh commented Oct 1, 2021

Description:

This PR adds support for sanity validation of the input received for the service-registry commands, specifically --limit and --page. These two are checked to have a value of >0 so that the request doesn't need to go through and an early failure can be reported.

Closes #1111

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change
  • Other (please specify)

Checklist

  • Documentation added for the feature
  • CI and all relevant tests are passing
  • Code Review completed
  • Verified independently by reviewer

Copy link
Contributor

@rkpattnaik780 rkpattnaik780 left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this PR @amoghrajesh !
While a common method to handle flag inputs is a good approach in the long run, this should have validations like kafka topic list for now.

@amoghrajesh
Copy link
Contributor Author

@rkpattnaik780 I have addressed the review comments, could you have a look again?

return flag.InvalidValueError("output", opts.outputFormat, flagutil.ValidOutputFormats...)
}
if opts.page < 1 {
return opts.localizer.MustLocalizeError("registry.list.flag.page",
Copy link
Contributor

Choose a reason for hiding this comment

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

Use of if looks great, however the error message returned should be changed. Current message doesn't tell about the error, rather simply displays the flag description.

Screenshot from 2021-10-01 16-29-00

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rkpattnaik780 I don't understand how the rendering is happening for opts.localizer.MustLocalizeError. I want to know how its parameters work. Could you guide me in the same?

Copy link
Collaborator

@wtrocki wtrocki Oct 1, 2021

Choose a reason for hiding this comment

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

@amoghrajesh We will take care of that. @rkpattnaik780 will take your PR and do all required changes and ping you with info how we fixed them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wtrocki got it. Could you merge this or label it so it can be counted as a Hactoberfest PR for me?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes. It will be merged today! I promise. Thank you so much for your contribution!

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @amoghrajesh you can refer to this commit to understand more about how this project implements localization. Basically we keep all the localized strings here.
Hope this helps :)
Thanks!

Copy link
Collaborator

@wtrocki wtrocki left a comment

Choose a reason for hiding this comment

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

Amazing contribution. Thank you so much!
I think we can take it over from there and get this merged

Copy link
Contributor

@rkpattnaik780 rkpattnaik780 left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this PR @amoghrajesh . Great job. 💯

@rkpattnaik780 rkpattnaik780 merged commit 5b867a5 into redhat-developer:main Oct 1, 2021
@wtrocki
Copy link
Collaborator

wtrocki commented Oct 1, 2021

@amoghrajesh If you check 3d2ca33 it has good example how to create keys.

Our team needs to document that better in contributing guide. Sounds like another issue we can create @rkpattnaik780 ?

@rkpattnaik780
Copy link
Contributor

@amoghrajesh If you check 3d2ca33 it has good example how to create keys.

Our team needs to document that better in contributing guide. Sounds like another issue we can create @rkpattnaik780 ?

Thanks for pointing it out @wtrocki . That will indeed be a great addition.

@amoghrajesh amoghrajesh deleted the amogh-patch branch October 1, 2021 14:16
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.

Client side validation for rhoas service-registry list

3 participants