Skip to content
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

Make trigger_id and action_name optional for actions index endpoint #478

Merged
merged 7 commits into from
Sep 12, 2023

Conversation

rapito
Copy link
Contributor

@rapito rapito commented May 23, 2023

Use proper path for create_action endpoint

Changes

Please describe both what is changing and why this is important. Include:

  • Made all params optional for actions index endpoint
  • Updated URL for create_actions endpoint

References

@rapito rapito requested a review from a team as a code owner May 23, 2023 18:28
Copy link
Contributor

@stevehobbsdev stevehobbsdev left a comment

Choose a reason for hiding this comment

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

Thanks for your patience here! Looks like the original implementation of this endpoint in our library has a few issues, so thanks for taking the time to clean it up. Left a few comments. In general we should be able to implement this in a non-breaking way with a couple of changes (we'd like to avoid releasing a new major version if possible).

Let me know if you have the time to fix it up or I can continue with it.

raise Auth0::MissingTriggerId, 'Must supply a valid trigger_id' if trigger_id.to_s.empty?
raise Auth0::MissingActionName, 'Must supply a valid action_name' if action_name.to_s.empty?

def actions(trigger_id: nil, action_name: nil, deployed: nil, per_page: nil, page: nil, installed: nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that this is the ideal API for this method but I would prefer we implement it in a non-breaking way. How about we do optional position parameters instead of named ones for the first two? That way existing calls will continue to work while there is also the ability to optionally leave them out.

def actions(trigger_id = nil, action_name = nil, deployed: nil, per_page: nil, page: nil, installed: nil)

Comment on lines 21 to 22
trigger_id: trigger_id,
action_name: action_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately the original implementation looks broken here, as these should be (according to the API):

triggerId: trigger_id,
actionName: action_name,

I'm curious though, did you test this against the API? As I can't get your implementation to work, I get the "Query validation error: 'Additional properties not allowed: trigger_id'." error with the PR as it is now.

Copy link
Contributor Author

@rapito rapito Jun 21, 2023

Choose a reason for hiding this comment

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

Hmmm, I just tested it and as long as trigger_id and action_name are not passed as parameters, it works.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I can see the same. If they are passed, however, we get an error.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've provided a fix in cb1ade0 that makes these arguments optional positional for backwards compatibility.

@stevehobbsdev stevehobbsdev requested a review from a team September 8, 2023 14:06
@stevehobbsdev
Copy link
Contributor

@auth0/dx-sdks-engineer would appreciate a review from another team member here as I have provided additional code modifications.

Copy link
Contributor

@jimmyjames jimmyjames left a comment

Choose a reason for hiding this comment

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

👍 looks good with the optional args.

@stevehobbsdev stevehobbsdev merged commit 21a0f0c into auth0:master Sep 12, 2023
9 checks passed
@rapito
Copy link
Contributor Author

rapito commented Sep 20, 2023

Sweet thanks!

@stevehobbsdev stevehobbsdev mentioned this pull request Oct 3, 2023
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.

3 participants