Adds request_body_multipart method which enables schema properties to be written for multipart upload body

Will inspect the provided hash and add the property file_name to the parameters collection so upload and 3.0 output will work properly
This commit is contained in:
Jay Danielian
2019-07-17 20:07:30 -04:00
parent c820bb75e0
commit aa133b90fc
6 changed files with 62 additions and 11 deletions

View File

@@ -65,7 +65,7 @@ describe 'Blogs API', type: :request, swagger_doc: 'v1/swagger.json' do
description 'Retrieves a specific blog by id'
operationId 'getBlog'
produces 'application/json'
parameter name: :id, in: :path, type: :string
response '200', 'blog found' do
@@ -106,7 +106,9 @@ describe 'Blogs API', type: :request, swagger_doc: 'v1/swagger.json' do
description 'Upload a thumbnail for specific blog by id'
operationId 'uploadThumbnailBlog'
consumes 'multipart/form-data'
parameter name: :file, in: :formData, type: :file, required: true
# parameter name: :file, in: :formData, type: :file, required: true
request_body_multipart schema: {properties: {:orderId => { type: :integer }, file: { type: :string, format: :binary }} }
response '200', 'blog updated' do
let(:file) { Rack::Test::UploadedFile.new(Rails.root.join('spec/fixtures/thumbnail.png')) }
@@ -115,3 +117,4 @@ describe 'Blogs API', type: :request, swagger_doc: 'v1/swagger.json' do
end
end
end