我希望重用项目中的代码,该代码看起来像第一个代码块,但需要一些帮助来执行包含两个对象和一个 bool 而不仅仅是一个对象的 json 模式(第二个代码块)?
猜测一些,但不太确定如何使用它。
string schemaJson = @"{
'description': 'onlyOneObject',
'type': 'object',
'properties': {
'personId': { 'type': 'string', 'minLength' : 6 },
'code': { 'type': 'string', 'minLength' : 3 }
},
'required' : [ 'personId' , 'code' ]
}";
JSchema schema = JSchema.Parse(schemaJson);
所以像这样的事情我需要你的专家帮助,因为我不太确定语法。
string schemaJson = @"{
'description': 'firstObject',
'type': 'object',
'properties': {
'personId': { 'type': 'string', 'minLength' : 6 },
'code': { 'type': 'string', 'minLength' : 3 }
},
'required' : [ 'personId' , 'code' ]
'description': 'secondObject', ??? Can I write the second object like this???
'type': 'object',
'properties': {
'name': { 'type': 'string', 'minLength' : 6 },
'code2': { 'type': 'string', 'minLength' : 3 }
},
'required' : [ 'name' , 'code2' ]
'description': 'yeahOrNay',
'type': 'bool'
something something for bool???
}";