[SOLVED] Validation error in cloud.squidex.io when trying to import schema

Hi Sebastian,

I think I found a bug (or maybe it’s by design?)

Steps to reproduce:

  1. Click on Create new schema
  2. Type the name of your new schema
  3. Click Import button at the bottom of the dialog
  4. Paste your Json of a schema from some other Squidex instance
  5. Click Create

If you’ve specified List Fields and/or Reference Fields under UI for your schema and these arrays contain values in. your Json you will get a red banner that says:

Validation error.

* FieldsInLists[0]: Field is not part of the schema.
* FieldsInLists[1]: Field is not part of the schema.
* FieldsInLists[2]: Field is not part of the schema.
* FieldsInLists[3]: Field is not part of the schema.
* FieldsInLists[4]: Field is not part of the schema.
* FieldsInLists[5]: Field is not part of the schema.
* FieldsInReferences[0]: Field is not part of the schema.
* FieldsInReferences[1]: Field is not part of the schema.

Work-around:

Remove all values from the following arrays in the Json before clicking Create:

    "fieldsInLists": [],
    "fieldsInReferences": [],

I think it is kind of a bug.

The field names have been renamed to be more consistent. Before it was:

myDataField
meta.id

Now it is

data.myDataField
id

I guess this path just does not do the automatic migration.

You could always make the migration manually…

Sorry, I accidentally edited your post.

Do you have an example input? I have seen that the migration should also happen for the sync command. There is also a test for that.

No problem.

Yes, here’s the json i tried pasting that gave me that error:

{
    "previewUrls": {},
    "properties": {
        "validateOnPublish": false
    },
    "scripts": {},
    "isPublished": true,
    "fieldRules": [],
    "fieldsInLists": [
        "meta.createdBy.avatar",
        "name",
        "value",
        "nameDisplayText",
        "meta.status.color",
        "meta.lastModified"
    ],
    "fieldsInReferences": [
        "name"
    ],
    "fields": [
        {
            "name": "value",
            "properties": {
                "isRequired": false,
                "isRequiredOnPublish": false,
                "isHalfWidth": false,
                "fieldType": "Number",
                "editor": "Input",
                "inlineEditable": true,
                "isUnique": true,
                "maxValue": 3,
                "minValue": 1,
                "label": "",
                "hints": "",
                "placeholder": "E.g.: 1"
            },
            "isLocked": false,
            "isHidden": false,
            "isDisabled": false,
            "partitioning": "invariant"
        },
        {
            "name": "name",
            "properties": {
                "isRequired": false,
                "isRequiredOnPublish": false,
                "isHalfWidth": false,
                "fieldType": "String",
                "createEnum": false,
                "editor": "Input",
                "inlineEditable": true,
                "isEmbeddable": false,
                "isUnique": false,
                "contentType": "Unspecified",
                "placeholder": "E.g.: (1) Just Testing"
            },
            "isLocked": false,
            "isHidden": false,
            "isDisabled": false,
            "partitioning": "language"
        },
        {
            "name": "nameDisplayText",
            "properties": {
                "isRequired": false,
                "isRequiredOnPublish": false,
                "isHalfWidth": false,
                "fieldType": "String",
                "createEnum": false,
                "editor": "Input",
                "inlineEditable": true,
                "isEmbeddable": false,
                "isUnique": false,
                "contentType": "Unspecified",
                "placeholder": "E.g.: Just Testing"
            },
            "isLocked": false,
            "isHidden": false,
            "isDisabled": false,
            "partitioning": "language"
        }
    ],
    "type": "Default"
}

Solved. Code was registered in the wrong order in dependency injection.

1 Like

This topic was automatically closed after 15 hours. New replies are no longer allowed.