We are using Loopback as a standard RESTFul API.
I have a script that is used to auto-generate the model data based off of discovery of the database tables/structures.
I can generate the schema data for each table, but I don't know how to generate the relations property data for each table, which is important.
For example, this data from a servers/models/model-x.json
model schema:
"validations": [],
"relations": { <<<< definitely need this property to be filled
"members": {
"type": "hasMany",
"model": "user",
"foreignKey": "memberId"
}
},
"acls": [],
"methods": {}
so my question is - is it possible to generate this relations data from the tables and the foreign keys in tables? Or is this data too complex to autogenerate?