code: function validatePrimaryKey(descriptor) {
    const messages = []
    const fieldNames = (descriptor.fields || []).map(field => field.name)
    if (descriptor.primaryKey) {
      const primaryKey = descriptor.primaryKey
      if (isString(primaryKey)) {
        if (!fieldNames.includes(primaryKey)) {
          messages.push(`primary key ${primaryKey} must match schema field names`)
        }
      } else if (isArray(primaryKey)) {
        for (const pk of primaryKey) {
          if (!fieldNames.includes(pk)) {
            messages.push(`primary key ${pk} must match schema field names`)
          }
        }
      }
    }
    return messages
  }
docs: Internal