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