{"action":"closed","issue":{"url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/issues/96","repository_url":"https://api.github.com/repos/NJsonSchema/NJsonSchema","labels_url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/issues/96/comments","events_url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/issues/96/events","html_url":"https://github.com/NJsonSchema/NJsonSchema/issues/96","id":158519051,"number":96,"title":"Support customizing the generated property and type names","user":{"login":"lheiskan","id":189382,"avatar_url":"https://avatars.githubusercontent.com/u/189382?v=3","gravatar_id":"","url":"https://api.github.com/users/lheiskan","html_url":"https://github.com/lheiskan","followers_url":"https://api.github.com/users/lheiskan/followers","following_url":"https://api.github.com/users/lheiskan/following{/other_user}","gists_url":"https://api.github.com/users/lheiskan/gists{/gist_id}","starred_url":"https://api.github.com/users/lheiskan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lheiskan/subscriptions","organizations_url":"https://api.github.com/users/lheiskan/orgs","repos_url":"https://api.github.com/users/lheiskan/repos","events_url":"https://api.github.com/users/lheiskan/events{/privacy}","received_events_url":"https://api.github.com/users/lheiskan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-06-04T19:07:00Z","updated_at":"2016-06-05T16:22:17Z","closed_at":"2016-06-05T16:22:17Z","body":"It would be nice if there was a way to (optionally) customize the names for generated properties and types. For instance, we could add few optional generator settings that would allow passing in lambdas for customizing the naming. Lambdas would receive the type|property name from json schema as input, and return the name to use in the generated code. Something like this:\r\n ```csharp\r\n            Func<string, string> namingTransform = (name) => {\r\n                // some_name-b64  ==> SomeName_b64\r\n                var components = name.Split('_');\r\n                var transformedComponents =  components\r\n                        .Select((c) => c.First().ToString().ToUpperInvariant() + c.Substring(1))\r\n                        .Select((c) => c.Replace(\"-\", \"_\"));\r\n                return string.Join(\"\", transformedComponents);\r\n            };\r\n            var settings = new CSharpGeneratorSettings() {\r\n                    ClassStyle = CSharpClassStyle.Poco,\r\n                    PropertyNameFun = namingTransform, \r\n                    TypeNameTransformFun = namingTransform \r\n            };\r\n```\r\nSo given schema\r\n```json\r\n\t    {\r\n                '$schema': 'http://json-schema.org/draft-04/schema#',\r\n                'id': 'http://domain.name.com/foo.json#',\r\n                'type': 'object',\r\n                'additionalProperties': false,\r\n                'properties': {\r\n                    'foo_bar-b64': {\r\n                        'type': 'string'\r\n                     }\r\n                }\r\n\t     }\r\n```\t\r\nGenerated code would end up looking something like this\r\n```csharp\t\r\n\tpublic class Foo {\r\n\t\tpublic string FooBar_b64 {get;set;}\r\n\t}\r\n```"}}
{"actor":{"display_login":"rsuter"}}