lib.xp.examples.schema.updateMixin.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
// Update virtual mixin.
var result = schemaLib.updateSchema({
name: 'myapp:mytype',
type: 'MIXIN',
resource
});
log.info('Updated 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);