{"action":"created","issue":{"url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/681","repository_url":"https://api.github.com/repos/OAI/OpenAPI-Specification","labels_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/681/labels{/name}","comments_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/681/comments","events_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/681/events","html_url":"https://github.com/OAI/OpenAPI-Specification/issues/681","id":153267069,"number":681,"title":"Integer enum with named items","user":{"login":"kenjitayama","id":48171,"avatar_url":"https://avatars.githubusercontent.com/u/48171?v=3","gravatar_id":"","url":"https://api.github.com/users/kenjitayama","html_url":"https://github.com/kenjitayama","followers_url":"https://api.github.com/users/kenjitayama/followers","following_url":"https://api.github.com/users/kenjitayama/following{/other_user}","gists_url":"https://api.github.com/users/kenjitayama/gists{/gist_id}","starred_url":"https://api.github.com/users/kenjitayama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenjitayama/subscriptions","organizations_url":"https://api.github.com/users/kenjitayama/orgs","repos_url":"https://api.github.com/users/kenjitayama/repos","events_url":"https://api.github.com/users/kenjitayama/events{/privacy}","received_events_url":"https://api.github.com/users/kenjitayama/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-05-05T16:16:49Z","updated_at":"2016-05-23T00:27:25Z","closed_at":null,"body":"I would like to propose a new field called `enumNames`.\r\n\r\nExample:\r\n```yaml\r\ndefinitions:\r\n  weather:\r\n    type: object\r\n    required:\r\n      - type\r\n    properties:\r\n      type:\r\n        type: integer\r\n        format: int32\r\n        enum:\r\n          - 1\r\n          - 2\r\n          - 3\r\n        enumNames:\r\n          - Sunny\r\n          - Cloudy\r\n          - Rainy\r\n```\r\n\r\nThis information is necessary for generating the following Java enum.\r\n\r\n```java\r\npublic enum Weather {\r\n    Sunny(1),\r\n    Cloudy(2),\r\n    Rainy(3);\r\n\r\n    private final int type;\r\n\r\n    private Weather(final int type) {\r\n        this.type = type;\r\n    }\r\n\r\n    public type getType() {\r\n        return type;\r\n    }\r\n}\r\n```\r\n\r\nSome web APIs require clients to send/retrieve integer enum items while knowing what they mean. So it is useful to be able to generate this kind of enum.\r\n\r\nI had been seeking advice in the following swagger-codegen issue, and got a conclusion that we need a vendor extension (which corresponds to this proposal) using Swagger 2.0 spec.\r\nhttps://github.com/swagger-api/swagger-codegen/issues/2690\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/comments/220865970","html_url":"https://github.com/OAI/OpenAPI-Specification/issues/681#issuecomment-220865970","issue_url":"https://api.github.com/repos/OAI/OpenAPI-Specification/issues/681","id":220865970,"user":{"login":"kenjitayama","id":48171,"avatar_url":"https://avatars.githubusercontent.com/u/48171?v=3","gravatar_id":"","url":"https://api.github.com/users/kenjitayama","html_url":"https://github.com/kenjitayama","followers_url":"https://api.github.com/users/kenjitayama/followers","following_url":"https://api.github.com/users/kenjitayama/following{/other_user}","gists_url":"https://api.github.com/users/kenjitayama/gists{/gist_id}","starred_url":"https://api.github.com/users/kenjitayama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenjitayama/subscriptions","organizations_url":"https://api.github.com/users/kenjitayama/orgs","repos_url":"https://api.github.com/users/kenjitayama/repos","events_url":"https://api.github.com/users/kenjitayama/events{/privacy}","received_events_url":"https://api.github.com/users/kenjitayama/received_events","type":"User","site_admin":false},"created_at":"2016-05-23T00:27:25Z","updated_at":"2016-05-23T00:27:25Z","body":"I see there's a long way to go.\r\nBut at least, now it is clear what is necessary to support this."}}
{"actor":{"display_login":"kenjitayama"}}