lib.xp.examples.schema.createMixin.js Maven / Gradle / Ivy
var schemaLib = require('/lib/xp/schema');
var assert = require('/lib/xp/testing');
/* global log*/
let resource = `
Virtual Mixin
Mixin description
`;
// BEGIN
// Create virtual mixin.
var result = schemaLib.createSchema({
name: 'myapp:mytype',
type: 'MIXIN',
resource
});
log.info('Created mixin: ' + result.name);
// END
assert.assertJsonEquals({
name: 'myapp:mytype',
displayName: 'Virtual Mixin',
displayNameI18nKey: '',
description: 'Mixin description',
descriptionI18nKey: '',
createdTime: '2021-09-25T10:00:00Z',
modifiedTime: '2021-09-25T10:00:00Z',
resource: '\n' +
' \n ' +
' Virtual Mixin \n' +
' Mixin description \n' +
' \n' +
' ',
type: 'MIXIN',
form: [
{
'formItemType': 'Input',
'name': 'text2',
'label': 'Text 2',
'maximize': true,
'inputType': 'TextLine',
'occurrences': {
'maximum': 1,
'minimum': 0
},
'config': {}
}, {
formItemType: 'InlineMixin',
name: 'myapplication:inline'
}
],
}, result);