Skip to content
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

Openapi parameters #628

Merged
merged 12 commits into from
Aug 24, 2023
Merged

Openapi parameters #628

merged 12 commits into from
Aug 24, 2023

Conversation

ikitommi
Copy link
Member

@ikitommi ikitommi commented May 28, 2023

Initial implementaiton for #627.

  • lifts :request into top-level route paramters (was: under :parameters)
  • separate coercer for :request and :parameters
  • migrated tests
["/foo" {:post {:request {:description ...
                          :content {"application/json" {:schema <schema>
                                                        :examples ...}
                                    :default {:schema <schema>}}
                          :body <schema>} ;; symmetry with response
                :parameters {:body <schema>} ;; backwards compatibility & simple use cases
                :responses {200 {:description ...
                                 :content {"application/json" {:schema <schema>
                                                               :examples ...}
                                           :default {:schema <schema>}}
                                 :body <schema>}}}] ;; backwards compatibility

TODO

  • support for accumulating swagger/openapi data under :content, e.g. :examples, :openapi/examples, :openapi, ...
  • [ ] convert example projects

@ikitommi
Copy link
Member Author

generating openapi from schema/spec/malli should be inlined in reitit. updating 4 libraties just for sake of small rendering changes is not fun. Also, code is mostly duplicate between the three.

Copy link
Member

@opqdonut opqdonut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some drive-by comments

doc/ring/coercion.md Outdated Show resolved Hide resolved
modules/reitit-spec/src/reitit/coercion/spec.cljc Outdated Show resolved Hide resolved
modules/reitit-spec/src/reitit/coercion/spec.cljc Outdated Show resolved Hide resolved
test/cljc/reitit/openapi_test.clj Show resolved Hide resolved
test/cljc/reitit/openapi_test.clj Show resolved Hide resolved
test/cljc/reitit/ring_coercion_test.cljc Outdated Show resolved Hide resolved
@ikitommi
Copy link
Member Author

need to add some more tests + port examples.

@ikitommi ikitommi marked this pull request as ready for review August 21, 2023 06:45
@ikitommi
Copy link
Member Author

I think this is done, TODO:

  1. refactor openapi-docs creationg from spec-tools and schema-tools into reitit
  2. cleanup code and tests

Copy link
Member

@opqdonut opqdonut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly questions, some suggestions

modules/reitit-core/src/reitit/coercion.cljc Show resolved Hide resolved
modules/reitit-ring/src/reitit/ring.cljc Show resolved Hide resolved
modules/reitit-core/src/reitit/coercion.cljc Outdated Show resolved Hide resolved
modules/reitit-spec/src/reitit/coercion/spec.cljc Outdated Show resolved Hide resolved
test/cljc/reitit/ring_coercion_test.cljc Show resolved Hide resolved
@ikitommi ikitommi merged commit b0c810a into master Aug 24, 2023
10 of 11 checks passed
opqdonut added a commit that referenced this pull request Aug 28, 2023
@opqdonut opqdonut deleted the openapi-parameters branch April 26, 2024 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants