From 5363c440acede5233c3845d9ca6f663c71cd3244 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Mon, 23 Oct 2023 20:41:59 -0400 Subject: [PATCH] Document array types Signed-off-by: Juan Cruz Viotti --- content/2020-12/validation/type.markdown | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/content/2020-12/validation/type.markdown b/content/2020-12/validation/type.markdown index e5608163..89e0ae27 100644 --- a/content/2020-12/validation/type.markdown +++ b/content/2020-12/validation/type.markdown @@ -45,3 +45,22 @@ numbers. Still, JSON Schema provides the `integer` logical type. {{< instance-fail "A string is not valid" >}} "foo" {{< /instance-fail >}} + +{{< schema "A schema that describes boolean or array instances" >}} +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": [ "boolean", "array" ] +} +{{< /schema >}} + +{{< instance-pass "The true boolean is valid" >}} +true +{{< /instance-pass >}} + +{{< instance-fail "A number is invalid" >}} +1234 +{{< /instance-fail >}} + +{{< instance-pass "An arbitrary array is valid" >}} +[ 1, 2, 3 ] +{{< /instance-pass >}}