Skip to content

Commit

Permalink
DefineInterface時にpropertiesがなくてもエラーを発生させないように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
KurisuJuha committed Jan 31, 2025
1 parent f93e02a commit 6daa3d8
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions mooresmaster.Generator/JsonSchema/JsonSchemaParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@ private static DefineInterface ParseDefineInterface(string id, JsonObject node,

var properties = new Dictionary<string, IDefineInterfacePropertySchema>();

var propertiesNode = node.Nodes[Tokens.PropertiesKey] as JsonArray;
foreach (var propertyNode in propertiesNode.Nodes.OfType<JsonObject>())
if (node.Nodes.TryGetValue(Tokens.PropertiesKey, out var propertiesNode))
{
// valueがtypeとかdefaultとか
// keyがプロパティ名

var propertySchemaId = Parse(propertyNode, null, schemaTable);
var key = propertyNode[Tokens.PropertyNameKey] as JsonString;
properties[key.Literal] = schemaTable.Table[propertySchemaId] as IDefineInterfacePropertySchema;
var propertiesArray = propertiesNode as JsonArray;
foreach (var propertyNode in propertiesArray.Nodes.OfType<JsonObject>())
{
// valueがtypeとかdefaultとか
// keyがプロパティ名

var propertySchemaId = Parse(propertyNode, null, schemaTable);
var key = propertyNode[Tokens.PropertyNameKey] as JsonString;
properties[key.Literal] = schemaTable.Table[propertySchemaId] as IDefineInterfacePropertySchema;
}
}

// interfaceの継承情報を取得
Expand Down

0 comments on commit 6daa3d8

Please sign in to comment.