Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forms not being generated at /@@edit #12

Open
MrSambo opened this issue May 20, 2020 · 3 comments
Open

Forms not being generated at /@@edit #12

MrSambo opened this issue May 20, 2020 · 3 comments

Comments

@MrSambo
Copy link

MrSambo commented May 20, 2020

When viewing the @@edit link for an item the form isn't being generated. I get this error in the console ERROR TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at EditView.flattenSchema (guillotinaweb-grange.js:853).
Did a bit of digging and found that the schema returned from my guillotina doesn't have a definition property which is what's causing the error. However I'm not sure if this is a guillotina or grange issue because even with a basic/default Folder created through Grange I get the same issue. Any ideas what could be causing this?

@ebrehault
Copy link
Collaborator

Hello,

Do you confirm the call returning a response without definitions is http://127.0.0.1:8081/db/site/@types/CMSFolder?

Are you using the config.yaml provided in Grange to run your Guillotina server? (if you don't, make sure to use the same applications: https://github.com/guillotinaweb/grange/blob/master/g-api/config.yaml#L16)

@pigeonflight
Copy link

My "educated" guess is that definiitions is used to inform the edit form of the fields to add and also what type of field it is (string, datetime etc..)
This is output of the query to CMSFolder:

curl -L -X GET 'http://127.0.0.1:8081/db/site/@types/CMSFolder' \
-H 'Authorization: Basic cm9vdDpyb290'
{
    "title": "CMSFolder",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "required": [
        "uuid"
    ],
    "definitions": {
        "guillotina.behaviors.dublincore.IDublinCore": {
            "type": "object",
            "properties": {
                "title": {
                    "type": "string",
                    "description": "The first unqualified Dublin Core 'Title' element value.",
                    "title": "Title"
                },
                "description": {
                    "type": "string",
                    "description": "The first unqualified Dublin Core 'Description' element value.",
                    "title": "Description"
                },
                "creation_date": {
                    "type": "datetime",
                    "description": "The date and time that an object is created. \nThis is normally set automatically.",
                    "title": "Creation Date"
                },
                "modification_date": {
                    "type": "datetime",
                    "description": "The date and time that the object was last modified in a\nmeaningful way.",
                    "title": "Modification Date"
                },
                "effective_date": {
                    "type": "datetime",
                    "description": "The date and time that an object should be published. ",
                    "title": "Effective Date"
                },
                "expiration_date": {
                    "type": "datetime",
                    "description": "The date and time that the object should become unpublished.",
                    "title": "Expiration Date"
                },
                "creators": {
                    "type": "array",
                    "description": "The unqualified Dublin Core 'Creator' element values",
                    "max_length": 1000,
                    "title": "Creators",
                    "items": {
                        "type": "string"
                    }
                },
                "tags": {
                    "type": "array",
                    "description": "The unqualified Dublin Core 'Tags' element values",
                    "max_length": 10000,
                    "title": "Tags",
                    "items": {
                        "type": "string"
                    }
                },
                "publisher": {
                    "type": "string",
                    "description": "The first unqualified Dublin Core 'Publisher' element value.",
                    "title": "Publisher"
                },
                "contributors": {
                    "type": "array",
                    "description": "The unqualified Dublin Core 'Contributor' element values",
                    "max_length": 10000,
                    "title": "Contributors",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [],
            "invariants": [],
            "title": "Dublin Core fields",
            "description": ""
        },
        "guillotina_cms.interfaces.base.ICMSBehavior": {
            "type": "object",
            "properties": {
                "is_folderish": {
                    "type": "boolean",
                    "readonly": true,
                    "title": "Is a folderish object"
                },
                "hidden_navigation": {
                    "type": "boolean",
                    "title": "Should be hidden on navigation"
                },
                "language": {
                    "type": "string",
                    "title": "Language",
                    "vocabularyName": "languages",
                    "vocabulary": {
                        "@id": "http://127.0.0.1:8081/db/site/@vocabularies/languages"
                    }
                },
                "content_layout": {
                    "type": "string",
                    "default": "default",
                    "title": "Content Layout",
                    "vocabularyName": "content_layouts",
                    "vocabulary": {
                        "@id": "http://127.0.0.1:8081/db/site/@vocabularies/content_layouts"
                    }
                },
                "allow_discussion": {
                    "type": "boolean",
                    "title": "Allow discussion"
                },
                "position_in_parent": {
                    "type": "integer",
                    "default": -1,
                    "title": "Position in parent"
                },
                "review_state": {
                    "type": "string",
                    "readonly": true,
                    "title": "Workflow review state",
                    "vocabularyName": "worklow_states",
                    "vocabulary": {
                        "@id": "http://127.0.0.1:8081/db/site/@vocabularies/worklow_states"
                    }
                },
                "history": {
                    "type": "array",
                    "readonly": true,
                    "title": "History list",
                    "items": {
                        "actor": {
                            "type": "string"
                        },
                        "comments": {
                            "type": "string"
                        },
                        "time": {
                            "type": "string"
                        },
                        "type": {
                            "type": "string"
                        },
                        "title": {
                            "type": "string"
                        },
                        "data": {
                            "type": "object"
                        }
                    }
                },
                "comments": {
                    "type": "object",
                    "title": "Comments list field",
                    "properties": {},
                    "additionalProperties": {
                        "type": "object",
                        "title": "Comment",
                        "properties": {
                            "@parent": {
                                "type": "string"
                            },
                            "@type": {
                                "type": "string"
                            },
                            "author_name": {
                                "type": "string"
                            },
                            "author_username": {
                                "type": "string"
                            },
                            "creation_date": {
                                "type": "string"
                            },
                            "in_reply_to": {
                                "type": "string"
                            },
                            "is_deletable": {
                                "type": "boolean"
                            },
                            "is_editable": {
                                "type": "boolean"
                            },
                            "modification_date": {
                                "type": "boolean"
                            },
                            "text": {
                                "type": "object",
                                "properties": {
                                    "data": {
                                        "type": "string"
                                    },
                                    "mime-type": {
                                        "type": "string"
                                    }
                                }
                            },
                            "user_notification": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "required": [],
            "invariants": [],
            "title": "CMS data behavior",
            "description": ""
        }
    },
    "properties": {
        "type_name": {
            "type": "string",
            "readonly": true
        },
        "title": {
            "type": "string",
            "description": "Title of the Resource",
            "title": "Title"
        },
        "uuid": {
            "type": "string",
            "readonly": true,
            "title": "UUID"
        },
        "modification_date": {
            "type": "datetime",
            "title": "Modification date"
        },
        "creation_date": {
            "type": "datetime",
            "title": "Creation date"
        },
        "__behaviors__": {
            "type": "array",
            "description": "Dynamic behaviors for the content type",
            "readonly": true,
            "title": "Enabled behaviors"
        },
        "guillotina.behaviors.dublincore.IDublinCore": [
            {
                "$ref": "#/components/schemas/guillotina.behaviors.dublincore.IDublinCore"
            }
        ],
        "guillotina_cms.interfaces.base.ICMSBehavior": [
            {
                "$ref": "#/components/schemas/guillotina_cms.interfaces.base.ICMSBehavior"
            }
        ]
    },
    "invariants": []
}

@ebrehault
Copy link
Collaborator

so you do get data in definitions, then what is the problem? are you trying to edit a CMSFolder or another type of content?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants