我想在image [json]中像swagger一样建造带有描述的模型,我有像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
如果你只想为first_name
对象使用字符串user
,那么它应该是:
parameter name: :user, in: :body, schema: {
type: :object,
required: [:first_name],
properties: {
first_name: { type: :string }
}
}