src/Leevel/Router/OpenApiRouter.php
protected function parsePaths(OpenApi $openApi): array
    {
        if (\OpenApi\UNDEFINED === $openApi->externalDocs) {
            return [[], []];
        }

        $externalDocs = $openApi->externalDocs;

        if (!property_exists($externalDocs, 'leevels')) {
            return [[], []];
        }

        $leevels = $externalDocs->leevels;
        $tmps = is_array($leevels) ? $leevels : [$leevels];
        $basePaths = $groupPaths = [];

        foreach ($tmps as $key => $value) {
            // * 表示所有路径，group 为 true 的表示分组路径，其余为基础正则匹配路径
            // 分组路径将会在路由匹配成功后移除自身进行接下来的匹配
            $newKey = '*' !== $key ? '/'.trim($key, '/') : $key;

            if (!empty($value['middlewares'])) {
                $value['middlewares'] = $this->middlewareParser->handle(
                    normalize($value['middlewares'])
                );
            }

            if (isset($value['group']) && true === $value['group']) {
                unset($value['group']);
                $groupPaths[$newKey] = $value;
            } else {
                $newKey = '*' === $newKey ? '*' : $this->prepareRegexForWildcard($newKey.'/');
                $basePaths[$newKey] = $value;
            }
        }

        return [$basePaths, $groupPaths];
    }
protected function parsePaths(OpenApi $openApi): array
    {
        if (\OpenApi\UNDEFINED === $openApi->externalDocs) {
            return [[], []];
        }

        $externalDocs = $openApi->externalDocs;

        if (!property_exists($externalDocs, 'leevels')) {
            return [[], []];
        }

        $leevels = $externalDocs->leevels;
        $tmps = is_array($leevels) ? $leevels : [$leevels];
        $basePaths = $groupPaths = [];

        foreach ($tmps as $key => $value) {
            // * 表示所有路径，group 为 true 的表示分组路径，其余为基础正则匹配路径
            // 分组路径将会在路由匹配成功后移除自身进行接下来的匹配
            $newKey = '*' !== $key ? '/'.trim($key, '/') : $key;

            if (!empty($value['middlewares'])) {
                $value['middlewares'] = $this->middlewareParser->handle(
                    normalize($value['middlewares'])
                );
            }

            if (isset($value['group']) && true === $value['group']) {
                unset($value['group']);
                $groupPaths[$newKey] = $value;
            } else {
                $newKey = '*' === $newKey ? '*' : $this->prepareRegexForWildcard($newKey.'/');
                $basePaths[$newKey] = $value;
            }
        }

        return [$basePaths, $groupPaths];
    }
分析路径.

@param \OpenApi\Annotations\OpenApi $openApi

@return array