canonical / canonical/checkbox

field 'requires', expression did not reference any resources too strict

Open
#746 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
52
Forks
81
Avg merge
2d 17h
Merged PRs (30d)
69

Description

### Enhancement Proposal

Say you have a resource `foo`:

```yaml
var: foo

var: bar
```

and a templated unit:

```yaml
unit: template
template-resource: foo
id: foo/{var}
requires:
"{var}" != "bar"
```

This will result in a validation error:
```
error: units/foo.pxu:5: job 'foo/FUNCTION', field 'requires', expression did not reference any resources
```

So you need to invent an expression to `and` with it. But it's a perfectly valid expression, IMO.

Contributor guide

Open the contributing guide

Research direction

Start by locating the validation logic for the `requires` field and reproduce the YAML example from the issue. Determine why an expression without a resource reference is rejected; done means the shown expression is accepted without an invented condition and a regression test covers the case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.