This is a simple and backward-compatible improvement to the Space.Struct fields api.
Now you can define a fields method on the prototype that returns the EJSON / Match structure required for the struct. The cool thing is, that this now supports inheritance, so you can use whatever the super class returns for it's prototype method and extend that.
It stays backward-compatible because Space.Struct::fields returns the statically defined fields property on the current class by default (which was the previous api contract).
This is a simple and backward-compatible improvement to the
Space.Struct
fields api. Now you can define afields
method on the prototype that returns the EJSON / Match structure required for the struct. The cool thing is, that this now supports inheritance, so you can use whatever the super class returns for it's prototype method and extend that.It stays backward-compatible because
Space.Struct::fields
returns the statically definedfields
property on the current class by default (which was the previous api contract).