Commit Graph

13 Commits

Author SHA1 Message Date
Blake Erickson
989aab656f
Revert "Add a macro for complexes multiparts" 2021-03-06 14:52:49 -07:00
Blake Erickson
f7036b7e5a
Merge pull request #300 from sobrinho/master
Add a macro for complexes multiparts
2021-03-06 10:22:54 -07:00
MikeSmithEU
267007ef1b
Update blogs_controller.rb
Fix typo
2020-07-22 11:23:01 +02:00
Gabriel Sobrinho
f8dbd98bbc
Add a macro for complexes multiparts
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.
2020-04-16 22:38:35 -03:00
Jay Danielian
b8dcc8fe30 Adds support for proper requestBody examples. Adds mechanism to allow for adding additional ways to add request body examples
Can add externalValue or  it will work and produce valid swagger spec.

The Symbol name matching the let parameter is always required
2019-07-21 15:03:37 -04:00
Jay Danielian
4c2097e017 Fixes response_validator to handle 3.0 responses and validate against the schema.
JSON::Validator already handles anyOf oneOf schema definitions, so those can be passed in and validation errors are returned properly
2019-07-20 14:33:51 -04:00
Jay Danielian
cd348b53f8 Adds anyOf support to requestBody 2019-07-20 13:50:38 -04:00
domaindrivendev
fee8491ab6 swagger-ui as middleware & upgrade to 3.12.2 2018-05-17 09:02:05 -07:00
domaindrivendev
b16198377b Merge branch 'add-formData-support' of https://github.com/thg303/rswag into thg303-add-formData-support 2017-07-21 14:25:29 -07:00
domaindrivendev
97c2a39cfa Refactor request_factory & response_validator 2017-07-20 23:42:40 -07:00
ali.q
182ee093f4 add formData support 2017-05-11 05:06:46 +04:30
vinhbachsy
5cf376891a Validate response headers based on specified header
Add validate_headers step in response validator.
Using JSON::Validator with validate header value with swagger header 
object.
2016-10-18 21:46:35 +08:00
richie
c558098c39 rename to rswag plus major refactor - almost a rewrite 2016-10-11 18:31:12 -07:00