Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$query, $extension 和 $children 的属性不能重名但又没有正确的错误提示 #89

Open
noobnooc opened this issue Feb 6, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@noobnooc
Copy link
Member

noobnooc commented Feb 6, 2020

Makeflow task reference: https://staging.makeflow.io/app/?_redirect=/task/3223
比如有以下路由定义:

efforts: {
    $exact: true,
    $children: {
      team: {      // 1: $children 里的 team
        $exact: true,
        $query: {
          range: true,
          team: true,  // 2: $query 里的 team
        },
      },
    },
    $extension: {
      range: undefined as string | undefined,
      team: undefined as Team | undefined,   // 3: $extension 里的 team
    },
}

其中 `1` `2` `3` 中的 team 是冲突的,但 Boring Router 本身并不会报错或报错信息混乱从而导致一些看起来难以排查的 bug。可考虑改成命名互不冲突或者在定义时就报出提示信息明确的错误。

@vilicvane
Copy link
Member

vilicvane commented Feb 6, 2020

这里好像 1 和 3 冲突,2 在这种情况下(1 的 $match 不是正则的时候)应该不冲突(实际实现可能有问题)。如果 1 的 $match 是正则,2 就也和 1,3冲突。

试试看 query 没有 team 的情况下,上面的 $params 里类型和运行时有没有 team 属性?

@noobnooc
Copy link
Member Author

noobnooc commented Feb 6, 2020

试了下,$params 在运行时和类型上都没有team 属性

@makeflow-bot makeflow-bot added the bug Something isn't working label May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants