Skip to content

Commit

Permalink
Forbid top-level extra keys (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
daavoo authored Jun 28, 2022
1 parent 71d8274 commit 9152c89
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dvc.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ stages:
cmd: ./gen.py > schema.json
deps:
- path: gen.py
md5: e49f62cdbd3ca8648a29c716ad19f14c
size: 5618
md5: f288541652b71695ac41ffb3010c04e0
size: 5621
outs:
- path: schema.json
md5: 6dc7651926e6c6a7c035b26e011d4e72
size: 11762
md5: 0e60e20d728b734a770fc62532271c4f
size: 11671
check_updated:
cmd: ./gen.py | diff schema.json -
deps:
- path: schema.json
md5: 6dc7651926e6c6a7c035b26e011d4e72
size: 11762
md5: 0e60e20d728b734a770fc62532271c4f
size: 11671
tests:
cmd: pytest -vv tests.py
deps:
- path: schema.json
md5: 6dc7651926e6c6a7c035b26e011d4e72
size: 11762
md5: 0e60e20d728b734a770fc62532271c4f
size: 11671
9 changes: 9 additions & 0 deletions examples/invalid/toplevel.extra.dvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extra: foo

stages:
stage1:
cmd: python train.py input output
deps:
- input
outs:
- output
1 change: 1 addition & 0 deletions gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class DvcYamlModel(BaseModel):

class Config:
title = "dvc.yaml"
extra = "forbid"

@staticmethod
def schema_extra(schema: Dict[str, Any], _) -> None:
Expand Down
1 change: 1 addition & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
}
}
},
"additionalProperties": false,
"definitions": {
"VarDecl": {
"title": "VarDecl",
Expand Down

0 comments on commit 9152c89

Please sign in to comment.