Skip to content

Provide more useful error than "Invalid type, expected array" #625

Closed
@upq

Description

@upq

I get this error while the output is exactly how I expect it, the problem is that the form is invalid.

Form

form =    {
                                        "key": "data.answers",
                                        "type": "array",
                                        "items": [
                                            {
                                                "key": "data.answers[]",

                                                "items": [
                                                    {
                                                        "key": "data.answers[].text",
                                                        "type": "text",
                                                        "title": "Question",
                                                    },
                                                ]
                                            }
                                        ]
                                    },

Schema

        scope.schema = {
                        "type": "object",
                        "title": "Types",
                        "properties": {
                            "data": {
                                "type": "object",
                                "title": "data",
                                "properties": {
                                    "answers": {
                                        "type": "array",
                                        "title":"Answers",
                                        "default": [],
                                        "items": {
                                            "type": "object",
                                            "title": "Answer",
                                            "properties": {
                                                "text": {
                                                    "title": "Answer",
                                                    "type": "text",
                                                    "required": true,
                                                },
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    };

expected output

data = {answers: [{text: "answer1"}, {text: "answer2"}], correct: 1, question: "questioning?"}

Now the expected output is right but the form is invalid saying that it expected an array, anything Im missing here?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions