{"action":"created","issue":{"url":"https://api.github.com/repos/RSuter/NSwag/issues/1635","repository_url":"https://api.github.com/repos/RSuter/NSwag","labels_url":"https://api.github.com/repos/RSuter/NSwag/issues/1635/labels{/name}","comments_url":"https://api.github.com/repos/RSuter/NSwag/issues/1635/comments","events_url":"https://api.github.com/repos/RSuter/NSwag/issues/1635/events","html_url":"https://github.com/RSuter/NSwag/issues/1635","id":364667746,"node_id":"MDU6SXNzdWUzNjQ2Njc3NDY=","number":1635,"title":"[NSwagStudio] Nullable Timespan in ASP web api 2 generates different C# method signature when using Output type of \"OpenApi3\" vs \"Swagger2\"","user":{"login":"G4rce","id":43583821,"node_id":"MDQ6VXNlcjQzNTgzODIx","avatar_url":"https://avatars1.githubusercontent.com/u/43583821?v=4","gravatar_id":"","url":"https://api.github.com/users/G4rce","html_url":"https://github.com/G4rce","followers_url":"https://api.github.com/users/G4rce/followers","following_url":"https://api.github.com/users/G4rce/following{/other_user}","gists_url":"https://api.github.com/users/G4rce/gists{/gist_id}","starred_url":"https://api.github.com/users/G4rce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/G4rce/subscriptions","organizations_url":"https://api.github.com/users/G4rce/orgs","repos_url":"https://api.github.com/users/G4rce/repos","events_url":"https://api.github.com/users/G4rce/events{/privacy}","received_events_url":"https://api.github.com/users/G4rce/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-09-27T21:54:53Z","updated_at":"2018-09-28T20:35:50Z","closed_at":null,"author_association":"NONE","body":"Hey,\r\nI'm using NSwagStudio x64 v11.19.2.0\r\nWith  below ASP web api 2 controller:\r\n```\r\n    [RoutePrefix(\"api/values\")]\r\n    public class ValuesController : ApiController\r\n    {\r\n        [HttpPut, Route(\"{id}/expiry\")]\r\n        [SwaggerResponse(200, typeof(bool))]\r\n        public async Task<IHttpActionResult> PutExpiry([FromUri] string id, [FromBody] TimeSpan? expiry)\r\n        {\r\n            await Task.Yield();\r\n\r\n            var success = true;\r\n            return Ok(success);\r\n        }\r\n    }\r\n\r\n    public class ValueDto\r\n    {\r\n        [Required]\r\n        public string Id { get; set; }\r\n    }\r\n```\r\nIn NSwag Studio I get different C# client when selecting Swagger2 vs OpenApi3.\r\n\r\nSwagger2:\r\n```\r\npublic System.Threading.Tasks.Task<bool> PutExpiryAsync(string id, System.TimeSpan? expiry)\r\n```\r\n\r\nOpenApi3:\r\n```\r\npublic System.Threading.Tasks.Task<bool> PutExpiryAsync(string id, System.TimeSpan expiry)\r\n```\r\n\r\nNotice in OpenApi3 the System.TimeSpan is not nullable.\r\nFor now I manually change the generated code to 'TimeSpan?', but fear another dev might overwrite it in future when they re-generate client.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/RSuter/NSwag/issues/comments/425558408","html_url":"https://github.com/RSuter/NSwag/issues/1635#issuecomment-425558408","issue_url":"https://api.github.com/repos/RSuter/NSwag/issues/1635","id":425558408,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTU1ODQwOA==","user":{"login":"RSuter","id":2603405,"node_id":"MDQ6VXNlcjI2MDM0MDU=","avatar_url":"https://avatars1.githubusercontent.com/u/2603405?v=4","gravatar_id":"","url":"https://api.github.com/users/RSuter","html_url":"https://github.com/RSuter","followers_url":"https://api.github.com/users/RSuter/followers","following_url":"https://api.github.com/users/RSuter/following{/other_user}","gists_url":"https://api.github.com/users/RSuter/gists{/gist_id}","starred_url":"https://api.github.com/users/RSuter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RSuter/subscriptions","organizations_url":"https://api.github.com/users/RSuter/orgs","repos_url":"https://api.github.com/users/RSuter/repos","events_url":"https://api.github.com/users/RSuter/events{/privacy}","received_events_url":"https://api.github.com/users/RSuter/received_events","type":"User","site_admin":false},"created_at":"2018-09-28T20:35:50Z","updated_at":"2018-09-28T20:35:50Z","author_association":"OWNER","body":"I've added AllowNullableBodyParameters setting (default: true) - now nullable should be correctly handled in OpenAPI 3 (without changing anything). In the next major release (v12) the default will be set to false to reflect the current implementation of ASP.NET Core 2+... Keeping default true to not break anyone now. "}}
{"actor":{"display_login":"RSuter"}}