-
Notifications
You must be signed in to change notification settings - Fork 84
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
feat: Openapi support for ring swagger #150
base: master
Are you sure you want to change the base?
Conversation
src/ring/swagger/json_schema.clj
Outdated
@@ -56,10 +56,10 @@ | |||
(str (if n (str n "/")) (name x))) | |||
x)) | |||
|
|||
(defmulti convert-class (fn [c options] c)) | |||
(defmulti convert-class (fn [c _ _] c)) |
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.
Could you find a different solution to adding an extra param? I don't think we need to break existing users of convert-class
. Could you list any other approaches you've thought of, with tradeoffs?
For the defn
s that have an extra param here, if you can't figure out an alternative solution please keep support for the previous arity.
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.
initially I tried passing the schema-type inside the options but I got some error which I don't remember.
I've refactored the code a lot after that I will gain give that try and update on the same.
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 removed the extra argument. And pass is inside options itself.
Could you please take second look.
src/ring/openapi/openapi3_schema.clj
Outdated
(opt :description) s/Str | ||
(opt :externalDocs) ExternalDocumentation | ||
(opt :operationId) s/Str | ||
(opt :parameters) s/Any #_[Parameter] |
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.
@rajcspsg why is this commented out?
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.
Initially I thought of defining schema for parameter object in the input schema but the schema i defined doesn't work well. So I changed it to s/Any
for now.
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 realized it should work if I change it like this
(s/defschema Parameters
{(opt :query) s/Any
(opt :path) s/Any
(opt :header) s/Any})
src/ring/openapi/validator.clj
Outdated
[scjsv.core :as v])) | ||
|
||
; https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v2.0/schema.json | ||
; http://json-schema.org/draft-04/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.
@rajcspsg what are the updated urls here?
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.
Yeah I forgot to update the url here the correct is https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v3.0/schema.json
fixes #121