RicoSuter/NJsonSchema

Empty file being generated...

Open

#311 opened on Feb 2, 2017

View on GitHub
 (2 comments) (6 reactions) (0 assignees)C# (550 forks)github user discovery
help wantedtype: bug

Repository metrics

Stars
 (1,578 stars)
PR merge metrics
 (Avg merge 39d 6h) (1 merged PR in 30d)

Description

Hello!

I'm trying to use this sample code to generate classes from a given json schema:

static void Main(string[] args)
    {
        var schema = JsonSchema4.FromJsonAsync(GetJsonSchema()).Result;
        var settings = new CSharpGeneratorSettings { ClassStyle = CSharpClassStyle.Poco, Namespace = "ns" };
        var generator = new CSharpGenerator(schema, settings);
        var output = generator.GenerateFile("Foo");

        Console.WriteLine("Hello World!");
    }

    static string GetJsonSchema()
    {
        var url = "https://raw.githubusercontent.com/Microsoft/vscode-debugadapter-node/master/debugProtocol.json";

        var client = new HttpClient();
        return client.GetStringAsync(url).Result; 
    }

output is always an empty class with #pragma and some auto-generated xxx comment.

What is wrong with it?

Thanks!

Contributor guide