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

[IMP] runtime: allow using any class as a type in props validation #1600

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

sdegueldre
Copy link
Contributor

@sdegueldre sdegueldre commented Mar 26, 2024

Previously, we had a fixed whitelist for types that were allowed during
props validation. The implementation however supports using arbitrary
classes, and in practice it's desirable to do so, and already done when
not using typescript (when using typescript, it will error if the class
is not whitelisted), eg in Odoo, we use "Element" for the arch in the
standard view props, but this causes all view controllers to fail type
checking because it's not whitelisted.

This commit simply replaces existing constructors by a generic
constructor type, and adds a test with a validation success and a test
with a validation failure.

@sdegueldre sdegueldre force-pushed the master-allow-custom-class-validation-imp-sad branch from 27aa698 to 973cb18 Compare March 26, 2024 13:03
Previously, we had a fixed whitelist for types that were allowed during
props validation. The implementation however supports using arbitrary
classes, and in practice it's desirable to do so, and already done when
not using typescript (when using typescript, it will error if the class
is not whitelisted), eg in Odoo, we use "Element" for the arch in the
standard view props, but this causes all view controllers to fail type
checking because it's not whitelisted.

This commit simply replaces existing constructors by a generic
constructor type, and adds a test with a validation success and a test
with a validation failure.
@sdegueldre sdegueldre force-pushed the master-allow-custom-class-validation-imp-sad branch from 973cb18 to b3d33fb Compare March 26, 2024 13:08
@ged-odoo ged-odoo merged commit 97b69f1 into master Mar 26, 2024
3 checks passed
@ged-odoo ged-odoo deleted the master-allow-custom-class-validation-imp-sad branch March 26, 2024 13:10
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

Successfully merging this pull request may close these issues.

2 participants