ring-swagger

ring-swagger & compojure-api
Daouda 2018-12-03T14:37:19.006300Z

heys folks, any way to set constrained between two keys of the same schema?

ikitommi 2018-12-03T16:45:40.008Z

@quieterkali try s/constrained with schema and a custom function.

Daouda 2018-12-03T16:46:43.008900Z

ok @ikitommi will try that now πŸ™‚

Daouda 2018-12-03T16:56:00.009500Z

what i am doing wrong here please?

(s/defschema ProfileConnector
  "Schema for profile's connexion"
  {:profile-one IdProfile
   :profile-two (s/constrained IdProfile #(not (= :profile-one %)))})

Daouda 2018-12-03T16:56:31.009800Z

validation is not being applied 😞

Daouda 2018-12-03T16:57:30.010200Z

IdProfile is another costum validation and is working fine

ikitommi 2018-12-03T16:58:09.011100Z

You need to constrain the map-schema.

Daouda 2018-12-03T16:58:44.011500Z

i'll be right back

πŸ™ 1
Daouda 2018-12-03T16:58:49.011800Z

thanks πŸ™‚

ikitommi 2018-12-03T17:00:16.013400Z

(s/constrained
  {:profile-one IdProfile
   :profile-two IdProfile}
  #(not= (:profile-one %) (:profile-two %))
  'profiles-should-differ)

πŸ‘ 1
Daouda 2018-12-03T17:06:02.016100Z

@ikitommi you saved my day, thank you very much πŸ™‚

Daouda 2018-12-03T17:07:03.016800Z

and i learnt that i can consstrained the whole schema, this is very very very handy

ikitommi 2018-12-03T17:08:05.017600Z

happy to help

florinbraghis 2018-12-03T19:36:25.021800Z

Hello channel ! If I do this :body-params [x :- Long y :- Long] in a request handler, then the β€˜parameters’ value in swagger.json contains a generated schema, which is named something like Body17343, which contains my x and y definitions. Is there a way to give this automatic schema a name, while preserving the x and y bindings ?