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

Added stricter resource collection arg validation. #1164

Merged
merged 1 commit into from
Apr 28, 2016

Conversation

trevorrowe
Copy link
Member

Resource has many operation accept a hash argument only. Updated collection methods to now raise on argument errors.

bucket = Aws::S3::Bucket.new('bucket-name')

bucket.objects('key')
#=> now raises ArgumentError, expecting Hash, got String

bucket.objects(1,2,3)
#=> now raises ArgumentError, expecting 0..1 args, got 2

Resource has many operation accept a hash argument only.
The following are invalid:

  bucket = Aws::S3::Bucket.new('bucket-name')

  bucket.objects('key')
  #=> now raises ArgumentError, expecting Hash, got String

  bucket.objects(1,2,3)
  #=> now raises ArgumentError, expecting 0..1 args, got 2
@awood45
Copy link
Member

awood45 commented Apr 19, 2016

Sanity Check: Is there any collection, anywhere, that behaves differently? Are we going to be able to ensure that all collections going forward behave in this manner?

@awood45
Copy link
Member

awood45 commented Apr 19, 2016

Change itself looks fine w/r/t stated intent.

@trevorrowe
Copy link
Member Author

All resource collection / has many associations are wrappers around paginated API calls. The only accepted arguments are :limit and pass-through arguments to the client operation. This is strictly always a hash. This is per the resources spec.

@trevorrowe trevorrowe merged commit 3ba4fd3 into master Apr 28, 2016
awood45 added a commit that referenced this pull request Apr 28, 2016
@cjyclaire cjyclaire deleted the resource-collection-arg-validation branch May 5, 2017 20:28
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.

2 participants