我想像image [json]那样用描述来描述模型,而我有this之类的东西。我想在块中包含描述标题和数据。这是代码:
require 'swagger_helper'
describe 'Users API' do
path '/register/first_step' do
post 'First step of Registration' do
tags 'registration'
consumes 'application/json', 'application/xml'
parameter name: :user, in: :body, schema: {
type: :object,
properties: {
first_name: {
properties:
{
type: :string,
id: :integer
}
},
}, required: [ :first_name ]
}
end
end
end
答案 0 :(得分:0)
如果您只希望first_name
对象使用字符串user
,则应该为:
parameter name: :user, in: :body, schema: {
type: :object,
required: [:first_name],
properties: {
first_name: { type: :string }
}
}