code: function schemaType(schema) {
      let type;
      if (schema.hasOwnProperty('type')) {
          type = schema.type;
      } else if (schema.hasOwnProperty('properties') || schema.hasOwnProperty('allOf') || schema.hasOwnProperty('additionalProperties')) {
          type = 'object';
      } else if (schema.hasOwnProperty('items')) {
          type = 'array';
      }
  
      switch (type) {
          case 'array':
          case 'boolean':
          case 'file':
          case 'integer':
          case 'number':
          case 'object':
          case 'string':
              return type;
      }
  }
docs: Detect the schema type.
  @param {Object} schema
  @returns {string,undefined}