{"action":"created","issue":{"url":"https://api.github.com/repos/zipmark/rspec_api_documentation/issues/198","labels_url":"https://api.github.com/repos/zipmark/rspec_api_documentation/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/zipmark/rspec_api_documentation/issues/198/comments","events_url":"https://api.github.com/repos/zipmark/rspec_api_documentation/issues/198/events","html_url":"https://github.com/zipmark/rspec_api_documentation/issues/198","id":57733494,"number":198,"title":"Nested scopes","user":{"login":"AlexParamonov","id":352030,"avatar_url":"https://avatars.githubusercontent.com/u/352030?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexParamonov","html_url":"https://github.com/AlexParamonov","followers_url":"https://api.github.com/users/AlexParamonov/followers","following_url":"https://api.github.com/users/AlexParamonov/following{/other_user}","gists_url":"https://api.github.com/users/AlexParamonov/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexParamonov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexParamonov/subscriptions","organizations_url":"https://api.github.com/users/AlexParamonov/orgs","repos_url":"https://api.github.com/users/AlexParamonov/repos","events_url":"https://api.github.com/users/AlexParamonov/events{/privacy}","received_events_url":"https://api.github.com/users/AlexParamonov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-15T15:17:45Z","updated_at":"2015-08-07T22:50:37Z","closed_at":null,"body":"Hello.\r\n\r\nIt would be great to do \r\n```\r\nparameter :links, \"Linked objects\", scope: :articles\r\nparameter :author, \"Author id\", scope: :links\r\n```\r\n\r\nhttp://jsonapi.org/format/#crud-updating-relationships"},"comment":{"url":"https://api.github.com/repos/zipmark/rspec_api_documentation/issues/comments/128852390","html_url":"https://github.com/zipmark/rspec_api_documentation/issues/198#issuecomment-128852390","issue_url":"https://api.github.com/repos/zipmark/rspec_api_documentation/issues/198","id":128852390,"user":{"login":"kevintraver","id":196406,"avatar_url":"https://avatars.githubusercontent.com/u/196406?v=3","gravatar_id":"","url":"https://api.github.com/users/kevintraver","html_url":"https://github.com/kevintraver","followers_url":"https://api.github.com/users/kevintraver/followers","following_url":"https://api.github.com/users/kevintraver/following{/other_user}","gists_url":"https://api.github.com/users/kevintraver/gists{/gist_id}","starred_url":"https://api.github.com/users/kevintraver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevintraver/subscriptions","organizations_url":"https://api.github.com/users/kevintraver/orgs","repos_url":"https://api.github.com/users/kevintraver/repos","events_url":"https://api.github.com/users/kevintraver/events{/privacy}","received_events_url":"https://api.github.com/users/kevintraver/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T22:50:37Z","updated_at":"2015-08-07T22:50:37Z","body":"Perhaps something like this:\r\n```\r\nparameter :author, \"Author id\", scope: { :articles => :links }\r\n```\r\n\r\nand then do some sort of merge into the existing hash\r\n\r\n```ruby\r\ndef set_param(hash, param)\r\n  key = param[:name]\r\n  return hash if !respond_to?(key) || in_path?(key)\r\n\r\n  scope = param[:scope]\r\n  if scope\r\n    if scope.is_a?(Hash)\r\n      # somehow merge into hash\r\n    else\r\n      hash[scope.to_s] ||= {}\r\n      hash[scope.to_s][key] = send(key)\r\n    end\r\n  else\r\n    hash[key] = send(key)\r\n  end\r\n\r\n  hash\r\nend\r\n```\r\n\r\nhttps://github.com/zipmark/rspec_api_documentation/blob/3c2f23d7442defc326c6b8674ec614e9260bc7d8/lib/rspec_api_documentation/dsl/endpoint.rb#L149-L158"}}