From e1bf7686f408b52a870d4ed4f3c565dbbcc3954f Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 19 Nov 2026 09:57:49 +0100 Subject: Management of lists in the settings --- lib/configuration/tests/configuration.t | 44 +++++++++++++++++++++++++++++++++ lib/configuration/tests/errors.t | 20 +++++++++++++++ 2 files changed, 64 insertions(+) (limited to 'lib/configuration/tests') diff --git a/lib/configuration/tests/configuration.t b/lib/configuration/tests/configuration.t index e44b91a..880e690 100644 --- a/lib/configuration/tests/configuration.t +++ b/lib/configuration/tests/configuration.t @@ -75,3 +75,47 @@ Cycles between elements are accepted when they are not mandatory to each other > } + +Lists are declared in the "list" key, with a source given either as a plain +kind string or as an object with a "type" and an optional "file". A reference +field can target a list, like a content: + + $ tests --configuration < { + > "list": [ + > { + > "id": "user_type_list", + > "source": "csv" + > }, + > { + > "id": "status_list", + > "source": { "type": "csv", "file": "status.csv" } + > } + > ], + > "content": [ + > { + > "id": "entity", + > "section": [ + > { + > "field": [ + > { + > "name": "user_type", + > "label": {}, + > "type": { "content": "user_type_list" } + > }, + > { + > "name": "statuses", + > "label": {}, + > "type": { + > "content": "status_list", + > "multivaluated": true + > } + > } + > ] + > } + > ] + > } + > ] + > } + > EOF + diff --git a/lib/configuration/tests/errors.t b/lib/configuration/tests/errors.t index bad5b3b..99ad465 100644 --- a/lib/configuration/tests/errors.t +++ b/lib/configuration/tests/errors.t @@ -215,3 +215,23 @@ Reference targets are validated the same way: in field "content": Expected an identifier with only the accepted characters, but got "bad\"target" + +A list ID follows the same rules as a content ID: + + $ tests --configuration < { + > "list": [ + > { + > "id": "foo.bar", + > "source": "csv" + > } + > ], + > "content": [] + > } + > EOF + in field "list": + while decoding a list: + element 0: + in field "id": + Expected an identifier with only the accepted characters, but got + "foo.bar" -- cgit v1.2.3