Important note: these modifications will not break the current APIs behaviors.
We simplify the way we create schemas, models and types. It works well for defining simple classes and structure. Example:
const mm = runtime.require('metamodel');
// defining a schema
mm.schema('Person', {
firstName: 'property',
address: 'property'
});
// overriding the generated model
mm.model('Person', {
firstName: 'string',
address: 'address'
});
// defining a new type
mm.type('address', {
street: 'string',
city: 'string'
});
// defining an enumeration type
mm.type('city', [
'Paris',
'Rennes'
]);
// model creation
mm.create();
// get the class
const Person = runtime.require('Person');
// create an instance
const person = new Person({
firstName: 'a name',
address: {
street: 'a street',
city: 'Rennes'
}
});
// use instance
person.address().street();
Important note: these modifications will not break the current APIs behaviors.
We simplify the way we create schemas, models and types. It works well for defining simple classes and structure. Example: