Fork me on GitHub
#clojure-spec
<
2018-03-29
>
ikitommi03:03:33

@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?

ikitommi03:03:08

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.

lilactown14:03:04

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."}}

lilactown14:03:54

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

lilactown14:03:18

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

ikitommi18:03:21

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

ikitommi18:03:02

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

lilactown18:03:18

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

lilactown18:03:28

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

lilactown18:03:35

which AFAICT does not work

ikitommi20:03:25

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.

jimbob16:03:40

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

taylor17:03:43

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

👍 4
borkdude17:03:34

When I write an fdef I place it above the function

seancorfield18:03:17

@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
borkdude19:03:45

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