Open KommuSoft opened 4 years ago
@KommuSoft The spec says:
;
; The following is REQUIRED if the component
; appears in an iCalendar object that doesn't
; specify the "METHOD" property; otherwise, it
; is OPTIONAL; in any case, it MUST NOT occur
; more than once.
;
dtstart /
Well I'm wondering if we can do some type system magic to make it impossible to use Nothing
in case the Method
is not specified, making it thus impossible to have an invalid calendar (or at least for this specific field).
@KommuSoft Having recently implemented, I now believe you can't do this at the type-level: https://github.com/NorfairKing/ical
That's what Validity
is for.
If I generate a calendar with an event, that has no
DTSTART
(so withveDTStart=Nothing
), I obtain the following calendar:But when validating this, with https://icalendar.org/validator.html#results this reports the error that:
It looks like
DTSTART
is thus mandatory, and thus perhaps its type should be aDTStart
instead of aMaybe DTStart
.