JsonUtils icon indicating copy to clipboard operation
JsonUtils copied to clipboard

Sporadic absence of generated property types for C#

Open Korporal opened this issue 6 years ago • 0 comments

I hit an example of where a C# class was generated but a couple of properties had their type missing and so the code will not compile until manually edited.

Here is the sample input from GitHub documentation about their Webhooks. If you paste that into the jsonutils website it generates a bunch of classes including these two:

    public class Commit
    {
        public string id { get; set; }
        public string tree_id { get; set; }
        public bool distinct { get; set; }
        public string message { get; set; }
        public DateTime timestamp { get; set; }
        public string url { get; set; }
        public Author author { get; set; }
        public Committer committer { get; set; }
        public IList<object> added { get; set; }
        public IList<object> removed { get; set; }
        public IList<string> modified { get; set; }
    }

    public class HeadCommit
    {
        public string id { get; set; }
        public string tree_id { get; set; }
        public bool distinct { get; set; }
        public string message { get; set; }
        public DateTime timestamp { get; set; }
        public string url { get; set; }
        public  author { get; set; }
        public  committer { get; set; }
        public IList<object> added { get; set; }
        public IList<object> removed { get; set; }
        public IList<string> modified { get; set; }
    }


As you can see the author and committer properties in the HeadCommit class have no type whereas in the Commit class they are correct.

Also these class are identical and so I wonder if the utility could detect (some final step in the processing) that it has created duplicate classes and then remove the dupes and adjust the final class structure to use that one type?

Korporal avatar Mar 03 '18 16:03 Korporal