auth0-extensions/auth0-source-control-extension-tools

View on GitHub
src/auth0/schema.js

Summary

Maintainability
A
0 mins
Test Coverage
import * as handlers from './handlers';

const typesSchema = Object.entries(handlers).reduce((map, [ name, obj ]) => {
  map[name] = obj.schema; //eslint-disable-line
  return map;
}, {});

const excludeSchema = Object.entries(handlers).reduce((map, [ name, obj ]) => {
  if (obj.excludeSchema) {
    map[name] = obj.excludeSchema;
  }
  return map;
}, {});

export default {
  type: 'object',
  $schema: 'http://json-schema.org/draft-07/schema#',
  properties: {
    ...typesSchema,
    exclude: {
      type: 'object',
      properties: { ...excludeSchema },
      default: {}
    }
  },
  additionalProperties: false
};