fix: allow relations named 'schema' in zed validate#585
Merged
miparnisari merged 2 commits intoauthzed:mainfrom Dec 9, 2025
Merged
fix: allow relations named 'schema' in zed validate#585miparnisari merged 2 commits intoauthzed:mainfrom
miparnisari merged 2 commits intoauthzed:mainfrom
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
miparnisari
reviewed
Dec 8, 2025
| wantErr: true, | ||
| }, | ||
| { | ||
| name: "schema with relation named schema", |
Contributor
There was a problem hiding this comment.
we could also have a test "schema with permission named schema", WDYT?
miparnisari
previously approved these changes
Dec 8, 2025
miparnisari
approved these changes
Dec 9, 2025
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
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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