Rewrite unique_ids.check() and enable for v3 - #220
Conversation
ronja-koistinen
commented
Jul 29, 2026
- Simplify the code and make it more idiomatic Python
- Call it from validator.py so it runs for both v3 and v4
* Simplify the code and make it more idiomatic Python * Call it from validator.py so it runs for both v3 and v4
|
Right now this checks that all |
| if depth > MAX_DEPTH: | ||
| raise MaxDepthExceeded(f"Max search depth {MAX_DEPTH} exceeded at {node}") | ||
| for key, value in filter(lambda x: x[0] not in IGNORE, node.items()): | ||
| if key == "id": |
There was a problem hiding this comment.
I wonder if this should check for "@id" as well?
There was a problem hiding this comment.
Yes I think that would be useful. Its only a v3 validator not a v2 but you can have v2 image @ids in the manifest.
| else: | ||
| result.passed = True | ||
|
|
||
| duplicate_ids = check(instance) |
There was a problem hiding this comment.
Did you mean to remove the check from v4? I think it should be in both v3 and v4
There was a problem hiding this comment.
I moved the callsite to validator.py, a place that at first glance looked version-independent, because the check doesn't rely on any behaviour of any particular version. Did I make a mistake?
| "source", | ||
| "body", | ||
| "scope", | ||
| } |
| if depth > MAX_DEPTH: | ||
| raise MaxDepthExceeded(f"Max search depth {MAX_DEPTH} exceeded at {node}") | ||
| for key, value in filter(lambda x: x[0] not in IGNORE, node.items()): | ||
| if key == "id": |
There was a problem hiding this comment.
Yes I think that would be useful. Its only a v3 validator not a v2 but you can have v2 image @ids in the manifest.
|
I added |