From edd7afb1745525e64489b12f9c585771506b5edf Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Wed, 22 Jul 2015 19:31:02 +0200 Subject: [PATCH] docs: Add some notes about validation that are performed --- docs/api/core.rst | 6 ++++++ docs/api/models.rst | 2 +- docs/extensiondev.rst | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/api/core.rst b/docs/api/core.rst index 9134afed..5f1e406f 100644 --- a/docs/api/core.rst +++ b/docs/api/core.rst @@ -13,6 +13,12 @@ frontends and the backends. Don't forget that you will be accessing core as a Pykka actor. If you are only interested in being notified about changes in core see :class:`~mopidy.core.CoreListener`. +.. versionchanged:: 1.1 + All core API calls are now type checked. + +.. versionchanged:: 1.1 + All backend return values are now type checked. + .. autoclass:: mopidy.core.Core .. attribute:: tracklist diff --git a/docs/api/models.rst b/docs/api/models.rst index 07702555..27c7647f 100644 --- a/docs/api/models.rst +++ b/docs/api/models.rst @@ -5,7 +5,7 @@ These immutable data models are used for all data transfer within the Mopidy backends and between the backends and the MPD frontend. All fields are optional and immutable. In other words, they can only be set through the class -constructor during instance creation. +constructor during instance creation. Additionally fields are type checked. If you want to modify a model, use the :meth:`~mopidy.models.ImmutableObject.replace` method. It accepts keyword diff --git a/docs/extensiondev.rst b/docs/extensiondev.rst index 034e0b54..340a18da 100644 --- a/docs/extensiondev.rst +++ b/docs/extensiondev.rst @@ -437,6 +437,9 @@ When writing an extension, you should only use APIs documented at :ref:`api-ref`. Other parts of Mopidy, like :mod:`mopidy.internal`, may change at any time and are not something extensions should use. +Mopidy performs type checking to help catch extension bugs. This applies to +both to frontend calls into core and return values from backends. Additionally +model fields always get validated to further guard against bad data. Logging in extensions =====================