Commit Graph

164 Commits

Author SHA1 Message Date
Greg Myers
231a2d135c add rewrite for securitySchemes into swagger_doc 2020-03-24 14:56:24 +00:00
Greg Myers
e9aebe6221 fix mistake in assigning header nodes for type 2020-03-22 23:45:47 +00:00
Greg Myers
eb58fe687a add upgrade for basepath and host to server urls 2020-03-22 23:39:48 +00:00
Greg Myers
da230a4f3e add header type schema support for openapi3 2020-03-21 23:17:00 +00:00
Greg Myers
a25307dc69 add support for openapi 3 securitySchemas 2020-03-21 23:14:58 +00:00
Greg Myers
9414ca16b6 add upgrade parameters refs to openapi3 2020-03-21 22:38:49 +00:00
Greg Myers
70eb277e04 add upgrade path and query param type output to openapi3 if selected 2020-03-21 21:38:09 +00:00
Greg Myers
23a1074d07 Add tests for OA3 components/schemas loader with upgrade notice 2020-03-21 20:24:04 +00:00
Greg Myers
095067792f add loader for OA3 schema definitions with version based deprecation
notice
2020-03-21 19:51:01 +00:00
Greg Myers
b5e210cd96 Merge branch 'openapi/master' into openapi/merge 2020-03-20 15:38:40 +00:00
Rutger Gelling
f331e064fd Add yaml support (#7) 2020-01-27 20:24:27 -05:00
Rutger Gelling
79304a1bc1 Add support for multiple content types in examples (#8) 2020-01-27 20:20:36 -05:00
Igor Kapkov
7b01ae1aa1 Add ENV var to configure --dry-run 2020-01-22 15:54:24 +11:00
Greg Myers
63f01962ad
Merge pull request #254 from fooki/master
Parameterize the pattern for test locations
2019-11-17 09:55:54 +00:00
Karl Johansson
4c613af2ba Allow tests to be run without generating docs
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..).
2019-11-15 16:21:04 +01:00
Karl Johansson
3cd9d38e19 Parameterize the pattern for test locations
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..'
2019-11-15 14:51:17 +01:00
Greg Myers
c904a32e51 Move constraint to less than rails 7 2019-11-02 17:06:21 +00:00
Greg Myers
eeb1026691 Fix invalid Swagger in YAML values
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?
2019-11-02 13:13:06 +00:00
Greg Myers
2c0f3c9396 Fix invalid Swagger in YAML 2019-11-02 12:58:36 +00:00
Greg Myers
acab437a7d Add failing test showing Psych errors 2019-11-02 12:55:09 +00:00
Greg Myers
0e04635b15 Write the files using specified format 2019-11-02 11:19:01 +00:00
Greg Myers
73b84101cc Adding yaml as option for generator
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.
2019-11-02 10:45:38 +00:00
Greg Myers
90d7fada85
Merge pull request #249 from BookOfGreg/fix/swagger-generator
Point the railtie to the correct file
2019-10-18 23:28:43 +01:00
Greg Myers
c14f72a45e Point the railtie to the correct file
Fixes #248
2019-10-18 23:18:32 +01:00
Greg Myers
9722419647
Merge pull request #180 from fishpercolator/default_swaggerize
Add a 'rake rswag' that runs swaggerize as the default
2019-10-17 22:35:50 +01:00
Nathan Broadbent
e5eb44191c Use RSpec.describe to fix IRB context warning in Rails console 2019-10-17 16:40:31 +07:00
Greg Myers
4d29e09010 Add spec generator test 2019-10-16 23:19:24 +01:00
Greg Myers
189a7ef061 Move spec generator files, organize whitespace in generator output 2019-10-16 22:05:14 +01:00
Greg Myers
778d250385 Split file join path 2019-10-16 21:12:36 +01:00
Greg Myers
77d00407a4 whitespace linting 2019-10-16 20:51:53 +01:00
Greg Myers
8b61984fb3
Merge branch 'master' into feature/request_spec_generator 2019-10-16 20:44:11 +01:00
Peter McCready
5c9154864e add options and trace verbs 2019-10-04 14:51:41 +01:00
jdanielian
72becffefe
Merge pull request #5 from gravityslave92/master
Remove hindrance for migrating to rails 6
2019-09-07 08:33:01 -04:00
Jay Danielian
6a4cc8de8d Adds fix for multiple files to be marked in request_body_multipart 2019-09-07 08:21:56 -04:00
gravityslave92
275c3b1994
Update dependency add versional protection 2019-09-06 14:58:00 +03:00
gravityslave92
8f2378eb6f Remove hinders for migrating to rails 6 2019-09-06 12:57:44 +03:00
Jay Danielian
5555edc59f Only automatically save examples if examples are not given explicitly in the spec itself 2019-08-26 22:25:53 -04:00
Thiago Pradi
ac65dc1780 Gemfile / gemspec files compatible with Rails 6 2019-08-25 22:36:14 -03:00
Jay Danielian
5a8d1ce359 Updates README with proper links and examples for new OpenApi 3.0 syntax / features
Missed a few generator items as part of the rename
2019-08-04 11:00:33 -04:00
Jay Danielian
157175c90f Finishes some renaming elements that were missed previously
Modifes the travis.yml in trying to setup travis CI build
2019-08-01 14:05:57 -04:00
Jay Danielian
6d285d2c4f Notes in the todos 2019-08-01 13:05:44 -04:00
Jay Danielian
032ad5dc54 Fixes last little pathing mistakes from rename
All specs are passing in all gems and in test-app

Properly generates open api 3 swagger via rake rswag:specs:swaggerize and via bundle exec rspec in test-app dir
2019-08-01 09:10:38 -04:00
Jay Danielian
475929e9aa Renames gems to open_api-rswag-* 2019-08-01 08:37:05 -04:00
Jay Danielian
13f7007b2f Renames and fixes specs in api and specs project to prefix OpenApi module. Gem name to open_api-rswag 2019-07-27 14:53:01 -04: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
eb4e6045c5 Modifies generator and specs to look for openapi: 3.0.0 vs swagger 2.0
Renames rswag-api to rswag_api as that is preferred file naming convention in initializers per rubocop linting
2019-07-20 12:52:31 -04:00
Jay Danielian
4baf5efd11 Updates specs to add 3.0 compliant structure and tests around the new schema/structure 2019-07-20 12:29:44 -04:00
Jay Danielian
04564d933f Fixes example group helpers spec with new 3.0 format 2019-07-18 22:19:10 -04:00
Jay Danielian
aa59c5ff91 Fixes response validators specs for v3 structure 2019-07-18 22:01:00 -04:00
Jay Danielian
659b328eda Fixes spec for #stop writing swagger docs 2019-07-17 20:35:56 -04:00
Jay Danielian
aa133b90fc 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
2019-07-17 20:07:30 -04:00
Jay Danielian
c820bb75e0 Modifies parameters and body request/responses to output 3.0 syntax for basic operations.
SwaggerEditor passes basic output
2019-07-14 17:28:11 -04:00
Jay Danielian
0093efd4bf Adds rswag to test and development so rake tasks work
Adds to swagger_Formatter to remove injected body parameters since those are 2.0 and ont 3.0 compliant

Adds to example_group_helpers to only automatically save request examples in the swagger output on 2xx response, since otherwise it was getting clobbered
2019-07-07 22:57:55 -04:00
Jay Danielian
297cc447c8 Gets v3 request example saving as well as response example saving
Adds rubocop to the gemset

adds guard to the gemset for testing
2019-07-05 15:59:47 -04:00
Jay Danielian
768a1a1d43 Initial commit for trying to produce and consume v3 swagger 2019-06-29 18:12:21 -04:00
Richard Morris
10bb732148
Merge pull request #177 from FormAPI/show_response_body_for_invalid_code
Show response body when the response code is unexpected.
2019-04-08 12:25:28 +01:00
Rich Daley
bfd3d66ec2 Add a 'rake rswag' that runs swaggerize as the default 2019-01-07 14:17:53 +00:00
Nathan Broadbent
e381bf85d4 Show response body when the response code is unexpected. Makes it much easier to debug test failures 2018-12-22 15:20:49 +07:00
Greg Myers
9642937ee2
Update swagger_helper.rb
Use standard filesystem helpers to avoid OS specific slash errors.
2018-12-18 13:29:40 +00:00
Matthew Santeler
aa8f16070d Update comment in swagger_helper template 2018-09-19 15:24:16 -04:00
Richard Morris
b9f71fe9b1
Merge pull request #117 from imRohan/master
Fixed typos in the swagger_helper.rb file
2018-05-24 20:00:10 -07:00
domaindrivendev
26a3bf5079 avoid metadata mutation in request_factory 2018-04-23 16:00:07 -07:00
Rohan Likhite
fee3b3bb84 fixed typos in the swagger_helper.rb file 2018-03-29 11:42:36 -04:00
Andrey Kurashev
05e1e2271f Fix Authorization header missing and duplicating 2018-02-20 14:49:13 +06:00
domaindrivendev
06d00de992 Assume symbol for referenced parameter key 2017-09-06 13:38:36 -07:00
domaindrivendev
ad9cd5de66 Support paired security requirements - e.g. basic and apiKey 2017-08-21 01:07:47 -07:00
Travis Hooper
037c0e374a Allows for parameters to be defined without the 'in' key defined to allow for parameter 2017-07-31 17:44:43 -05:00
domaindrivendev
8f16492462 Merge pull request #82 from domaindrivendev/per-response-metadata
Allow arbitrary metadata for path/response blocks
2017-07-22 10:33:05 -07:00
domaindrivendev
732cab994c simplify validation blocks and use correct scope 2017-07-21 22:26:14 -07:00
domaindrivendev
452d9176cc Allow arbitrary metadata for path/response blocks 2017-07-21 21:19:25 -07:00
domaindrivendev
7f0e437f8b For rswag, param names MUST be unique 2017-07-21 21:04:46 -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
e18a001e9b Move rackify headers to RequestFactory + other minor refactors 2017-07-21 13:49:01 -07:00
domaindrivendev
97c2a39cfa Refactor request_factory & response_validator 2017-07-20 23:42:40 -07:00
Hannes Probst
8ede7f78f1 use fully_validate to get more specific error msg 2017-07-18 15:45:36 +02:00
Andrew Hobson
1515ce4fcb Support optional query parameters 2017-07-11 16:28:45 -04:00
domaindrivendev
3404fa72aa Publish gems via CI on tagged builds of master 2017-07-10 23:52:51 -07:00
Paul Carey
c9bda862b6 adds request spec generator shamelessly stollen from rspec-rails-swagger 2017-07-06 10:45:54 +01:00
Ali Qanavatian
44840ab836 Merge branch 'master' into add-formData-support 2017-07-04 09:45:33 +04:30
domaindrivendev
8f5cb1aa12 Reduce depencencies to require Rails components only 2017-06-28 09:01:07 -07:00
domaindrivendev
de7ec5f15d Leverage security definitions for headers in example requests 2017-06-26 17:52:00 -07:00
domaindrivendev
e40c5fc26e Prep for 1.3.0 2017-06-26 17:39:34 -07:00
domaindrivendev
e03a6d333f Merge branch 'master' into fixdepnotice 2017-06-26 17:26:28 -07:00
domaindrivendev
353be669e4 Removed some deprecation warnings 2017-05-19 11:11:13 -07:00
domaindrivendev
1b3a976313 Merge branch 'master' into rails-5-1 2017-05-19 10:35:00 -07:00
domaindrivendev
2617fdc48d Prep for v1.2.1 release 2017-05-19 10:32:22 -07:00
Grzesiek Kolodziejczyk
8aeb9a6c70 Relax Rails dependency to allow 5.1 2017-05-18 11:47:40 +02:00
ali.q
182ee093f4 add formData support 2017-05-11 05:06:46 +04:30
Horia Radu
f195c82759 yield entire response instead of only the body 2017-04-29 21:17:53 +03:00
Horia Radu
37f86f6d94 yield entire response instead of only the body 2017-04-29 12:06:57 +03:00
Horia Radu
51c9f4e5e6 Response body value validation
Add the possibility to pass a block to the run_test!
method in order to add expectations on your response
2017-04-28 11:46:52 +03:00
Dante Piombino
233c5cc735 get no deprecation; add some docs 2017-02-16 16:31:45 -05:00
Pavel Bezpalov
98d5b982c4 Add way for examples generation from responses 2017-01-19 11:46:56 +02:00
richie
77d4cbe0ea Prep for v1.2.0 release 2017-01-08 07:51:24 -08:00
richie
471dff5e34 Prep for v1.1.0 release 2016-11-08 12:43:31 -08:00
vinhbachsy
64b0de494f Simplify response header validation
Change to checks for the presence of required headers instead of using 
JSON::Validator
2016-10-20 01:33:43 +08:00
vinhbachsy
0b0acfe4c7 Rename response_examples to examples for consistent DSL
Special handling `examples` invocation with no parameters to avoid
overriding the `examples` method of rspec-core ExampleGroup
2016-10-19 03:04:03 +08:00
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
vinhbachsy
10dd37896f Support setting examples for response
Add helper method `response_examples` to inject response examples to swagger
2016-10-18 21:46:35 +08:00