docs(id-support): Document that -p and -o arguments accept slugs and IDs#2101
Merged
iamrajjoshi merged 5 commits intomasterfrom Jul 17, 2024
Merged
docs(id-support): Document that -p and -o arguments accept slugs and IDs#2101iamrajjoshi merged 5 commits intomasterfrom
iamrajjoshi merged 5 commits intomasterfrom
Conversation
Member
szokeasaurusrex
left a comment
There was a problem hiding this comment.
Looks good, thanks for making these changes!
Before merging, please update "id" so that it is consistently capitalized, like "ID". Then, I will approve this PR!
src/api/errors/api_error.rs
Outdated
| #[error("resource not found")] | ||
| ResourceNotFound, | ||
| #[error("Project not found. Please check that you entered the project and organization slugs correctly.")] | ||
| #[error("Project not found. Please check that you entered the project and organization ids or slugs correctly.")] |
Member
There was a problem hiding this comment.
Suggested change
| #[error("Project not found. Please check that you entered the project and organization ids or slugs correctly.")] | |
| #[error("Project not found. Please check that you entered the project and organization IDs or slugs correctly.")] |
src/config.rs
Outdated
| .map(str::to_owned) | ||
| .ok_or_else(|| { | ||
| format_err!("An organization slug is required (provide with --org)") | ||
| format_err!("An organization id or slug is required (provide with --org)") |
Member
There was a problem hiding this comment.
Suggested change
| format_err!("An organization id or slug is required (provide with --org)") | |
| format_err!("An organization ID or slug is required (provide with --org)") |
Please update anywhere else you have used lowercase id.
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
szokeasaurusrex
approved these changes
Jul 17, 2024
Member
szokeasaurusrex
left a comment
There was a problem hiding this comment.
One more suggestion, otherwise this looks good. Much simpler than your previous PR – thanks for getting the rest of the endpoints updated!
src/utils/args.rs
Outdated
| fn validate_org(v: &str) -> Result<String, String> { | ||
| if v.contains('/') || v == "." || v == ".." || v.contains(' ') { | ||
| Err("Invalid value for organization. Use the URL slug and not the name!".to_string()) | ||
| Err("Invalid value for organization. Use the URL slug or the ID and not the name!".to_string()) |
Member
There was a problem hiding this comment.
Suggested change
| Err("Invalid value for organization. Use the URL slug or the ID and not the name!".to_string()) | |
| Err("Invalid value for organization. Use the URL slug or the ID, not the name!".to_string()) |
Think this would read more clearly
| || v.contains('\r') | ||
| { | ||
| Err("Invalid value for project. Use the URL slug and not the name!".to_string()) | ||
| Err("Invalid value for project. Use the URL slug or the ID and not the name!".to_string()) |
Member
There was a problem hiding this comment.
Suggested change
| Err("Invalid value for project. Use the URL slug or the ID and not the name!".to_string()) | |
| Err("Invalid value for project. Use the URL slug or the ID, not the name!".to_string()) |
This was referenced Sep 10, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the API changes we made to support ids as well as slugs, we get the added bonus that our CLI can also support ids.
Turns out the CLI also uses a couple endpoints which passed project slug in the body parameter, so we also had to update them:
getsentry/sentry#74232
getsentry/sentry#74371
With these prs, all the endpoints the CLI uses have ID support.
@szokeasaurusrex and I had a conversation about how we would like to roll this change out in an earlier closed pr, and decided that once we support ids in all the CLI commands, we can change all the help strings at once, which is what i am doing here.