我有一个项目,我必须在 rswag 中编写嵌套属性
{
"question_bank": {
"question_exams_attributes": {
"0": {
"question_bank_id": "",
"exam_id": "12",
"sub_category_id": "23",
"_destroy": "false"
}
},
"question_type": "Single best answer",
"difficulty": "easy",
"status": "active",
"tag_list": [
""
],
"question": "testing api 2"
},
"commit": "Submit"
}
我正在尝试用 rswag 中的嵌套属性语法编写这个 json 正文:我试过这个:
parameter name: :question_bank, in: :body, schema: {
type: :object,
properties: {
question_exams_attributes: {
type: :object,
properties: {
'0': {
properties: {
question_bank_id: { type: :string },
exam_id: { type: :string },
sub_category_id: { type: :string }
}
}
}
}
}
}