{"action":"opened","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-codegen/issues/3805","repository_url":"https://api.github.com/repos/swagger-api/swagger-codegen","labels_url":"https://api.github.com/repos/swagger-api/swagger-codegen/issues/3805/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-codegen/issues/3805/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-codegen/issues/3805/events","html_url":"https://github.com/swagger-api/swagger-codegen/issues/3805","id":177123683,"number":3805,"title":"Swagger Swift codegen generates and empty implementation for a map","user":{"login":"tharpa","id":1071496,"avatar_url":"https://avatars.githubusercontent.com/u/1071496?v=3","gravatar_id":"","url":"https://api.github.com/users/tharpa","html_url":"https://github.com/tharpa","followers_url":"https://api.github.com/users/tharpa/followers","following_url":"https://api.github.com/users/tharpa/following{/other_user}","gists_url":"https://api.github.com/users/tharpa/gists{/gist_id}","starred_url":"https://api.github.com/users/tharpa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tharpa/subscriptions","organizations_url":"https://api.github.com/users/tharpa/orgs","repos_url":"https://api.github.com/users/tharpa/repos","events_url":"https://api.github.com/users/tharpa/events{/privacy}","received_events_url":"https://api.github.com/users/tharpa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-15T08:58:54Z","updated_at":"2016-09-15T08:58:54Z","closed_at":null,"body":"<!--\r\nPlease follow the issue template below for bug reports and feature requests.\r\nAlso please indicate in the issue title which language/library is concerned. Eg:  [JAVA] Bug generating foo with bar \r\n-->\r\n\r\n##### Description\r\n\r\nThe [Swagger specification](http://swagger.io/specification/) specifies a way to define a string to string\r\nmap, e.g. in JSON:\r\n\r\n    {\r\n      \"type\": \"object\",\r\n      \"additionalProperties\": {\r\n        \"type\": \"string\"\r\n      }\r\n    }\r\n\r\nor in YAML:\r\n\r\n    type: object\r\n    additionalProperties:\r\n      type: string\r\n\r\nUnfortunately, the [Swagger Swift code generator](https://github.com/swagger-api/swagger-codegen) seems to have a\r\nproblem with it, generating only an *empty* class implementation,\r\ne.g. `Payload.swift` below:\r\n\r\n    //\r\n    // Payload.swift\r\n    //\r\n    // Generated by swagger-codegen\r\n    // https://github.com/swagger-api/swagger-codegen\r\n    //\r\n    \r\n    import Foundation\r\n    \r\n    \r\n    public class Payload: JSONEncodable {\r\n    \r\n        public init() {}\r\n    \r\n        // MARK: JSONEncodable\r\n        func encodeToJSON() -> AnyObject {\r\n            var nillableDictionary = [String:AnyObject?]()\r\n            let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]\r\n            return dictionary\r\n        }\r\n    }\r\n\r\nIs there an easy way to fix it without having to maintain our own entity\r\nclass, e.g. `Payload.swift`?\r\n\r\n##### Swagger-codegen 2.2.1\r\n\r\n##### Swagger declaration \r\nin YAML\r\n\r\n    ```yaml\r\n    type: object\r\n    additionalProperties:\r\n      type: string\r\n    ```\r\n\r\n   or in JSON\r\n\r\n    ```json\r\n      {\r\n      \"type\": \"object\",\r\n      \"additionalProperties\": {\r\n        \"type\": \"string\"\r\n      }\r\n    }\r\n    ```\r\n##### Command line used for generation\r\n\r\n`swagger-codegen generate -l swift -i ../core-api/src/main/resources/core-api.yaml`\r\n\r\n##### Steps to reproduce\r\n\r\n<!-- unambiguous set of steps to reproduce the bug.-->\r\n\r\n##### Related issues\r\n\r\nhttp://stackoverflow.com/questions/39506665/swagger-swift-code-generated-for-a-map-is-not-correct\r\n\r\nhttp://stackoverflow.com/questions/28644595/how-to-define-a-map-in-swagger\r\n"}}
{"actor":{"display_login":"tharpa"}}