New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v3.0.0 #714
base: master
Are you sure you want to change the base?
v3.0.0 #714
Conversation
Co-authored-by: Matt Polito <matt.polito@hashrocket.com>
`#send` is dangerous to call on objects passed into your library. Instead, this will take a page from normal RSpec request specs and allow developers to specify a "request_params" hash and a "request_headers" hash in let blocks that this lib can then access. I had to use request_ because example#headers already exists in request specs as a shorthand for integration_session.headers. I think this also cleans up some of the logic nicely. I moved extracting the params & headers into initializer to avoid duplicating effort. This will obviously break peoples' pre-existing specs, and needs to be part of a major version change.
fix README for new request_* pattern
@jtannas @mattpolito @BookOfGreg, I've tried to test the changes for v3.0.0 and they seem to work. |
I'll be happy to test this if you can shout when alpha version is tagged. |
# OAS 3: https://swagger.io/docs/specification/serialization/ | ||
if swagger_doc && doc_version(swagger_doc).start_with?('3') && param[:schema] | ||
# NOTE: https://swagger.io/docs/specification/serialization/ | ||
if param[:schema] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't add a comment down there, but shouldn't the else
case be removed? Since it relies on type
and collectionFormat
which just do not exist anymore in the new OpenAPI version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also saw that RSwag explicitly supports using type: ...
instead of the "correct" versionschema: { type: ... }
. (in this commit).
This actually leads to some confusing behaviour because in the current RSwag version: the only place where using type:
does not work is when trying to implement a specific serialization strategy (because then there is no schema
key of course).
So I would move the
type = type = param[:type] || param.dig(:schema, :type)
to the top of the file instead, remove this condition altogether and then use that type for serialization.
@@ -4,11 +4,11 @@ | |||
# This is used by the Swagger middleware to serve requests for API descriptions | |||
# NOTE: If you're using rswag-specs to generate Swagger, you'll need to ensure | |||
# that it's configured to generate files in the same folder | |||
c.openapi_root = Rails.root.to_s + '/swagger' | |||
c.openapi_root = Rails.root.to_s + '/openapi' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rails.root
is a Pathname, so it's better to do this:
c.openapi_root = Rails.root.join('openapi').to_s
Problem
Draft for a PR to release changes for v3.0.0.
This concerns this parts of the OpenAPI Specification:
The changes I made are compatible with:
Related Issues
Checklist