我希望这是一个合法的问题,我到处搜索有关如何执行此操作的示例或任何信息来源。我也尝试过这个https://github.com/fotinakis/swagger-blocks/issues/17。但是结果相同。
我想生成的最终结果如下:
$('#p1').on
({
mouseenter: function () one mouse enter
{
$(this).css("color","red");
},
mouseleave: function () {
$(this).css("color","black");
},
click: function () {
alert("hello");
}
});
我将模型写成这样:
{
"name": "Awesome Promotion",
"description": "30% off",
"qualifiers": [
{
"id": 12,
"type": "Rental"
},
{
"id": 13,
"type": "Qualifier",
"user_id": 23
},
{
"id": 14,
"type": "First",
"location_id": 32
}
]
昂首阔步现在产生的是:
swagger_schema :PromotionResponse do
property :name, type: :string, example: 'Awesome Promotion'
property :description, type: :string, example: '30% off'
property :qualifiers do
key :type, :array
items do
property :id, type: :integer, example: 2
property :type, type: :string, exmple: 'Location'
end
end
end
在数组模式中定义不同对象结构的正确方法是什么?