From 8708171877054c98aad45079d85d4e699420f2fe Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 19 Nov 2026 11:32:16 +0100 Subject: Added fields in lists --- lib/configuration/tests/errors.t | 103 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-) (limited to 'lib/configuration/tests/errors.t') diff --git a/lib/configuration/tests/errors.t b/lib/configuration/tests/errors.t index 99ad465..b23f237 100644 --- a/lib/configuration/tests/errors.t +++ b/lib/configuration/tests/errors.t @@ -222,8 +222,7 @@ A list ID follows the same rules as a content ID: > { > "list": [ > { - > "id": "foo.bar", - > "source": "csv" + > "id": "foo.bar" > } > ], > "content": [] @@ -235,3 +234,103 @@ A list ID follows the same rules as a content ID: in field "id": Expected an identifier with only the accepted characters, but got "foo.bar" + +A reference field in a list can only target another list, not a content: + + $ tests --configuration < { + > "list": [ + > { + > "id": "user_type_list", + > "field": [ + > { + > "name": "entity", + > "label": {}, + > "type": { "content": "entity" } + > } + > ] + > } + > ], + > "content": [ { "id": "entity" } ] + > } + > EOF + in field "list": + while decoding a list: + element 0: + in field "field": + while decoding a list: + element 0: + in field "type": + I tried the following decoders but they all failed: + "text" decoder: + Expected a string, but got { "content": "entity" } + "content" decoder: + References in a list can only target a list declared before it, but got + { "content": "entity" } + +A list cannot reference itself: + + $ tests --configuration < { + > "list": [ + > { + > "id": "user_type_list", + > "field": [ + > { + > "name": "parent", + > "label": {}, + > "type": { "content": "user_type_list" } + > } + > ] + > } + > ], + > "content": [] + > } + > EOF + in field "list": + while decoding a list: + element 0: + in field "field": + while decoding a list: + element 0: + in field "type": + I tried the following decoders but they all failed: + "text" decoder: + Expected a string, but got { "content": "user_type_list" } + "content" decoder: + References in a list can only target a list declared before it, but got + { "content": "user_type_list" } + +A list cannot reference a list declared after it: + + $ tests --configuration < { + > "list": [ + > { + > "id": "first_list", + > "field": [ + > { + > "name": "other", + > "label": {}, + > "type": { "content": "second_list" } + > } + > ] + > }, + > { "id": "second_list" } + > ], + > "content": [] + > } + > EOF + in field "list": + while decoding a list: + element 0: + in field "field": + while decoding a list: + element 0: + in field "type": + I tried the following decoders but they all failed: + "text" decoder: + Expected a string, but got { "content": "second_list" } + "content" decoder: + References in a list can only target a list declared before it, but got + { "content": "second_list" } -- cgit v1.2.3