using NJsonSchema;
using NJsonSchema.CodeGeneration.CSharp;
using System;
using System.Net;
var schemaUrl = "https://schema.management.azure.com/schemas/2017-03-01/Microsoft.Network.json#";
var schemaTxt = new WebClient().DownloadString(schemaUrl);
var jsonSchema = JsonSchema.FromJsonAsync(schemaTxt).Result;
var generator = new CSharpGenerator(jsonSchema);
generator.Settings.Namespace = "MyNameSpace";
var code = generator.GenerateFile();
Console.WriteLine(code);
I get an empty name space as the generated code:
//----------------------
// <auto-generated>
// Generated using the NJsonSchema v10.5.2.0 (Newtonsoft.Json v9.0.0.0) (http://NJsonSchema.org)
// </auto-generated>
//----------------------
namespace MyNameSpace
{
#pragma warning disable // Disable all warnings
}
Am I doing something wrong ? Any ideas/help to generate the correct C# code would be greatly appreciated. Thank you.
Hi there,
I was testing out the C# source code generation for the following schema:
I used the following code:
I get an empty name space as the generated code:
Am I doing something wrong ? Any ideas/help to generate the correct C# code would be greatly appreciated. Thank you.