Description
This issue actually likely contains a number of rules, and the various requirements below could be split into different rules in a number of ways. Generally it's better to keep rule files as focussed as possible, with a good separation of concerns between the validation being conducted by each file.
Validate recurrence rule from Schedule
The validator should include a rule that validates that a Schedule
contains a valid iCal recurrence rule.
There's already schedule generation logic in the conformance services, so it should be easy to convert this into some validation logic for the same fields, creating an rrule.
Note the logic above does not include scheduleTimezone
(which it definitely should), so this will need to be added.
If there are not enough properties to create an rrule (e.g. the rrule library might return an error saying this?), display #292
If the properties do not create a valid rrule, return an error from the rrule library that explains what’s wrong, as a FAILURE
Using the rrule, validate that all exceptDate
values are actually part of the recurrence defined by the rrule, and produce a WARNING if any are outside of the rrule.
Also note this other rrule library that has better support for timezones, if the library used above is problematic https://www.npmjs.com/package/@rschedule/core - however it has much lower usage so the rrule library is preferred if possible.
The Bookwhen (http://data.bookwhen.com/) and Open Sessions (https://opensessions.io/openactive) feeds should contain good test data for this.
Validate specific properties within PartialSchedule
(target only PartialSchedule
)
- validate that if a
PartialSchedule
includesstartTime
orendTime
, it must also includescheduleTimezone
, producing a FAILURE otherwise
Validate specific properties within Schedule
(target only Schedule
)
-
validate that
idTemplate
andurlTemplate
include a{startDate}
placeholder, and are valid .- A separate generic rule (Support valueConstraint for UriTemplate and UUID #377) that checks the values are valid Uri Templates
- A specific rule that targets
idTemplate
andurlTemplate
and checks that they both include{startDate}
, producing a FAILURE otherwise
-
validate that
scheduledEventType
is a validEvent
subclass.- This should be achievable using subClassGraph as here, perhaps by loading in the model specified by the value using DataModelHelper, producing a FAILURE if not
Validate specific properties within Schedule
and PartialSchedule
(target both)
-
validate that repeatCount is a positive integer greater than zero
- This is a separate generic rule (Support minValueInclusive #378), that is applied to both
Schedule
andPartialSchedule
via the data-models
- This is a separate generic rule (Support minValueInclusive #378), that is applied to both
-
validate that
scheduleTimezone
matches a value from the IANA Time Zone Database.- A specific rule that targets
scheduleTimezone
and uses e.g.moment.tz.names()
(which requires adding moment-timezone) to validate the entries, producing a FAILURE if the value does not match. Note this is a separate rule from the generic rrule validation as it also applies toPartialSchedule
.
- A specific rule that targets
Also consider whether extending the below could be an approach to implementing any of the above:
See further documentation: