Fork me on GitHub

@lilactown one of the authors here and just integrated that to reitit routing library and worked ok. Porting Schema=>Swagger into the same model, which will cause small changes to spec-side to get unified tranformation model for both. How can I help?


Still need to backport support for json schema refs for recursive references, also will change the apis a bit. e.g. tranformations return both the transformed swagger schemas and the named schema definitions they refer to.


I was trying to use the swagger-spec fn with an endpoint that had a response map like in the README:

:responses {200 {::swagger/spec ::user
                                                :description "Found it!"}
                                           404 {:description "Ohnoes."}}


however, this was getting converted to something like :x-spec-tools.swagger.core/spec :user/user


instead of expanding the ::user spec into the :schema key


@lilactown sorry, thread got buried. You should raise the ::swagger/responses one level up. So, ::swagger/responses {200 {:schema ::user}}


should add specs to the input so it would tell what happened.


yeah, I ended up using ::swagger/responses instead


but I was basing it off of this example in the README


which AFAICT does not work


Oh, good catch! I was too blind to see that it's not correct. Could you write an issue, need to fix either the code or the sample in README.


how do you guys organize your specs? Are all of your specs in a top level spec directory? or do you also mix and match spec assertions and definitions in core namespaces


I usually fdef next to the function, but put other specs in their own namespaces

👍 4

When I write an fdef I place it above the function


@ben.borders It depends. If I need code to work with pre-1.9 Clojure, I put all the specs in a separate namespace. Otherwise, if I'm spec'ing data I tend to put the specs in their own namespace (along with predicates and closely related helper functions), else if I'm spec'ing functions I tend to put those directly above the function they are for.

👍 4

@ben.borders Just moved the fdef + related specs to a widget/spec.cljs namespace because it became too large 😉