From 42c0bffa14c1336b06671939634fa9bc9c72bf6d Mon Sep 17 00:00:00 2001 From: Oliver Vartiainen Date: Wed, 6 Nov 2024 11:40:04 +0200 Subject: [PATCH] Elaborate `optional-keys` and `required-keys` The preexisting documentation did not mention the optional argument that lets you pick which keys to affect. --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ccc147210..819223da9 100644 --- a/README.md +++ b/README.md @@ -1458,10 +1458,22 @@ Making keys optional or required: ; [:x {:optional true} int?] ; [:y {:optional true} int?]] -(mu/required-keys [:map [:x {:optional true} int?] [:y int?]]) +(mu/optional-keys [:map [:x int?] [:y int?]] + [:x]) +;[:map +; [:x {:optional true} int?] +; [:y int?]] + +(mu/required-keys [:map [:x {:optional true} int?] [:y {:optional true} int?]]) ;[:map ; [:x int?] ; [:y int?]] + +(mu/required-keys [:map [:x {:optional true} int?] [:y {:optional true} int?]] + [:x]) +;[:map +; [:x int?] +; [:y {:optional true} int?]] ``` Closing and opening all `:map` schemas recursively: