describo / crate-builder-component

A VueJS UI component to build an RO-Crate
MIT License
6 stars 3 forks source link

Additional input constraints in profiles #81

Closed beepsoft closed 5 months ago

beepsoft commented 8 months ago

Profiles currently define 3 constraints for inputs

It would be great to have further type specific constraints for inputs - similar to JSON Schema property constraints - and enforce them via the current validation mechanism.

The possible constraint, which could be added per type:

Text

TextArea

Number

Date

DateTime

I think the Text, TextArea and Number constraints could be easily added. The Date/DateTime might be trickier, but also valid use cases, for example, Dataverse has this kind of Date field, which allows entering either YYYY, or YYYY-MM or YYYY-MM-DD format dates.

marcolarosa commented 8 months ago

These are great ideas.

re: the Date / DateTime rules: The date picker supports the format field which satisfies this idea but I think it could get confusing when the user tries to enter a year in the format YYYY and ends up with that year as an ISO String. These cases can be modeled as a Text field with min = 4, max = 4 and an appropriate regex (Ie check 4 digits) And it means dates always output iSO Strings as expected (and this is what I do in my own app - a date field in ISO format and a date as a simple string).

Leave it with me - this is a good first task for someone I know that wants to start helping out. If they can't do it, then we can talk about your team providing a pull request or me doing it when i can.

beepsoft commented 7 months ago

@marcolarosa, do you think you or your helper will be able to proceed with this issues? Or should our team provide a PR for this?

marcolarosa commented 7 months ago

Umm yeah - if you guys can do this that would be great. Thankyou.

beepsoft commented 7 months ago

OK, we'll start working on it!

marcolarosa commented 5 months ago

@beepsoft Any news on this?

beepsoft commented 5 months ago

Yes, we have this working internally, I just need to make it ready for PR.

marcolarosa commented 5 months ago

Done!! Well done guys - this is great!