Throw error in case multiple fields / field options are matched
- Dominant language
- JavaScript
- Stars
- 36
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
### Please avoid duplicates
- [X] I checked [all open bugs](https://github.com/gr2m/github-project/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and none of them matched my problem.
### Reproducible test case
_No response_
### Please select the environment(s) that are relevant to your bug report
- [X] Browsers
- [X] Node
- [X] Deno
### Versions
1.3.1
### What happened?
In theory, a field configured in the `fields` constructor option can be matched to multiple project fields when using [the `matchFieldName` constructor option](https://github.com/gr2m/github-project/#constructor). The same is true for matching field options and the `matchFieldOptionValue` option.
I think right now the first match wins. But what we should do instead in both cases is to match all fields / field options respectively and verify that there is exactly one match. We throw an error if there is no match. We should also throw an error if there is more than one match
### Would you be interested in contributing a fix?
- [ ] yes
Contributor guide
Research direction
Start at the constructor handling matchFieldName and matchFieldOptionValue, then trace how matching currently returns the first result. Add coverage for zero, one, and multiple matches for both fields and field options; done means existing no-match errors remain and multiple matches now throw errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100