Skip to content

[bug] ObjectModel PluginManifest._data initialized as plain dict — never populated by deserialization #21

@timschneider

Description

@timschneider

PluginManifest.__init__ initializes self._data = {}. Since _update_from_json only handles ModelObject, ModelCollection, ModelDictionary, and list for protected attributes, _data is silently skipped during deserialization.

# plugin_manifest.py
self._data = {}  # ← plain dict, invisible to _update_from_json

As a result, Plugin.data always returns {} after get_object_model(), even when the JSON payload contains plugin data.

Suggested fix:

Change the initialization to ModelDictionary(False):

self._data = ModelDictionary(False)

This makes is_model_object(_data) return True, so _update_from_json will call update_from_json() on it and populate the data correctly.


https://github.com/Duet3D/dsf-python/blob/a9e0de43ed93cafa3610f06091e0bf0bbf8eb925/src/dsf/object_model/plugins/plugin_manifest.py#L14C9-L14C24

import re
from typing import List

from .sbc_permissions import SbcPermissions
from ..model_object import ModelObject
from ..model_dictionary import ModelDictionary


class PluginManifest(ModelObject):
    """Information about a third-party plugin"""

    def __init__(self):
        super(PluginManifest, self).__init__()
        self._author = None
        self._data = ModelDictionary(False)
        self._dwc_dependencies = []
        self._dwc_version = None
        self._homepage = None
        self._id = None
        self._license = "LGPL-3.0-or-later"
        self._name = None
        self._rrf_version = None
        self._sbc_auto_restart = False
        self._sbc_config_files = []
        self._sbc_dsf_version = None
        self._sbc_executable = None
        self._sbc_executable_arguments = []
        self._sbc_extra_executables = []
        self._sbc_output_redirected = None
        self._sbc_package_dependencies = []
        self._sbc_permissions = []  # Use a list instead of a set to keep insertion order (useful for json serialising)
        self._sbc_plugin_dependencies = []
        self._sbc_python_dependencies = []
        self._sbc_required = None
        self._tags = []
        self._version = "1.0.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions