How to use the sockethub-schemas.platform function in sockethub-schemas

To help you get started, we’ve selected a few sockethub-schemas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sockethub / sockethub / src / bootstrap / platforms.js View on Github external
for (let moduleName of moduleList) {
    if (rx.test(moduleName)) {
      // found a sockethub platform
      const platformName = moduleName.replace(rx, '');
      log('registering ' + platformName + ' platform');

      if (platformIsAccepted(platformName)) {
        // try to load platform
        const P = require(moduleName);
        const p = new P();
        const packageJson = require(`./../../node_modules/${moduleName}/package.json`);
        let types = [];

        // validate schema property
        if (! tv4.validate(p.schema, schemas.platform)) {
          throw new Error(
            `${platformName} platform schema failed to validate: ${tv4.error.message}`);
        } else if (typeof p.config !== 'object') {
          throw new Error(
            `${platformName} platform must have a config property that is an object.`);
        } else if (p.schema.credentials) {
          // register the platforms credentials schema
          types.push('credentials');
          tv4.addSchema(`http://sockethub.org/schemas/v0/context/${platformName}/credentials`,
                        p.schema.credentials);
        }

        tv4.addSchema(`http://sockethub.org/schemas/v0/context/${platformName}/messages`,
                      p.schema.messages);

        if (platformListsSupportedTypes(p)) {

sockethub-schemas

JSON schema files for validating Sockethub Activity Streams

LGPL-3.0
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis