export function manifestV1Validation()

in tools/botskills/src/utils/validationUtils.ts [48:73]


export function manifestV1Validation(skillManifest: ISkillManifestV1, logger: ILogger): void {
    if (skillManifest.name === undefined || skillManifest.name === '') {
        logger.error(`Missing property 'name' of the manifest`);
    }

    if (skillManifest.id === undefined || skillManifest.id === '') {
        logger.error(`Missing property 'id' of the manifest`);
    } else if (skillManifest.id.match(/^\d|[^\w]/g) !== null) {
        logger.error(`The 'id' of the manifest contains some characters not allowed. Make sure the 'id' contains only letters, numbers and underscores, but doesn't start with number.`);
    }

    if (skillManifest.endpoint === undefined || skillManifest.endpoint === '') {
        logger.error(`Missing property 'endpoint' of the manifest`);
    } else if (skillManifest.endpoint.match(/^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$/g) === null) {
        logger.error(`The 'endpoint' property contains some characters not allowed.`);
    }

    if (skillManifest.authenticationConnections === undefined) {
        logger.error(`Missing property 'authenticationConnections' of the manifest`);
    }

    if (skillManifest.actions === undefined || skillManifest.actions[0] === undefined) {
        logger.error(`Missing property 'actions' of the manifest`);
    }

}