-
Notifications
You must be signed in to change notification settings - Fork 788
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 |
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! |
Hey there! sorry for this, but I was free for a bit but my schedule just got even worse loaded than I expected. I sincerely apologise and request you to assign this issue to someone else. |
@MisRob Can i work on this issue? |
Hi @Ammog-Warrier, no problem at all, thank you for letting us know. Hi @Abhishek-Punhani, yes I will assign you. Thanks! |
@Abhishek-Punhani I'd recommend you study #12921 and @nucleogenesis's review - it has helpful information for this task |
@MisRob I was looking into this issue and I found that changes could be done ContentPage.vue,SelectGroup.vue and FacilityAdminCredentialsForm.vue Is this what I am supposed to do? |
Hi @Abhishek-Punhani, I think there's many many places to update in Kolibri, basically any time there's an |
@Abhishek-Punhani We don't only want to update existing validators but also to validate objects that don't have any validators yet. But as said, in smaller chunks ideally :) Thanks! |
@MisRob Thank you for your feedback. I’ve raised a PR where I modified the validators function in three Vue files to incorporate the validateObject function. Please review it at your convenience. I believe I can implement the validateObject and objectWithDefaults functions in upcoming PRs, but I would greatly appreciate your guidance to ensure they are implemented effectively. |
Hi @Abhishek-Punhani, thank you! I think you can feel free to continue working on this issue. |
@MisRob Thanks! Since this approach has been applied to a few files in the merged PR, should I continue making similar changes across other relevant files, or would you prefer a different approach? Let me know how you'd like me to proceed! |
Yes @Abhishek-Punhani, feel free to gradually work through this as you wish. The only thing I'd recommend opening pull requests of reasonable size since reviews will be easier and faster than having a huge PR, and that's all. However you can definitely do a bit more than in the first one, perhaps around 10 files in a single PR? That's just my opinionated recommendation, you're welcome to choose. |
Got it . Thanks @MisRob . I will try to raise a PR soon |
Hi @MisRob I think we can begin by resolving all the files in the Learn App. I have raised a PR modifying 10 files—please review it at your convenience. |
Sure, thanks @Abhishek-Punhani |
Hi! Since the scope of this issue is the entire codebase, would it be okay if I, too, joined to help? I can coordinate with @Abhishek-Punhani to work on disjoint directories, so that there is no duplication of efforts and we can work on the issue parallely. |
Hi @EshaanAgg , I think it would it better if we both collaborate together and coordinate to avoid any conflicts in our PRs. Let me know how you'd like to split things up! I think with this we can close this issue at a faster pace . @MisRob Please let me know how would you like me and @EshaanAgg to proceed with this issue! |
I was able to jot up a quick script that listed all the files that match the given regex and probably require intervention. One way to open up the issue to multiple contributors would be to treat this message (or we can copy this into the issue description itself) and treat it as the issue tracker. Any contributor can message here to claim a folder that he/she wants to work on, and the maintainers can edit the message to add a How does this approach sound? Files with Object-Type Props Missing Validators
|
Hi @EshaanAgg, thanks a lot for helping to coordinate, this would be very helpful. |
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: