{"action":"created","issue":{"url":"https://api.github.com/repos/rbeauchamp/Swashbuckle.OData/issues/47","labels_url":"https://api.github.com/repos/rbeauchamp/Swashbuckle.OData/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/rbeauchamp/Swashbuckle.OData/issues/47/comments","events_url":"https://api.github.com/repos/rbeauchamp/Swashbuckle.OData/issues/47/events","html_url":"https://github.com/rbeauchamp/Swashbuckle.OData/issues/47","id":125302866,"number":47,"title":"More specific response schema","user":{"login":"joshbooker","id":2698896,"avatar_url":"https://avatars.githubusercontent.com/u/2698896?v=3","gravatar_id":"","url":"https://api.github.com/users/joshbooker","html_url":"https://github.com/joshbooker","followers_url":"https://api.github.com/users/joshbooker/followers","following_url":"https://api.github.com/users/joshbooker/following{/other_user}","gists_url":"https://api.github.com/users/joshbooker/gists{/gist_id}","starred_url":"https://api.github.com/users/joshbooker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshbooker/subscriptions","organizations_url":"https://api.github.com/users/joshbooker/orgs","repos_url":"https://api.github.com/users/joshbooker/repos","events_url":"https://api.github.com/users/joshbooker/events{/privacy}","received_events_url":"https://api.github.com/users/joshbooker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rbeauchamp/Swashbuckle.OData/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-07T01:34:03Z","updated_at":"2016-01-07T13:18:52Z","closed_at":null,"body":"The response schema isn't exactly what's coming back from OData.  For example, when you request Orders_Get the response body contains a context string followed by a values aray of Order objects like this:\r\n\t{\r\n\t  \"@odata.context\": \"https://microsoft-apiapp18a6d.azurewebsites.net/Northwind/v4/$metadata#Orders\",\r\n\t  \"value\": [\r\n\t\t{\r\n\t\t  \"OrderID\": 10248,\r\n\t\t  \"CustomerID\": \"VINET\",\r\n\t\t  \"EmployeeID\": 5,\r\n\t\t  \"OrderDate\": \"1996-07-04\",\r\n\t\t  \"RequiredDate\": \"1996-08-01\",\r\n\t\t  \"ShippedDate\": \"1996-07-16\",\r\n\t\t  \"ShipVia\": 3,\r\n\t\t  \"Freight\": 32.38,\r\n\t\t  \"ShipName\": \"Vins et alcools Chevalier\",\r\n\t\t  \"ShipAddress\": \"59 rue de l'Abbaye\",\r\n\t\t  \"ShipCity\": \"Reims\",\r\n\t\t  \"ShipRegion\": null,\r\n\t\t  \"ShipPostalCode\": \"51100\",\r\n\t\t  \"ShipCountry\": \"France\"\r\n\t\t},\r\n\t\t{...}\r\n\t]}\r\n\r\nWith the following swagger we're not describing that the data will be inside the value array property:\r\n\r\n        \"responses\": {\r\n          \"200\": {\r\n            \"description\": \"EntitySet Orders\",\r\n            \"schema\": { \"$ref\": \"#/definitions/NorthwindAPI.Models.Order\" }\r\n          },\r\n          \"default\": {\r\n            \"description\": \"Unexpected error\",\r\n            \"schema\": { \"$ref\": \"#/definitions/_Error\" }\r\n          }\r\n\r\nAs a result, some tools don't like it.\r\n\r\nPerhaps this schema in swagger output would be better:\r\n\r\n        \"responses\": {\r\n          \"200\": {\r\n            \"description\": \"OK\",\r\n            \"schema\": {\r\n              \"title\": \"response\",\r\n              \"type\": \"object\",\r\n              \"properties\": {\r\n                \"context\": {\r\n                  \"type\": \"string\"\r\n                },\r\n                \"value\": {\r\n                  \"type\": \"array\",\r\n                  \"items\": {\r\n                    \"$ref\": \"#/definitions/Order\"\r\n                  }\r\n                }\r\n              }\r\n            }\r\n          },\r\n        },\r\n\r\nI'd like to do some more testing to see how this change might be beneficial, but reached a dead end so thought I'd share the idea if you're interested."},"comment":{"url":"https://api.github.com/repos/rbeauchamp/Swashbuckle.OData/issues/comments/169661068","html_url":"https://github.com/rbeauchamp/Swashbuckle.OData/issues/47#issuecomment-169661068","issue_url":"https://api.github.com/repos/rbeauchamp/Swashbuckle.OData/issues/47","id":169661068,"user":{"login":"joshbooker","id":2698896,"avatar_url":"https://avatars.githubusercontent.com/u/2698896?v=3","gravatar_id":"","url":"https://api.github.com/users/joshbooker","html_url":"https://github.com/joshbooker","followers_url":"https://api.github.com/users/joshbooker/followers","following_url":"https://api.github.com/users/joshbooker/following{/other_user}","gists_url":"https://api.github.com/users/joshbooker/gists{/gist_id}","starred_url":"https://api.github.com/users/joshbooker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshbooker/subscriptions","organizations_url":"https://api.github.com/users/joshbooker/orgs","repos_url":"https://api.github.com/users/joshbooker/repos","events_url":"https://api.github.com/users/joshbooker/events{/privacy}","received_events_url":"https://api.github.com/users/joshbooker/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T13:18:52Z","updated_at":"2016-01-07T13:18:52Z","body":"Mostly Azure App Service Logic Apps.  An OData project can be published as an API App then used as a custom connector in Logic Apps.  The Logic Apps tooling reads swagger response schema and builds expressions against the json response.  The current schema works great as the tooling displays a list of Order properties.  The problem is, the tooling doesn't know the Orders array is wrapped in a value array.  When manually edit expressions in code view of logic app designer I can successfully include .value - just the tooling doesn't do it for me.\r\n\r\nAdditionally I've used swaggerhub.com and editor.swagger.io.  They don't really act on response schema, so they're not really affected by this particular problem.  They do show the response model so they were helpful in determining the suggested sample response schema in my post above.\r\n\r\nOff topic: These tools have other issues.  I cannot send a request because they include unused parameters in the URI.  (/Orders?$expand=&$filter=&etc)  OData doesn't like that.  I tried including the swagger allowEmptyValue = false (which should be the default) but that had not affect.  I'm of the opinion that they should leave off unused params like the swagger UI does.  If anybody has any ideas here I'd like to know.\r\n\r\nAnyway thanks for your hard work."}}