@ibm-adw/skill-toolkit
Version:
Developing your own skills with IBM Automation Digital Worker Skill Toolkit
98 lines (96 loc) • 2.88 kB
JavaScript
/*
Licensed Materials - Property of IBM
5737-I23
Copyright IBM Corp. 2019. All Rights Reserved.
U.S. Government Users Restricted Rights:
Use, duplication or disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
*/
const generateSpec = (skillData, sample) => {
const spec = {
'name': skillData.name,
'description': skillData.description,
'category': skillData.category,
'level': skillData.level,
'config_schema': {}
};
if (sample) {
spec.config_schema = {
'type': 'object',
'properties': {
'useCountry': {
'type': 'boolean'
}
},
'if': {
'properties': {
'useCountry': {
'const': true
}
}
},
'then': {
'properties': {
'countryRetrievalMethod': {
'type': 'string',
'enum': [
'set',
'provide'
]
}
},
'if': {
'properties': {
'countryRetrievalMethod': {
'const': 'set'
}
}
},
'then': {
'properties': {
'useCountry': {
'type': 'boolean'
},
'countryRetrievalMethod': {
'type': 'string'
},
'countryId': {
'type': 'string'
}
},
'additionalProperties': false,
'required': [
'countryId'
]
},
'else': {
'properties': {
'useCountry': {
'type': 'boolean'
},
'countryRetrievalMethod': {
'type': 'string'
}
},
'additionalProperties': false
},
'required': [
'countryRetrievalMethod'
]
},
'else': {
'properties': {
'useCountry': {
'type': 'boolean'
}
},
'additionalProperties': false
},
'required': [
'useCountry'
]
};
}
return spec;
};
module.exports = { generateSpec };