mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 07:16:40 +00:00
Revert "Add a macro for complexes multiparts"
This commit is contained in:
@@ -8,12 +8,6 @@ class BlogsController < ApplicationController
|
||||
respond_with @blog
|
||||
end
|
||||
|
||||
# POST /blogs/multipart
|
||||
def multipart_create
|
||||
@blog = Blog.create(params.require(:blog).permit(:title, :content))
|
||||
respond_with @blog
|
||||
end
|
||||
|
||||
# POST /blogs/flexible
|
||||
def flexible_create
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
TestApp::Application.routes.draw do
|
||||
|
||||
post '/blogs/multipart', to: 'blogs#multipart_create'
|
||||
post '/blogs/flexible', to: 'blogs#flexible_create'
|
||||
post '/blogs/alternate', to: 'blogs#alternate_create'
|
||||
resources :blogs
|
||||
|
||||
@@ -8,7 +8,6 @@ RSpec.feature 'swagger-ui', js: true do
|
||||
|
||||
expect(page).to have_content('GET /blogs Searches blogs', normalize_ws: true)
|
||||
expect(page).to have_content('POST /blogs Creates a blog', normalize_ws: true)
|
||||
expect(page).to have_content('POST /blogs/multipart Creates a blog using multipart', normalize_ws: true)
|
||||
expect(page).to have_content('GET /blogs/{id} Retrieves a blog', normalize_ws: true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,33 +53,6 @@ RSpec.describe 'Blogs API', type: :request, swagger_doc: 'v1/swagger.json' do
|
||||
end
|
||||
end
|
||||
|
||||
path '/blogs/multipart' do
|
||||
post 'Creates a blog using multipart' do
|
||||
tags 'Blogs'
|
||||
description 'Creates a new blog from provided data'
|
||||
operationId 'createBlogWithMultipart'
|
||||
consumes 'multipart/form-data'
|
||||
produces 'application/json'
|
||||
parameter name: :blog, in: :formData, schema: { type: :object, properties: { name: :blog, type: :object, properties: { '$ref' => '#/definitions/blog' } } }
|
||||
|
||||
let(:blog) { { blog: { title: 'foo', content: 'bar' } } }
|
||||
|
||||
response '201', 'blog created' do
|
||||
# schema '$ref' => '#/definitions/blog'
|
||||
run_test!
|
||||
end
|
||||
|
||||
response '422', 'invalid request' do
|
||||
schema '$ref' => '#/definitions/errors_object'
|
||||
|
||||
let(:blog) { { blog: { title: 'foo' } } }
|
||||
run_test! do |response|
|
||||
expect(response.body).to include("can't be blank")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
path '/blogs/flexible' do
|
||||
post 'Creates a blog flexible body' do
|
||||
tags 'Blogs'
|
||||
|
||||
@@ -139,52 +139,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/blogs/multipart": {
|
||||
"post": {
|
||||
"summary": "Creates a blog using multipart",
|
||||
"tags": [
|
||||
"Blogs"
|
||||
],
|
||||
"description": "Creates a new blog from provided data",
|
||||
"operationId": "createBlogWithMultipart",
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "blog created",
|
||||
"content": {
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "invalid request",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/definitions/errors_object"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"multipart/form-data": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": "blog",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$ref": "#/definitions/blog"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/blogs/flexible": {
|
||||
"post": {
|
||||
"summary": "Creates a blog flexible body",
|
||||
|
||||
Reference in New Issue
Block a user