-
Notifications
You must be signed in to change notification settings - Fork 38
Description
See issue #97 for some prior discussion.
Consider a simple nested object which groups expense per hobby per person :
{
joe: {
skating: {time: 1000, money: 300},
cooking: {time: 9999, money: 999}
},
emily: {
running: {time: 300, money: 0}
}
}
We can consider these as 3 separate objects (unusual key definition comes from a derivation of a solution proposed in issue #97) :
interface Expense {
time: Number, money: Number
}
interface ExpBy_Hobby {
String: Expense
}
interface ExpBy_Hobby_Person {
String: ExpBy_Hobby
}
This describes the composition of the outer object for us. But we are missing some context otherwise provided by predefined key names.
The Expense object gains context for it's Number values by their well named counterpart keys. Non-predefined keys such as those seen on the ExpBy_Hobby & ExpBy_Hobby_Person objects can't provide such context.
I believe the documentation aspect of this specification would benefit greatly from the inclusion of a key definition syntax. Something like the following :
interface ExpBy_Hobby {
(hobby : String): Expense
}
def hobby {
desc: "The name of a hobby",
source: {type: "database", location: "hobby.id"}
}
For objects which gain all their meaning from the data they contain rather than their specific structure, and are otherwise difficult to discern, this is an essential documentation requirement for processes which might polymorphically handle them together.