-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
api.content.create lacks schema validation #415
Comments
I regularly use |
I was thinking about the attributes you pass in, not the whole schema. |
Dexterity also doesn't validate attributes when you set them directly on an existing object. Validation happens via forms and the REST API. Maybe we should consider it when working with objects directly, but it would be a pretty big change, and would require some thought about how to handle things like invariants involving multiple fields. |
Hi @jaroel funny, I was just about to add the same issue ;-) I think a parameter set to True by default should validate fields, we end up creating our own "validate_fields" method called after every api.content.create (see https://github.com/IMIO/imio.helpers/blob/master/src/imio/helpers/content.py#L239) and we even needed to write migrations sometimes to fix things, and so on... @jaroel if you do not propose a PR, we will ;-) Or we can work on this at the PloneConference sprint if you are there :-p Gauthier |
Hi Gauthier,
I wasn't planning to do any actual work here atm :D
…On Mon, 15 Oct 2018 at 11:46, Gauthier Bastien ***@***.***> wrote:
Hi @jaroel <https://github.com/jaroel>
funny, I was just about to add the same issue ;-)
I think a parameter set to True by default should validate fields, we end
up creating our own "validate_fields" method called after every
api.content.create (see
https://github.com/IMIO/imio.helpers/blob/master/src/imio/helpers/content.py#L239)
and we even needed to write migrations sometimes to fix things, and so on...
@jaroel <https://github.com/jaroel> if you do not propose a PR, we will
;-) Or we can work on this at the PloneConference sprint if you are there
:-p
Gauthier
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#415 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEULMYU5WTUENzSOe2yHsgDaeu0nP1xks5ulFl0gaJpZM4XKzjg>
.
--
Roel Bruggink
tel: +31-6-1626-0881
[email protected]
|
As seen in https://community.plone.org/t/creating-custom-dexterity-objects-from-plone-api/7318/ we can currently set an invalid value/type for fields.
In this case the user is setting a str instead of a RichTextValue, which leads to tracebacks like
Is this something we need to handle here, or is this something DX should do?
The text was updated successfully, but these errors were encountered: