{"action":"closed","number":100,"pull_request":{"url":"https://api.github.com/repos/bustoutsolutions/siesta/pulls/100","id":81666267,"html_url":"https://github.com/bustoutsolutions/siesta/pull/100","diff_url":"https://github.com/bustoutsolutions/siesta/pull/100.diff","patch_url":"https://github.com/bustoutsolutions/siesta/pull/100.patch","issue_url":"https://api.github.com/repos/bustoutsolutions/siesta/issues/100","number":100,"state":"closed","locked":false,"title":"Content transformer improvements","user":{"login":"pcantrell","id":378162,"avatar_url":"https://avatars.githubusercontent.com/u/378162?v=3","gravatar_id":"","url":"https://api.github.com/users/pcantrell","html_url":"https://github.com/pcantrell","followers_url":"https://api.github.com/users/pcantrell/followers","following_url":"https://api.github.com/users/pcantrell/following{/other_user}","gists_url":"https://api.github.com/users/pcantrell/gists{/gist_id}","starred_url":"https://api.github.com/users/pcantrell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcantrell/subscriptions","organizations_url":"https://api.github.com/users/pcantrell/orgs","repos_url":"https://api.github.com/users/pcantrell/repos","events_url":"https://api.github.com/users/pcantrell/events{/privacy}","received_events_url":"https://api.github.com/users/pcantrell/received_events","type":"User","site_admin":false},"body":"# Background\r\n\r\nSiesta’s content transformers currently provide a `skipWhenEntityMatchesOutputType:` option, which causes the pipeline to skip a transformer if the type coming down the pipeline already matches the output type.\r\n\r\nThis behavior is immensely confusing. For example, when it’s enabled:\r\n\r\n- If you write a `String` → `String` transformer, it will skip any `String` input — and thus will only run if it’s going to fail.\r\n- If you write a transformer whose output type is `Any`, it will _never_ run.\r\n\r\nThe original intent was to support catch-all transformers that take heterogenous upstream content and normalize it to some uniform downstream form. For example, you might want to add a transformer that creates a `FooModel` from JSON and another that creates it from XML. It’s a nice idea. The current solution, however, is a mistake.\r\n\r\n# New Behavior\r\n\r\nThis PR removes the old behavior in favor of a new `onInputTypeMismatch:` option, which is different in two ways:\r\n\r\n- It examines whether the content coming down the pipeline matches the content transformer’s _input_ type, not its _output_ type.\r\n- Instead of a boolean, it provides three possible behaviors: `Error`, `Skip`, and `SkipIfOutputTypeMatches`. That last one is close to the old behavior, but eliminates some of the confusing cases by only coming into play if the input type was wrong. The default is `Error`.\r\n\r\nI think this approach will play out much better. In the `FooModel` example above, you might configure the pipeline like this:\r\n\r\n    service.configureTransformer(onInputTypeMismatch: .Skip) {\r\n      FooModel(xml: $0.content)\r\n    }\r\n\r\n    service.configureTransformer(onInputTypeMismatch: .SkipIfOutputTypeMatches) {\r\n      FooModel(json: $0.content)\r\n    }\r\n\r\nIf the upstream pipeline produces XML, it runs the first transformer and skips the second.\r\n\r\nIf the upstream pipeline produces JSON, it skips the first transformer and runs the second.\r\n\r\nIf the upstream pipeline produces neither, it skips the first transformer and the second produces a “wrong input type” error.","created_at":"2016-08-17T15:39:15Z","updated_at":"2016-08-19T01:25:14Z","closed_at":"2016-08-19T01:25:14Z","merged_at":"2016-08-19T01:25:14Z","merge_commit_sha":"8f05738d0fad41285eebe4d86d5bf8dfd021d86d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bustoutsolutions/siesta/pulls/100/commits","review_comments_url":"https://api.github.com/repos/bustoutsolutions/siesta/pulls/100/comments","review_comment_url":"https://api.github.com/repos/bustoutsolutions/siesta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bustoutsolutions/siesta/issues/100/comments","statuses_url":"https://api.github.com/repos/bustoutsolutions/siesta/statuses/803e62ebd2e7911887a42d386763bdbfc47175fe","head":{"label":"bustoutsolutions:content-transformer-improvements","ref":"content-transformer-improvements","sha":"803e62ebd2e7911887a42d386763bdbfc47175fe","user":{"login":"bustoutsolutions","id":57004,"avatar_url":"https://avatars.githubusercontent.com/u/57004?v=3","gravatar_id":"","url":"https://api.github.com/users/bustoutsolutions","html_url":"https://github.com/bustoutsolutions","followers_url":"https://api.github.com/users/bustoutsolutions/followers","following_url":"https://api.github.com/users/bustoutsolutions/following{/other_user}","gists_url":"https://api.github.com/users/bustoutsolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/bustoutsolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bustoutsolutions/subscriptions","organizations_url":"https://api.github.com/users/bustoutsolutions/orgs","repos_url":"https://api.github.com/users/bustoutsolutions/repos","events_url":"https://api.github.com/users/bustoutsolutions/events{/privacy}","received_events_url":"https://api.github.com/users/bustoutsolutions/received_events","type":"Organization","site_admin":false},"repo":{"id":37756690,"name":"siesta","full_name":"bustoutsolutions/siesta","owner":{"login":"bustoutsolutions","id":57004,"avatar_url":"https://avatars.githubusercontent.com/u/57004?v=3","gravatar_id":"","url":"https://api.github.com/users/bustoutsolutions","html_url":"https://github.com/bustoutsolutions","followers_url":"https://api.github.com/users/bustoutsolutions/followers","following_url":"https://api.github.com/users/bustoutsolutions/following{/other_user}","gists_url":"https://api.github.com/users/bustoutsolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/bustoutsolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bustoutsolutions/subscriptions","organizations_url":"https://api.github.com/users/bustoutsolutions/orgs","repos_url":"https://api.github.com/users/bustoutsolutions/repos","events_url":"https://api.github.com/users/bustoutsolutions/events{/privacy}","received_events_url":"https://api.github.com/users/bustoutsolutions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bustoutsolutions/siesta","description":"The elegant way to use REST APIs on iOS / macOS","fork":false,"url":"https://api.github.com/repos/bustoutsolutions/siesta","forks_url":"https://api.github.com/repos/bustoutsolutions/siesta/forks","keys_url":"https://api.github.com/repos/bustoutsolutions/siesta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bustoutsolutions/siesta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bustoutsolutions/siesta/teams","hooks_url":"https://api.github.com/repos/bustoutsolutions/siesta/hooks","issue_events_url":"https://api.github.com/repos/bustoutsolutions/siesta/issues/events{/number}","events_url":"https://api.github.com/repos/bustoutsolutions/siesta/events","assignees_url":"https://api.github.com/repos/bustoutsolutions/siesta/assignees{/user}","branches_url":"https://api.github.com/repos/bustoutsolutions/siesta/branches{/branch}","tags_url":"https://api.github.com/repos/bustoutsolutions/siesta/tags","blobs_url":"https://api.github.com/repos/bustoutsolutions/siesta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bustoutsolutions/siesta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bustoutsolutions/siesta/git/refs{/sha}","trees_url":"https://api.github.com/repos/bustoutsolutions/siesta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bustoutsolutions/siesta/statuses/{sha}","languages_url":"https://api.github.com/repos/bustoutsolutions/siesta/languages","stargazers_url":"https://api.github.com/repos/bustoutsolutions/siesta/stargazers","contributors_url":"https://api.github.com/repos/bustoutsolutions/siesta/contributors","subscribers_url":"https://api.github.com/repos/bustoutsolutions/siesta/subscribers","subscription_url":"https://api.github.com/repos/bustoutsolutions/siesta/subscription","commits_url":"https://api.github.com/repos/bustoutsolutions/siesta/commits{/sha}","git_commits_url":"https://api.github.com/repos/bustoutsolutions/siesta/git/commits{/sha}","comments_url":"https://api.github.com/repos/bustoutsolutions/siesta/comments{/number}","issue_comment_url":"https://api.github.com/repos/bustoutsolutions/siesta/issues/comments{/number}","contents_url":"https://api.github.com/repos/bustoutsolutions/siesta/contents/{+path}","compare_url":"https://api.github.com/repos/bustoutsolutions/siesta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bustoutsolutions/siesta/merges","archive_url":"https://api.github.com/repos/bustoutsolutions/siesta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bustoutsolutions/siesta/downloads","issues_url":"https://api.github.com/repos/bustoutsolutions/siesta/issues{/number}","pulls_url":"https://api.github.com/repos/bustoutsolutions/siesta/pulls{/number}","milestones_url":"https://api.github.com/repos/bustoutsolutions/siesta/milestones{/number}","notifications_url":"https://api.github.com/repos/bustoutsolutions/siesta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bustoutsolutions/siesta/labels{/name}","releases_url":"https://api.github.com/repos/bustoutsolutions/siesta/releases{/id}","deployments_url":"https://api.github.com/repos/bustoutsolutions/siesta/deployments","created_at":"2015-06-20T03:43:11Z","updated_at":"2016-08-18T15:10:16Z","pushed_at":"2016-08-19T01:25:14Z","git_url":"git://github.com/bustoutsolutions/siesta.git","ssh_url":"git@github.com:bustoutsolutions/siesta.git","clone_url":"https://github.com/bustoutsolutions/siesta.git","svn_url":"https://github.com/bustoutsolutions/siesta","homepage":"http://siestaframework.com","size":10674,"stargazers_count":737,"watchers_count":737,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":38,"mirror_url":null,"open_issues_count":10,"forks":38,"open_issues":10,"watchers":737,"default_branch":"master"}},"base":{"label":"bustoutsolutions:master","ref":"master","sha":"d34c5e76367fbf1f65e4f90a7b8894d56e7c8d29","user":{"login":"bustoutsolutions","id":57004,"avatar_url":"https://avatars.githubusercontent.com/u/57004?v=3","gravatar_id":"","url":"https://api.github.com/users/bustoutsolutions","html_url":"https://github.com/bustoutsolutions","followers_url":"https://api.github.com/users/bustoutsolutions/followers","following_url":"https://api.github.com/users/bustoutsolutions/following{/other_user}","gists_url":"https://api.github.com/users/bustoutsolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/bustoutsolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bustoutsolutions/subscriptions","organizations_url":"https://api.github.com/users/bustoutsolutions/orgs","repos_url":"https://api.github.com/users/bustoutsolutions/repos","events_url":"https://api.github.com/users/bustoutsolutions/events{/privacy}","received_events_url":"https://api.github.com/users/bustoutsolutions/received_events","type":"Organization","site_admin":false},"repo":{"id":37756690,"name":"siesta","full_name":"bustoutsolutions/siesta","owner":{"login":"bustoutsolutions","id":57004,"avatar_url":"https://avatars.githubusercontent.com/u/57004?v=3","gravatar_id":"","url":"https://api.github.com/users/bustoutsolutions","html_url":"https://github.com/bustoutsolutions","followers_url":"https://api.github.com/users/bustoutsolutions/followers","following_url":"https://api.github.com/users/bustoutsolutions/following{/other_user}","gists_url":"https://api.github.com/users/bustoutsolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/bustoutsolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bustoutsolutions/subscriptions","organizations_url":"https://api.github.com/users/bustoutsolutions/orgs","repos_url":"https://api.github.com/users/bustoutsolutions/repos","events_url":"https://api.github.com/users/bustoutsolutions/events{/privacy}","received_events_url":"https://api.github.com/users/bustoutsolutions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bustoutsolutions/siesta","description":"The elegant way to use REST APIs on iOS / macOS","fork":false,"url":"https://api.github.com/repos/bustoutsolutions/siesta","forks_url":"https://api.github.com/repos/bustoutsolutions/siesta/forks","keys_url":"https://api.github.com/repos/bustoutsolutions/siesta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bustoutsolutions/siesta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bustoutsolutions/siesta/teams","hooks_url":"https://api.github.com/repos/bustoutsolutions/siesta/hooks","issue_events_url":"https://api.github.com/repos/bustoutsolutions/siesta/issues/events{/number}","events_url":"https://api.github.com/repos/bustoutsolutions/siesta/events","assignees_url":"https://api.github.com/repos/bustoutsolutions/siesta/assignees{/user}","branches_url":"https://api.github.com/repos/bustoutsolutions/siesta/branches{/branch}","tags_url":"https://api.github.com/repos/bustoutsolutions/siesta/tags","blobs_url":"https://api.github.com/repos/bustoutsolutions/siesta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bustoutsolutions/siesta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bustoutsolutions/siesta/git/refs{/sha}","trees_url":"https://api.github.com/repos/bustoutsolutions/siesta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bustoutsolutions/siesta/statuses/{sha}","languages_url":"https://api.github.com/repos/bustoutsolutions/siesta/languages","stargazers_url":"https://api.github.com/repos/bustoutsolutions/siesta/stargazers","contributors_url":"https://api.github.com/repos/bustoutsolutions/siesta/contributors","subscribers_url":"https://api.github.com/repos/bustoutsolutions/siesta/subscribers","subscription_url":"https://api.github.com/repos/bustoutsolutions/siesta/subscription","commits_url":"https://api.github.com/repos/bustoutsolutions/siesta/commits{/sha}","git_commits_url":"https://api.github.com/repos/bustoutsolutions/siesta/git/commits{/sha}","comments_url":"https://api.github.com/repos/bustoutsolutions/siesta/comments{/number}","issue_comment_url":"https://api.github.com/repos/bustoutsolutions/siesta/issues/comments{/number}","contents_url":"https://api.github.com/repos/bustoutsolutions/siesta/contents/{+path}","compare_url":"https://api.github.com/repos/bustoutsolutions/siesta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bustoutsolutions/siesta/merges","archive_url":"https://api.github.com/repos/bustoutsolutions/siesta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bustoutsolutions/siesta/downloads","issues_url":"https://api.github.com/repos/bustoutsolutions/siesta/issues{/number}","pulls_url":"https://api.github.com/repos/bustoutsolutions/siesta/pulls{/number}","milestones_url":"https://api.github.com/repos/bustoutsolutions/siesta/milestones{/number}","notifications_url":"https://api.github.com/repos/bustoutsolutions/siesta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bustoutsolutions/siesta/labels{/name}","releases_url":"https://api.github.com/repos/bustoutsolutions/siesta/releases{/id}","deployments_url":"https://api.github.com/repos/bustoutsolutions/siesta/deployments","created_at":"2015-06-20T03:43:11Z","updated_at":"2016-08-18T15:10:16Z","pushed_at":"2016-08-19T01:25:14Z","git_url":"git://github.com/bustoutsolutions/siesta.git","ssh_url":"git@github.com:bustoutsolutions/siesta.git","clone_url":"https://github.com/bustoutsolutions/siesta.git","svn_url":"https://github.com/bustoutsolutions/siesta","homepage":"http://siestaframework.com","size":10674,"stargazers_count":737,"watchers_count":737,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":38,"mirror_url":null,"open_issues_count":10,"forks":38,"open_issues":10,"watchers":737,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bustoutsolutions/siesta/pulls/100"},"html":{"href":"https://github.com/bustoutsolutions/siesta/pull/100"},"issue":{"href":"https://api.github.com/repos/bustoutsolutions/siesta/issues/100"},"comments":{"href":"https://api.github.com/repos/bustoutsolutions/siesta/issues/100/comments"},"review_comments":{"href":"https://api.github.com/repos/bustoutsolutions/siesta/pulls/100/comments"},"review_comment":{"href":"https://api.github.com/repos/bustoutsolutions/siesta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bustoutsolutions/siesta/pulls/100/commits"},"statuses":{"href":"https://api.github.com/repos/bustoutsolutions/siesta/statuses/803e62ebd2e7911887a42d386763bdbfc47175fe"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"pcantrell","id":378162,"avatar_url":"https://avatars.githubusercontent.com/u/378162?v=3","gravatar_id":"","url":"https://api.github.com/users/pcantrell","html_url":"https://github.com/pcantrell","followers_url":"https://api.github.com/users/pcantrell/followers","following_url":"https://api.github.com/users/pcantrell/following{/other_user}","gists_url":"https://api.github.com/users/pcantrell/gists{/gist_id}","starred_url":"https://api.github.com/users/pcantrell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcantrell/subscriptions","organizations_url":"https://api.github.com/users/pcantrell/orgs","repos_url":"https://api.github.com/users/pcantrell/repos","events_url":"https://api.github.com/users/pcantrell/events{/privacy}","received_events_url":"https://api.github.com/users/pcantrell/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":2,"additions":118,"deletions":33,"changed_files":4}}
{"actor":{"display_login":"pcantrell"}}