Hi! How I can express if A is optional in schema and if A exists then B should present too?
probably using a predicate?
I mean how to express it as spec (inside spec one value depends on another) ?
{
:java-src-folder "test-projects/javac/src/java"
:javac-options ["-target" "1.8" "-source" "1.8" "-Xlint:-options"] }
How to express as spec if :java-src-folder is present then :javac-options should be present?@mike1452 you can compose rules with :and
, from README:
`(-> [:and [:map
[:password string?]
[:password2 string?]]
[:fn {:error/message "passwords don't match"
:error/path [:password2]}
'(fn [{:keys [password password2]}]
(= password password2))]]
(m/explain {:password "secret"
:password2 "faarao"})
(me/humanize))
; {:password2 ["passwords don't match"]}`
@ikitommi Thanks! 👍