-
Notifications
You must be signed in to change notification settings - Fork 39
fix: allow relations named 'schema' in zed validate #585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow relations named 'schema' in zed validate #585
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #585 +/- ##
==========================================
+ Coverage 39.28% 41.75% +2.47%
==========================================
Files 37 37
Lines 5448 4771 -677
==========================================
- Hits 2140 1992 -148
+ Misses 3063 2520 -543
- Partials 245 259 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ce63985 to
997a987
Compare
| wantErr: true, | ||
| }, | ||
| { | ||
| name: "schema with relation named schema", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could also have a test "schema with permission named schema", WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree - d857b9a
The zed validate command was incorrectly treating schema files containing relations named 'schema' as YAML validation files, causing YAML parsing errors. This happened because the code checked for 'schema:' anywhere in the file content rather than looking for it as a YAML key at the start of a line. This fix uses regex patterns to match YAML keys (schema:, schemaFile:, relationships:) only at the start of a line, avoiding false positives from relation definitions like 'relation schema: parent'. Fixes authzed#582
d857b9a to
f67c554
Compare
Summary
zed validateincorrectly treating schema files with relations named "schema" as YAML validation files, causing YAML parsing errorsschema:,schemaFile:,relationships:) only at the start of a line, avoiding false positives from relation definitions likerelation schema: parentFixes #582
Changes
internal/decode/decoder.goto use regex-based YAML key detection instead of simplestrings.ContainsTesting
zed validatefails with yaml error if schema contains relation named "schema" #582