This will allow to describe multipart in a short way, like JSON payload:
Before:
put 'Creates a blog with thumbnail' do
consumes 'multipart/form-data'
parameter name: :title, in: :formData, type: :string, required: true
parameter name: :content, in: :formData, type: :string, required: true
parameter name: :file, in: :formData, type: :file, required: true
let(:blog) { FactoryBot.build(:blog) }
let(:title) { blog.title }
let(:content) { blog.content }
let(:file) { blog.file }
...
end
After:
put 'Creates a blog with thumbnail' do
consumes 'multipart/form-data'
parameter name: :blog, in: :formData, schema: { '$ref' => '#/definitions/blog' }
let(:blog) { FactoryBot.attributes_for(:blog) }
...
end
Your mileage may vary but you can always choose the best option.
By providing the 'document: false' metadata, tests will be run but no swagger
documentation will be generated for the tagged example groups. It works on all
kinds of example groups (responses, verbs, paths etc..).
This commit allows users to specify search patterns when finding tests to
swaggerize. Omitting the pattern parameter makes rswag search with the default
patterns.
A typical usecase for this feature is when you already have a test suite set up
and you want to use rswag for generating swagger docs rather than high-coverage
testing.
Usage:
rake rswag:specs:swaggerize PATTERN='/your_path..'
The original fix failed because though the Keys were now strings, some
of the values for path variables were also symbols.
Psych does have a safe_load which has a whitelist of classes but it does
not have a safe_dump mode. We could have used deep_transform_values and
manually converted the classes we did not want, but why risk a buggy
implementation when JSON.generate works just fine?
New installations will get :yaml as it's default with openapi 3 as the
version. Old installations will have the key missing and will default
to :json with an easy upgrade path.