{"action":"created","issue":{"url":"https://api.github.com/repos/RailsEventStore/rails_event_store/issues/267","repository_url":"https://api.github.com/repos/RailsEventStore/rails_event_store","labels_url":"https://api.github.com/repos/RailsEventStore/rails_event_store/issues/267/labels{/name}","comments_url":"https://api.github.com/repos/RailsEventStore/rails_event_store/issues/267/comments","events_url":"https://api.github.com/repos/RailsEventStore/rails_event_store/issues/267/events","html_url":"https://github.com/RailsEventStore/rails_event_store/issues/267","id":310595862,"number":267,"title":"Inconsistency of Client API regarding allowed stream_name","user":{"login":"pawelpacana","id":116740,"avatar_url":"https://avatars1.githubusercontent.com/u/116740?v=4","gravatar_id":"","url":"https://api.github.com/users/pawelpacana","html_url":"https://github.com/pawelpacana","followers_url":"https://api.github.com/users/pawelpacana/followers","following_url":"https://api.github.com/users/pawelpacana/following{/other_user}","gists_url":"https://api.github.com/users/pawelpacana/gists{/gist_id}","starred_url":"https://api.github.com/users/pawelpacana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pawelpacana/subscriptions","organizations_url":"https://api.github.com/users/pawelpacana/orgs","repos_url":"https://api.github.com/users/pawelpacana/repos","events_url":"https://api.github.com/users/pawelpacana/events{/privacy}","received_events_url":"https://api.github.com/users/pawelpacana/received_events","type":"User","site_admin":false},"labels":[{"id":194355240,"url":"https://api.github.com/repos/RailsEventStore/rails_event_store/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-02T20:14:20Z","updated_at":"2018-04-03T11:14:10Z","closed_at":null,"author_association":"OWNER","body":"Some of the `Client` methods check whether `stream_name` makes sense (is not nil or empty). These are readers:\r\n\r\n```ruby\r\n    specify 'raise exception if stream name is incorrect' do\r\n      client = RubyEventStore::Client.new(repository: InMemoryRepository.new)\r\n      expect { client.read_events_forward(nil) }.to raise_error(IncorrectStreamData)\r\n      expect { client.read_events_forward('') }.to raise_error(IncorrectStreamData)\r\n      expect { client.read_events_backward(nil) }.to raise_error(IncorrectStreamData)\r\n      expect { client.read_events_backward('') }.to raise_error(IncorrectStreamData)\r\n    end\r\n```\r\n\r\nand some are writers:\r\n\r\n```ruby\r\n    specify 'raise exception if stream name is incorrect' do\r\n      client = RubyEventStore::Client.new(repository: InMemoryRepository.new)\r\n      expect { client.delete_stream(nil) }.to raise_error(IncorrectStreamData)\r\n      expect { client.delete_stream('') }.to raise_error(IncorrectStreamData)\r\n    end\r\n```\r\n\r\n~~We kind-of-check it to some degree on `link_to_stream` by making `stream_name` required keyword argument.~~\r\n\r\nWe do not check this on `publish_event` and `append_to_stream`, allowing `nil` to propagate to repository (which should fail at least on database schema in case of AR adapter).\r\n\r\nGiven that `Client` facade is a boundary, it would make sense to me to be consistent and add those checks to other writer methods."},"comment":{"url":"https://api.github.com/repos/RailsEventStore/rails_event_store/issues/comments/378214267","html_url":"https://github.com/RailsEventStore/rails_event_store/issues/267#issuecomment-378214267","issue_url":"https://api.github.com/repos/RailsEventStore/rails_event_store/issues/267","id":378214267,"user":{"login":"pawelpacana","id":116740,"avatar_url":"https://avatars1.githubusercontent.com/u/116740?v=4","gravatar_id":"","url":"https://api.github.com/users/pawelpacana","html_url":"https://github.com/pawelpacana","followers_url":"https://api.github.com/users/pawelpacana/followers","following_url":"https://api.github.com/users/pawelpacana/following{/other_user}","gists_url":"https://api.github.com/users/pawelpacana/gists{/gist_id}","starred_url":"https://api.github.com/users/pawelpacana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pawelpacana/subscriptions","organizations_url":"https://api.github.com/users/pawelpacana/orgs","repos_url":"https://api.github.com/users/pawelpacana/repos","events_url":"https://api.github.com/users/pawelpacana/events{/privacy}","received_events_url":"https://api.github.com/users/pawelpacana/received_events","type":"User","site_admin":false},"created_at":"2018-04-03T11:14:10Z","updated_at":"2018-04-03T11:14:10Z","author_association":"OWNER","body":"I'm pro making `Client` more consistent and adding those defensive checks. This does not invalidate changing them in the future -- if we refactor towards more objects (and move validation responsibility there)."}}
{"actor":{"display_login":"pawelpacana"}}