diff --git a/news/656.feature.2 b/news/656.feature.2 new file mode 100644 index 000000000..d4a83bc74 --- /dev/null +++ b/news/656.feature.2 @@ -0,0 +1,5 @@ +Added the ``SCHEMA`` property parameter from :rfc:`9073#section-5.2` +(Event Publishing Extensions to iCalendar). It is defined in +``icalendar.param`` but not yet attached to a property class, since it +belongs on ``STRUCTURED-DATA``, which is not implemented yet. See +:issue:`656`. diff --git a/src/icalendar/param.py b/src/icalendar/param.py index bca86330f..035a80058 100644 --- a/src/icalendar/param.py +++ b/src/icalendar/param.py @@ -463,6 +463,21 @@ def _default() -> bool: - :attr:`Todo.attendees ` """ +SCHEMA = string_parameter( + "SCHEMA", + """Identify the schema that a STRUCTURED-DATA value conforms to. + +Conformance: + This property parameter is specified in :rfc:`9073#section-5.2`. + + This parameter SHOULD be specified on the STRUCTURED-DATA property. + Its value is a URI identifying the schema the structured data + follows. It supplements the media type given by the FMTTYPE + parameter, which alone may not be specific enough to interpret the + value (for example, which JSON-LD vocabulary a payload uses). +""", +) + SENT_BY = string_parameter( "SENT-BY", """Specify the calendar user that is acting on behalf of the calendar user specified by the property. @@ -858,6 +873,7 @@ def _del_GAP(prop): # noqa: N802 "RELATED", "ROLE", "RSVP", + "SCHEMA", "SENT_BY", "TZID", "VALUE", diff --git a/src/icalendar/tests/prop/test_schema_param.py b/src/icalendar/tests/prop/test_schema_param.py new file mode 100644 index 000000000..d6edb7657 --- /dev/null +++ b/src/icalendar/tests/prop/test_schema_param.py @@ -0,0 +1,22 @@ +r"""SCHEMA property parameter from :rfc:`9073`. + +:rfc:`9073#section-5.2` defines SCHEMA as a URI identifying the schema a +``STRUCTURED-DATA`` property value conforms to. ``STRUCTURED-DATA`` +(:rfc:`9073#section-6.6`) is not implemented in this codebase yet (see +:issue:`656`), so SCHEMA is only defined in :mod:`icalendar.param` for now +and not attached to any property class. It is exercised here directly +against ``Parameters``. +""" + +from icalendar.parser import Parameters + + +def test_schema_is_a_plain_parameter_not_yet_attached_to_a_property(): + """SCHEMA exists in icalendar.param but has no property class yet. + + STRUCTURED-DATA, the property SCHEMA belongs on, is not implemented + (see :issue:`656`), so SCHEMA is only reachable through raw + ``Parameters`` for now. + """ + params = Parameters(SCHEMA="https://schema.org/FlightReservation") + assert params["SCHEMA"] == "https://schema.org/FlightReservation"