public function fields($basePath = '')
    {
        $fields = [];
        foreach ($this->names() as $name) {
            $fields[$name] = null;
        }
        $names = Set::expand($fields);
        if ($basePath) {
            $parts = explode('.', $basePath);
            foreach ($parts as $part) {
                if (!isset($names[$part])) {
                    return [];
                }
                $names = $names[$part];
            }
        }
        return array_keys($names);
    }