Unique field validation triggered unnecessarily

I have…

  • [ ] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [x] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

Unique field validation is triggered when editing content even though unique field is not modified.

Expected behavior

Unique field validation is only triggered when editing content if unique field is modified.

Minimal reproduction of the problem

  • Create schema with one unique string field and one non unique string field (see JSON below).
  • Create content for schema with unique field = original value and non unique field = original value.
  • Save content.
  • Edit content, change non unique field = new value, don’t modify unique field.
  • Save content.
  • Notice unexpected validation error.

Environment

  • [x] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: 5.0.0.0

Browser:

  • [x] Chrome (desktop)
  • [x] Chrome (Android)
  • [ ] Chrome (iOS)
  • [x] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [x] Edge

Others:

Schema JSON:

{
    "properties": {},
    "scripts": {},
    "fieldsInLists": [],
    "fieldsInReferences": [],
    "fields": [
        {
            "name": "uniqueField",
            "properties": {
                "fieldType": "String",
                "editor": "Input",
                "isUnique": true,
                "contentType": "Unspecified"
            },
            "partitioning": "invariant"
        },
        {
            "name": "nonUniqueField",
            "properties": {
                "fieldType": "String",
                "editor": "Input",
                "contentType": "Unspecified"
            },
            "partitioning": "invariant"
        }
    ],
    "isPublished": true
}

Why do you think this is a bug?

The strange thing is the error you get …

I cannot reproduce it :frowning:

Which version are you using?

I think this is a bug because current behaviour means a content cannot be modified such that its unique field stays the same. I can only make a change to the non unique field if I also make a change to the unique field, because otherwise the uniqueness validation triggers and doesn’t allow me to save.

I’ll try to explain again:
Schema S1 with fields F1 unique and F2 not unique.
C1 is content with schema S1 where F1=a and F2=b.
I’d like to edit C1 so that F1=a, F2=c.
This change would not contradict the uniqueness constraint of F1, since it’s value does not change.

Version is 5.0.0.0….

There is an exception very likely. In case of a uniqueness bug another error would be shown. But it only happens with the 5.0 beta.

I tried it in https://cloud.squidex.io/app/uniqueness-test and could not reproduce either.

There I got expected behaviour: Can change F2, no problem.
Also there validation error is better:

Validation error.

  • field1unique: Another content with the same value exists.

I’m pulling image squidex/squidex:latest as per https://docs.squidex.io/01-getting-started/installation/install-azure.

Yes, this is my error, that I have tagged the beta version as latest.

EDIT: I have fixed this now.

Pulling latest resolves it, thank you.

1 Like