-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Handle invalid YAML files containing unterminated strings (#1970)
The old parser produced an error for these whereas the new parser just ignores them. Also renames the testdata directory from `protoyaml` to `parser` for consistency. Signed-off-by: Charith Ellawala <charith@cerbos.dev> Signed-off-by: Charith Ellawala <charith@cerbos.dev>
- Loading branch information
Showing
44 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"description": "Invalid YAML file with unterminated string", | ||
"wantErrors": [ | ||
{ | ||
"kind": "KIND_PARSE_ERROR", | ||
"position": { | ||
"line": 1, | ||
"column": 1, | ||
"path": "$" | ||
}, | ||
"message": "invalid document: contents are not valid YAML or JSON" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"This is not valid YAML |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"description": "YAML file with unterminated string", | ||
"wantErrors": [ | ||
{ | ||
"kind": "KIND_PARSE_ERROR", | ||
"position": { | ||
"line": 4, | ||
"column": 11, | ||
"path": "$.variables" | ||
}, | ||
"message": "expected map got Null" | ||
} | ||
], | ||
"want": [ | ||
{ | ||
"message": { | ||
"apiVersion": "api.cerbos.dev/v1" | ||
}, | ||
"errors": [ | ||
{ | ||
"kind": "KIND_PARSE_ERROR", | ||
"position": { | ||
"line": 4, | ||
"column": 11, | ||
"path": "$.variables" | ||
}, | ||
"message": "expected map got Null" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# yaml-language-server: $schema=../../../../../schema/jsonschema/cerbos/policy/v1/Policy.schema.json | ||
--- | ||
apiVersion: api.cerbos.dev/v1 | ||
variables: | ||
"x: y | ||
resourcePolicy: | ||
version: default | ||
resource: leave_request | ||
rules: | ||
- actions: ['*'] | ||
effect: EFFECT_ALLOW | ||
roles: | ||
- admin | ||
name: wildcard |