{"action":"created","issue":{"url":"https://api.github.com/repos/RSuter/NJsonSchema/issues/646","repository_url":"https://api.github.com/repos/RSuter/NJsonSchema","labels_url":"https://api.github.com/repos/RSuter/NJsonSchema/issues/646/labels{/name}","comments_url":"https://api.github.com/repos/RSuter/NJsonSchema/issues/646/comments","events_url":"https://api.github.com/repos/RSuter/NJsonSchema/issues/646/events","html_url":"https://github.com/RSuter/NJsonSchema/issues/646","id":303019953,"node_id":"MDU6SXNzdWUzMDMwMTk5NTM=","number":646,"title":"Generation of $ref classes should be supressed","user":{"login":"WilfriedRicken","id":15694511,"node_id":"MDQ6VXNlcjE1Njk0NTEx","avatar_url":"https://avatars1.githubusercontent.com/u/15694511?v=4","gravatar_id":"","url":"https://api.github.com/users/WilfriedRicken","html_url":"https://github.com/WilfriedRicken","followers_url":"https://api.github.com/users/WilfriedRicken/followers","following_url":"https://api.github.com/users/WilfriedRicken/following{/other_user}","gists_url":"https://api.github.com/users/WilfriedRicken/gists{/gist_id}","starred_url":"https://api.github.com/users/WilfriedRicken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WilfriedRicken/subscriptions","organizations_url":"https://api.github.com/users/WilfriedRicken/orgs","repos_url":"https://api.github.com/users/WilfriedRicken/repos","events_url":"https://api.github.com/users/WilfriedRicken/events{/privacy}","received_events_url":"https://api.github.com/users/WilfriedRicken/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-03-07T09:18:33Z","updated_at":"2018-10-31T15:18:13Z","closed_at":null,"author_association":"NONE","body":"We have JSON schema which uses $ref to specify the type of a referenced class in a JSON schema. However, the classes are now emitted more than once. Is it possible to supress this?\r\n\r\nExample:\r\n\r\n**OrderDTO.json:**\r\n\r\n```\r\n{\r\n\t\"type\": \"object\",\r\n\t\"required\": [\r\n\t\t\"orderId\",\r\n\t\t\"title\"\r\n\t],\r\n\t\"properties\": {\r\n\t\t\"orderId\": {\r\n\t\t\t\"type\": \"string\"\r\n\t\t},\r\n\t\t\"title\": {\r\n\t\t\t\"type\": \"string\"\r\n\t\t},\r\n\t\t\"orderText\": {\r\n\t\t\t\"type\": \"string\"\r\n\t\t},\r\n\t\t\"state\": {\r\n\t\t\t\"type\": \"string\",\r\n\t\t\t\"enum\": [\r\n\t\t\t\t\"in_progress\",\r\n\t\t\t\t\"finalized\"\r\n\t\t\t]\r\n\t\t},\r\n\t\t\"job\": {\r\n\t\t\t\"$ref\": \"JobDTO.json\"\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\n**JobDTO.json:**\r\n\r\n```\r\n{\r\n\t\"type\": \"object\",\r\n\t\"required\": [\r\n\t\t\"jobId\"\r\n\t],\r\n\t\"properties\": {\r\n\t\t\"jobId\": {\r\n\t\t\t\"type\": \"string\"\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nGenerating code for both JSON schema files leads to two generated classes JobDTO.json, one correctly in a file JobDTO.cs, another one as a duplicate in OrderDTO.cs.\r\n\r\nOne could argue that only OrderDTO.cs is needed, however, better would be to suppress the generation of JobDTO in OrderDTO.cs because the $ref correctly refers to another class in another file. When using $ref more than once including only one file would be not sufficient anymore.\r\n\r\nAny idea?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/RSuter/NJsonSchema/issues/comments/434727683","html_url":"https://github.com/RSuter/NJsonSchema/issues/646#issuecomment-434727683","issue_url":"https://api.github.com/repos/RSuter/NJsonSchema/issues/646","id":434727683,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDcyNzY4Mw==","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-10-31T15:18:13Z","updated_at":"2018-10-31T15:18:13Z","author_association":"OWNER","body":"> I think it would be best to have a switch in CSharpGeneratorSettings to specify whether $ref-included classes should be supressed in code generation and their usage should be the fully qualified type name for that class.\r\n\r\nI think this setting should be possible to add..."}}
{"actor":{"display_login":"RSuter"}}