Fork me on GitHub
#ring-swagger
<
2017-08-01
>
jooivind11:08:48

so i have routes on the format:

(POST "/route" []
        :coercion :schema
        :responses {200 {:schema CompleteSchema}
                    400 {:schema {:error String}}}
        :body [use-case CompleteSchemaWithoutId]

jooivind11:08:07

but when posting to the route it still tries to put stuff in the database

jooivind11:08:16

even though it doesnt match the schema

jooivind11:08:40

(compojure-api / 1.1.0)

ikitommi11:08:11

@jooivind the named :coercion is introduced in 2.0.0, the 1.1.0 uses the old (hairy) way. Can’t remember the old syntax anymore. Sadly, the wiki-pages are out-of-sync (mostly ported to 2.0.0 already) 😞

ikitommi11:08:22

but removing the :coercion it works.

ikitommi11:08:30

1.1.0 uses only Schema.

jooivind11:08:54

yeah it was kinda hard to browse the 1.1.0 documentation

jooivind11:08:06

would you recommend just upgrading to 2.0.0?

ikitommi11:08:09

there are no branches in the wiki 😞

jooivind11:08:27

cause i kinda want to get coercion up and running as well

ikitommi11:08:39

for non-prod, definetely 2.0.0. For prod, at your own risk. Mostly stable, but still alpha.

ikitommi11:08:32

(we have had alpha running in prod for long time already)

jooivind11:08:26

thanks 🙂

henrik12:08:54

Ah, the old Google way. Keep a beta/alpha badge on everything perpetually even though it’s production quality. 🙂

henrik12:08:05

Seems fairly common in Clojureland

ikitommi13:08:56

@henrik that 😉 the first alphas with Muuntaja had lot of small issues with backwards compatibility, now as stabile as it gets (also used by Luminus & Duct), the spec-coercion might still have issues. Feedback welcome.

henrik14:08:47

Cheers @ikitommi, I will 🙂

bja20:08:04

fwiw, I've had various 1.2.0 snapshots and 2.0 running prod for my site's backend (http://curiosity.com) since early this year

bja20:08:34

obviously need to test releases and when stuff breaks you have to jump in, but it's been stable enough and the perf has been worth it