Skip to content

Commit

Permalink
Merge pull request #246 from DataDog/jacobotb/STAL-1373/version
Browse files Browse the repository at this point in the history
Add a schema-version field to the configuration file JSON Schema.
  • Loading branch information
jacobotb authored Mar 5, 2024
2 parents f805427 + f02f34d commit 97d161b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ All the rules can be found on the [Datadog documentation](https://docs.datadoghq
Example of YAML file

```yaml
schema-version: v1
rulesets:
- python-code-style
- python-best-practices
Expand Down Expand Up @@ -141,6 +142,7 @@ at the root directory of the repository. This is a YAML file with the following
Example of configuration:

```yaml
schema-version: v1
rulesets:
- python-code-style
- python-best-practices
Expand Down
5 changes: 5 additions & 0 deletions schema/examples/invalid/invalid-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
schema-version: v0
rulesets:
- python-best-practices
- java-best-practices
- python-security
1 change: 1 addition & 0 deletions schema/examples/valid/arguments.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
schema-version: v1
rulesets:
- lorem_ipsum:
ignore:
Expand Down
1 change: 1 addition & 0 deletions schema/examples/valid/complex1.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
schema-version: v1
rulesets:
- python-best-practices
- go-best-practices:
Expand Down
1 change: 1 addition & 0 deletions schema/examples/valid/complex2.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
schema-version: v1
rulesets:
- python-best-practices
- java-best-practices:
Expand Down
1 change: 1 addition & 0 deletions schema/examples/valid/extensions.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Additional fields not handled by the schema are accepted.
# (Additional field names do NOT have to start with x-. This is done for tests only.)
schema-version: v1
rulesets:
- java-best-practices:
x-ruleset-field: abc
Expand Down
5 changes: 5 additions & 0 deletions schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"schema-version": {
"type": "string",
"default": "v1",
"enum": ["v1"]
},
"rulesets": {
"type": "array",
"items": {
Expand Down

0 comments on commit 97d161b

Please sign in to comment.