Background
I wanted to enable configuring URL redirects, e.g.
/very-long-path -> /vlp
/deprecated-page -> /
I was able to create a configuration page by either collections or a singleton with array of object(fromUrl, toUrl) field.
Problem
However, I was not able to find a way to deduplicate by fromUrl field. E.g.
/very-long-path -> /vlp
/deprecated-page -> /
/very-long-path -> / (Adding this does not make sense, as it conflicts with the first config. But it is allowed from the UI)
My question is: How do I deduplicate my collections or array items with a specific field value?
When there are more entries it's hard to find duplicates so it's better to have a programatic way.
My current workaround is to run a ci check for duplications, but it's better if we know that when we are editing it.
Possible solutions
- Validation function across array items
- A
fields.map type that allows user enter key and value, and key must be unique.
Background
I wanted to enable configuring URL redirects, e.g.
/very-long-path->/vlp/deprecated-page->/I was able to create a configuration page by either collections or a singleton with array of object(fromUrl, toUrl) field.
Problem
However, I was not able to find a way to deduplicate by
fromUrlfield. E.g./very-long-path->/vlp/deprecated-page->//very-long-path->/(Adding this does not make sense, as it conflicts with the first config. But it is allowed from the UI)My question is: How do I deduplicate my collections or array items with a specific field value?
When there are more entries it's hard to find duplicates so it's better to have a programatic way.
My current workaround is to run a ci check for duplications, but it's better if we know that when we are editing it.
Possible solutions
fields.maptype that allows user enter key and value, and key must be unique.