【发布时间】:2014-07-11 11:51:21
【问题描述】:
是否可以在 JSON 模式中将不同类型的枚举值作为键值对传递?
例如:
"availableproducts" : {
"enum" : ["Produce 1" : 20.00 , "Product 3" : 30.00 , "Product 7" : 10.00 , "Product 17" : 00.00 ]
},
或者我需要单独列出数组并将它们组合为键值对吗?
谢谢
已编辑:
架构定义应该是这样的吗? (请注意,我从单独的架构链接到产品。)
"availableproducts" : {
"description" : "available products for this option ",
"type" : "array",
"items" : {
"type" : "object",
"properties" :{
"availableproducts" : {
"$ref": "http://mystore.com/schemas#product/properties/name" ,
"type" : "string",
},
"productcost" :{
"type" : "number",
},
}
},
},
【问题讨论】: