Comments (3)
did a spike to refactor internals for 5 & 8. Stuff found in here:
https://github.com/metosin/compojure-api/compare/context-star
notable changes:
- breaking: meta-data handlers collects parameters in 2.0 format,
meta/src-coerce!
removed in favour ofmeta/src-coerce-param!
. Will break client restructuring, but those should be easy to fix (need migration guide). context*
allows setting the meta-datas to mid-routes. Route-peeler accumulates all meta-data to endpoints (via deep-merge). does not currently rewrite the code itself, so works in the route-peeling phase for the swagger datas.- separate pipeline to accumulate the runtime meta-datas to endpoint via lexically scoped
meta/+compojure-api-meta+
. This would not work overdefroutes*
. - TODO: figure out how to combine the two accumulations (route-peeling time & runtime). Will do some extra spiking on this. Will not push anything into master before things clear out. Would work ok if we approve that parameter validations can't inherit from mid-routes to endpoints.
(context* "/context/:kikka" []
:summary "summary inherited from context" ; works ok
:path-params [kikka :- s/Str] ; currently enforced here
:query-params [kukka :- s/Str] ; currently enforced here too
(GET* "/api" []
; does not generate any code for parameter validation as meta-data is passed in at runtime (not at compile-time)
(ok {:kikka kikka
:kukka kukka})))
from compojure-api.
... context*
seems to work ok'ish. Does not cumulate lists & sets. Could...
(fact "accumulation in context*"
(let [metas (atom nil)]
(defapi api
(swaggered +name+
(context* "/:id" []
:path-params [id :- String]
:tags [:api]
:summary "jeah"
(GET* "/:di/ping" []
:tags [:ipa]
:path-params [di :- String]
:query-params [foo :- s/Int]
(reset! metas +compojure-api-meta+)
(ok [id di foo])))))
(fact "all but lists & sequences get accumulated"
(let [[status body] (get* api "/kikka/kukka/ping" {:foo 123})]
status => 200
body => ["kikka" "kukka" 123]
@metas => {:parameters {:path {:id String
:di String
s/Keyword s/Any}
:query {:foo s/Int
s/Keyword s/Any}}
:summary "jeah"
:tags #{:ipa}}))))
from compojure-api.
https://github.com/metosin/compojure-api/tree/swagger2routes
from compojure-api.
Related Issues (20)
- Vulnerabilities in dependency: jackson-databind 2.2.3 HOT 5
- Error handling bigdecimals into payload.
- Release 1.x Java 11 support HOT 1
- Vulnerabilities in dependency [metosin/ring-swagger-ui "2.2.10"]
- Group versioned API
- :body-params turns record instances into plain maps
- Can't access whole form parameter list during handler execution
- How to add 404 Error in the URL which is not present in API list?
- How to add dynamic Id in the URL? Problem is specified in desciption.
- Please make Potemkin opt-in HOT 2
- spec coercion to int HOT 1
- OpenAPI? HOT 5
- Add {:coercion :select-schema} option
- muuntaja encoder modifying swagger.json output HOT 1
- Vulnerability issue in dependent lib
- Missing security and deprecated meta
- Memory use rises with requests HOT 3
- Can't get Swagger UI to provide interface for arbitrary query params HOT 2
- fix broken url link in docs
- Clj-kondo linting issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compojure-api.