Open zachberry opened 8 years ago
I ran into a similar experience while developing Adventure 2.0. Materia will only filter for certain qset attributes in each index of items
, with only the options
object able to contain non-standard attributes. DevMateria should definitely enforce that behavior, and possibly warn developers if they're not adhering to qset standards.
Technically, each item in qset.items
is handled in the Materia backend as a Materia/Widget_Question
object (fuel/packages/materia/classes/widget/question.php). When an instance is saved each item in its qset is translated into an instance of this object, at which point only the properties explicitly defined (materiaType, id, type, created_at, questions, answers, options, assets) are actually pulled out of the data coming in from the creator.
Would it make more sense to have DevMateria's server-side code error and pass a warning back if it encounters nonstandard question properties? Or would it make more sense if the creator core knows which properties are standard and doesn't even bother saving if it encounters nonstandard properties?
Added a solution for this to the new webpack version of DevMateria. Nonstandard qset item properties are stripped out before saving widget instance data, and warnings are passed back to the creator to be displayed as alerts.
With a demo.yaml example of:
Inside DevMateria the exact same object comes through. However in docker Materia the
label
,min
andmax
attributes are missing as they get filtered out. Putting them inside anoptions
object works. Is this expected behavior? If so, is it possible to mimic this in DevMateria?