upgrading usage of NJsonSchema.CodeGeneration.CSharp

vnext
Paul Schneider 5 years ago
parent 3676e6e93d
commit 343c613622
4 changed files with 14 additions and 25 deletions

@ -27,16 +27,13 @@ namespace cli
multipleValues: false);
genargjson = target.Argument(
"json",
"Json file to generate a schema for.",
"Json file generated",
multipleValues: false);
}, false);
cmd.OnExecute(
async () => {
if (genargjson.Value == "jsonSchema") {
if (genargjson.Value == null)
await GenerateCiBuildSettingsSchema();
else
await GenerateCiBuildSettingsSchema(genargjson.Value);
() => {
if (genargclass.Value == "jsonSchema") {
GenerateCiBuildSettingsSchema(genargjson.Value);
} else {
cmd.ShowHint();
return 1;
@ -46,9 +43,9 @@ namespace cli
);
return cmd;
}
public static async Task GenerateCiBuildSettingsSchema(string outputFileName = "pauls-ci-schema.json")
public static void GenerateCiBuildSettingsSchema(string outputFileName = "pauls-ci-schema.json")
{
var schema = await JsonSchema4.FromTypeAsync<CiBuildSettings>();
var schema = JsonSchema.FromType(typeof(CiBuildSettings));
var schemaData = schema.ToJson();
FileInfo ofi = new FileInfo(outputFileName);
@ -57,14 +54,8 @@ namespace cli
owritter.WriteLine(schemaData);
owritter.Close();
ostream.Close();
/* var errors = schema.Validate("{...}");
foreach (var error in errors)
Console.WriteLine(error.Path + ": " + error.Kind);
schema = await JsonSchema4.FromJsonAsync(schemaData); */
}
}
}
}

@ -82,7 +82,7 @@ namespace cli {
_logger.LogInformation("Connecting to "+url);
await _client.ConnectAsync(new Uri(url), _tokenSource.Token);
_logger.LogInformation("Connected");
const int bufLen = Constants.WebSocketsMaxBufLen;
const int bufLen = Yavsc.Constants.WebSocketsMaxBufLen;
byte [] buffer = new byte[bufLen+4*sizeof(int)];
const int offset=0;
int read = 0;

@ -12,13 +12,10 @@ msbuild-restore:
check: run
project.lock.json: project.json
dnu restore
fixSystemXML:
@# fixing package id reference case, to System.Xml, from package NJsonSchema.CodeGeneration.CSharp
sed 's/System.XML/System.Xml/' project.lock.json > project.lock.json.new && mv project.lock.json.new project.lock.json
@sed 's/System.XML/System.Xml/' project.lock.json > project.lock.json.new && mv project.lock.json.new project.lock.json
restore: project.lock.json
$(BINTARGETPATH): project.lock.json

@ -46,14 +46,15 @@
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Newtonsoft.Json": "9.0.1",
"NJsonSchema.CodeGeneration.CSharp": "9.10.65",
"NJsonSchema.CodeGeneration.CSharp": "10.0.27",
"Yavsc": {
"version": "1.0.6-rc05",
"target": "package"
},
"Microsoft.Dnx.Host": "1.0.0-rc1-final",
"Microsoft.Dnx.Runtime": "1.0.0-rc1-final",
"Microsoft.Dnx.DesignTimeHost": "1.0.0-rc1-final"
"Microsoft.Dnx.DesignTimeHost": "1.0.0-rc1-final",
"YamlDotNet": "8.0.0"
},
"frameworks": {
"dnx451": {
@ -61,4 +62,4 @@
"System.Xml": {}
}
}
}
}

Loading…