-
Notifications
You must be signed in to change notification settings - Fork 55
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
DXCDT-264: Add api command #531
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great first pass! Much of the design is sensible. Lots of little changes requested but nothing that would require a large refactor.
internal/cli/api.go
Outdated
|
||
func (i *apiCmdInputs) validateAndSetData() error { | ||
if i.RawData != "" && !json.Valid([]byte(i.RawData)) { | ||
return fmt.Errorf("invalid json data given: %+v", i.RawData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to other feedback, this error could be more human friendly. I think we'd have a good idea of when and how this error triggers, so we could provide clearer guidance on how to correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The returned error wraps all inner errors so the final one ends up to be for example:
$auth0 api put z --data {"zz:2}
"
=== tenat-example.auth0.com error
▸ failed to parse command inputs: invalid json data given: {zz:2}
exit status 1
What do you suggest so we make it more human friendly? As in this case it's particularly hard as the json.Valid
just returns true or false and isn't able to tell that the input was missing a "
.
329f26c
to
dd53121
Compare
791c976
to
b1b346e
Compare
🔧 Changes
With this PR we are introducing a brand new command:
auth0 api
. This enables making an authenticated arbitrary HTTP request to the Auth0 Management API.One of the reasons we're introducing this right now is to be able to quickly fill the gaps that the CLI has in terms of managing certain resources.
Screen.Recording.2022-11-28.at.13.51.38.mov
📚 References
🔬 Testing
📝 Checklist