mdelobelle / metadatamenu

For data management enthusiasts : type and manage the metadata of your notes.
https://mdelobelle.github.io/metadatamenu
MIT License
478 stars 27 forks source link

Object fields override fields with the same name but different scope in parent classes #622

Open ChristinWhite opened 4 months ago

ChristinWhite commented 4 months ago

Issue

A fileClass can also override a field it has inherited from by defining it again.

While this is definitely the preferred behavior I did find a case where this may have an unintended effect when using objects.

  1. Create a parentFileClass and define myProperty and `someOtherProperty.
  2. Create a childFileClass and extend parentFileClass.
  3. Define a myObject field on childFileClass.
  4. Create a myProperty field and set its parent to myObject.
  5. Create a note with the fileClass set to childFileClass and invoke Metadata Menu.

You should see two fields (plus fileClass depending on settings): someOtherProperty and myObject.

Metadata Menu

Desired Outcome

I'd like to have happen is for Metadata Menu to treat myProperty and myObject.myProperty as two unique fields, not one that overrides the other.

Considerations

I suspect this is a bit of a pain since all of these properties are defined without explicitly hierarchy and are only treated like they have hierarchy by using the path property in the fileClass definition but you do have the logic to allow for two fields with the same name to coexist in a single fileClass, just not in inherited field.

To extend the earlier example, if I create another myProperty field on the root of childFileClass, Metadata Menu treats them as unique:

aFileClass

Environment

Obsidian 1.5.8 Metadata Menu 0.8.4