Skip to content

Commit

Permalink
Merge pull request #576 from romanblanco/remove-commented-code
Browse files Browse the repository at this point in the history
  • Loading branch information
jtannas committed Jan 17, 2023
2 parents bfe4103 + 1db45fc commit 3071203
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 140 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Changed

- Remove commented code (https://github.com/rswag/rswag/pull/576)

### Fixed

- Fix ADDITIONAL_RSPEC_OPTS to always apply (https://github.com/rswag/rswag/pull/584)
Expand Down
3 changes: 0 additions & 3 deletions rswag-api/spec/generators/rswag/api/install_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ module Api
it 'installs the Rails initializer' do
assert_file('config/initializers/rswag_api.rb')
end

# Don't know how to test this
#it 'wires up routes'
end
end
end
Expand Down
140 changes: 3 additions & 137 deletions test-app/spec/integration/openapi3_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
swagger_root = File.expand_path('tmp/swagger', __dir__)
config = double('config', swagger_root: swagger_root, get_swagger_doc: swagger_doc )
formatter = Rswag::Specs::SwaggerFormatter.new(output, config)

example_group = OpenStruct.new(group: OpenStruct.new(metadata: example.metadata))
formatter.example_group_finished(example_group)
end
Expand Down Expand Up @@ -68,7 +68,7 @@
url: "https://{defaultHost}/foo",
variables: {
defaultHost: {
default: "api.example.com"
default: "api.example.com"
}
}
}]}
Expand All @@ -79,7 +79,7 @@
url: "https://{defaultHost}/foo",
variables: {
defaultHost: {
default: "api.example.com"
default: "api.example.com"
}
}
}])
Expand Down Expand Up @@ -212,138 +212,4 @@
describe 'Components Section'
describe 'Using $ref'
describe 'Grouping Operations with Tags'


# path '/blogs' do
# post 'Creates a blog' do
# tags 'Blogs'
# description 'Creates a new blog from provided data'
# operationId 'createBlog'
# consumes 'application/json'
# produces 'application/json'
# parameter name: :blog, in: :body, schema: { '$ref' => '#/definitions/blog' }

# let(: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) { { title: 'foo' } }
# run_test! do |response|
# expect(response.body).to include("can't be blank")
# end

# it 'outputs parameters' do
# pp swagger_doc
# params = swagger_doc.dig(:paths, "/blogs", :post, :parameters)
# expect(params[0][:name]).to eq(:blog)
# end
# end
# end

# get 'Searches blogs' do
# tags 'Blogs'
# description 'Searches blogs by keywords'
# operationId 'searchBlogs'
# produces 'application/json'
# parameter name: :keywords, in: :query, type: 'string'

# let(:keywords) { 'foo bar' }

# response '200', 'success' do
# schema type: 'array', items: { '$ref' => '#/definitions/blog' }
# end

# response '406', 'unsupported accept header' do
# let(:'Accept') { 'application/foo' }
# run_test!
# end
# end
# end

# path '/blogs/flexible' do
# post 'Creates a blog flexible body' do
# tags 'Blogs'
# description 'Creates a flexible blog from provided data'
# operationId 'createFlexibleBlog'
# consumes 'application/json'
# produces 'application/json'

# parameter name: :flexible_blog, in: :body, schema: {
# oneOf: [
# { '$ref' => '#/definitions/blog' },
# { '$ref' => '#/definitions/flexible_blog' }
# ]
# }

# let(:flexible_blog) { { blog: { headline: 'my headline', text: 'my text' } } }

# response '201', 'flexible blog created' do
# schema oneOf: [{ '$ref' => '#/definitions/blog' }, { '$ref' => '#/definitions/flexible_blog' }]
# run_test!
# end
# end
# end

# path '/blogs/{id}' do
# parameter name: :id, in: :path, type: :string

# let(:id) { blog.id }
# let(:blog) { Blog.create(title: 'foo', content: 'bar', thumbnail: 'thumbnail.png') }

# get 'Retrieves a blog' do
# tags 'Blogs'
# description 'Retrieves a specific blog by id'
# operationId 'getBlog'
# produces 'application/json'

# response '200', 'blog found' do
# header 'ETag', type: :string
# header 'Last-Modified', type: :string
# header 'Cache-Control', type: :string

# schema '$ref' => '#/definitions/blog'

# examples 'application/json' => {
# id: 1,
# title: 'Hello world!',
# content: 'Hello world and hello universe. Thank you all very much!!!',
# thumbnail: 'thumbnail.png'
# }

# let(:id) { blog.id }
# run_test!
# end

# response '404', 'blog not found' do
# let(:id) { 'invalid' }
# run_test!
# end
# end
# end

# path '/blogs/{id}/upload' do
# parameter name: :id, in: :path, type: :string

# let(:id) { blog.id }
# let(:blog) { Blog.create(title: 'foo', content: 'bar') }

# put 'Uploads a blog thumbnail' do
# tags 'Blogs'
# description 'Upload a thumbnail for specific blog by id'
# operationId 'uploadThumbnailBlog'
# consumes 'multipart/form-data'
# parameter name: :file, :in => :formData, :type => :file, required: true

# response '200', 'blog updated' do
# let(:file) { Rack::Test::UploadedFile.new(Rails.root.join("spec/fixtures/thumbnail.png")) }
# run_test!
# end
# end
# end
end

0 comments on commit 3071203

Please sign in to comment.