ring-swagger 2018-12-03

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

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

ok @ikitommi will try that now πŸ™‚

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 %)))})

validation is not being applied 😞

IdProfile is another costum validation and is working fine

You need to constrain the map-schema.

i'll be right back

πŸ™ 1

thanks πŸ™‚

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

πŸ‘ 1

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

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

happy to help

@florinbraghis has joined the channel

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 ?