Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 3b964c7

Browse files
committed
fix: schema for filter rules
1 parent 527c873 commit 3b964c7

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

packages/core/src/constants/configSchema.tsx

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,36 @@ const i18nField = {
5959
],
6060
};
6161

62+
const filterRule = {
63+
type: 'object',
64+
properties: {
65+
field: { type: 'string' },
66+
pattern: { type: 'string' },
67+
matchAll: { type: 'boolean' },
68+
value: {
69+
oneOf: [
70+
{ type: 'string' },
71+
{
72+
type: 'array',
73+
items: {
74+
type: 'string',
75+
},
76+
},
77+
],
78+
},
79+
},
80+
};
81+
82+
const filterRules = {
83+
oneOf: [
84+
{
85+
type: 'array',
86+
items: filterRule,
87+
},
88+
filterRule,
89+
],
90+
};
91+
6292
/**
6393
* Config for fields in both file and folder collections.
6494
*/
@@ -203,14 +233,7 @@ function getConfigSchema() {
203233
type: 'string',
204234
},
205235
},
206-
filter: {
207-
type: 'object',
208-
properties: {
209-
value: { type: 'string' },
210-
field: { type: 'string' },
211-
},
212-
required: ['value', 'field'],
213-
},
236+
filter: filterRules,
214237
label_singular: { type: 'string' },
215238
label: { type: 'string' },
216239
sortable_fields: {

0 commit comments

Comments
 (0)