-
Notifications
You must be signed in to change notification settings - Fork 327
feat: support relation deprecation #2465
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
base: main
Are you sure you want to change the base?
feat: support relation deprecation #2465
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2465 +/- ##
==========================================
- Coverage 77.39% 77.39% -0.00%
==========================================
Files 416 416
Lines 50888 51023 +135
==========================================
+ Hits 39381 39482 +101
- Misses 9024 9048 +24
- Partials 2483 2493 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
842e884
to
b7e49c0
Compare
Signed-off-by: Kartikay <[email protected]>
77f5d67
to
cba3045
Compare
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.
Left a couple of comments.
I'm also wondering about the behavior of these annotations more generally - what happens if you put this annotation on a permission instead of a relation? Should it have an effect?
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.
A general note on the approach: to the degree that we can, we want to avoid breaking folks' existing schemas. See what we did with expiration
for an example of how we've worked around it with use
directives - if we add this feature, it'll be with one of those use
directives.
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 also need the composableschemadsl
package to be updated accordingly.
pkg/schemadsl/lexer/lex_def.go
Outdated
if l.acceptString("deprecated") { | ||
l.emit(TokenTypeKeyword) |
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.
This isn't something that should live in the lexer - it should live in the parser.
Or at least my sense is that an @
should be a marker, and then the token after it should be a keyword, rather than the entire thing being marked as a keyword.
It's also going to relate to what I said above about the use
directive.
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.
it might be worth looking at #202, which implemented generic decorators (but we didn't have a use case so never merged it)
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.
reworked the approach a little bit including the use directive just like how it was done for expiration feature, adding more comments for better review.
Signed-off-by: Kartikay <[email protected]>
Signed-off-by: Kartikay <[email protected]>
c9af820
to
4ad2bdc
Compare
I wonder if we want to allow the deprecated annotation on each subject type vs the relation as a whole; I could see benefits to either. @ecordell thoughts? |
we may also support something like
which can include both subjects and relations, this way deprecation can be more flexible and granular also including the comments about the deprecation. Any thoughts @josephschorr @ecordell @tstirrat15 ? |
Related: #2396
This PR adds support for relation-level deprecation in schemas.
@deprecated(...)
directive to indicate they are deprecated.--enable-experimental-relationship-deprecation
along with use directive.Example:
Note
Each relation has an enum
DeprecationType
assigned to them, if unspecified it defaults toDEPRECATED_TYPE_UNSPECIFIED