Unique check not valid if slugified using scripts

If you have a field called slug and you make it unique but also autogenerate it using following scripts, then it won’t check the uniqueness. Duplicate slug saved even though unique constraint is applied in schema def.

var data = ctx.data;

        if (data.title && data.title.iv) {
            data.slug = { iv: slugify(data.title.iv) };

            replace(data);
        }

It is not really a bug. The point is that the script is applied after the validation check.

It is by design. I changed it to a feature request to discuss it.

Sure. Not an issue. I just wanted to point it out just in case.

1 Like

Yes, it is very welcome.