-
Notifications
You must be signed in to change notification settings - Fork 730
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
standardize validator functions to all Object
props
#8903
Comments
Is this issue still open? I would like to work on this |
Hi, @nikkuAg, yes, thanks for volunteering |
yes, that was the intent - thank you
a stopgap for lack of TypeScript, perhaps :) |
Except we could use this for runtime validation, which TypeScript does not provide! |
Hi, |
The basic idea is to use the Object validation specification work that was done in the referenced PRs, and use it to fully document each of the cases where an Object type is used as a prop. This allows for better specification of the intended properties and shape of the prop, and to give more semantic error messages when these expectations are violated. I would start by looking at one of the examples listed in the issue, and replacing the validator function with the Object validation specification. |
Hi @nikkuAg, are you still planning to work on this at some point or would it be better to unassign? |
Hi @MisRob, |
Okay @nikkuAg, thank you, let us know any time if you'd like to return to this |
hello, can i be assigned to work on a few of these validators? |
Hi @tiffcoding - yes, and please do feel free to open a PR with just a few of them, there is no need to do all of these all at once! |
Hi @tiffcoding, I wanted to mention that Learning Equality will be closed from December 23 to January 5. |
Hello there. Is this still being worked on?Asking since its been 3 weeks. I'm open to working on it if it's open. Thank You |
HI @Ammog-Warrier! Thank you for your interest in working on this issue. However, @tiffcoding has already opened a pr for the same here. Please be sure to look out for issues marked with the label "help wanted" that are suitable for contribution. You can find them here. Thanks again and we are looking forward to your contribution. |
Hello, I apologize for the delay! Due to holidays, i have not been able to work on this. feel free to hand it off to Ammog-Warrior for progress! |
Thank you @tiffcoding! |
Yea I'd like to work on it if possible. Thank You |
Great! Thank you! I'll assign it to you shortly! |
@Ammog-Warrier do you still plan to tackle this issue? In any case, @tiffcoding 's work in #12921 may be helpful for whoever ends up working on this. |
Yes yes, I'm currently working on it. I just glt sidetracked for few days because of some life stuff. Thank you for the advice. I'll look into it |
Thank you @Ammog-Warrier for your confirmation! |
Observed behavior
Following up from: #8640, #8878, and #8902 which added validation functions.
There are a large number of
Object
-type props with no validator function. (Search the codebase using a multi-line regex to help find them:{[^}]*type: Object[^}]*}
)Normal component props are well-documented using
type
,required
, and sometimesvalidator
. The keys ofObject
props are as much a part of the component API as the other ones, but they are often under-documented.Even when validation of
Object
props is done in Kolibri, it is performed in an ad-hoc manner with little consistency and the logging is less useful because usually Vue will simply say the validator failed without specifying why. Some examples:kolibri/kolibri/core/assets/src/views/sync/FacilityAdminCredentialsForm.vue
Lines 54 to 60 in c3238a8
kolibri/kolibri/plugins/setup_wizard/assets/src/views/importFacility/SelectFacilityForm.vue
Lines 67 to 73 in c3238a8
kolibri/kolibri/plugins/learn/assets/src/views/EmbeddedSidePanel/SelectGroup.vue
Lines 72 to 79 in c3238a8
Expected behavior
Component object props should have a validator and fill in default values which should simplify internal logic of components using these props
The text was updated successfully, but these errors were encountered: