-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
RFC: New future.strict
import to prepare for future keywords being on by default
#6247
Comments
future.strict
import to prepare for future keywords being on by default future.strict
import to prepare for future keywords being on by default
I'm in favor! To further accelerate the switch, it would be helpful if these constructs ( Nit, but I take it |
In the future, when it's time for OPA We could of course push this decision on the future, by letting |
This is a good point! I suppose what we're saying is that if you import |
Strict-mode enforces 5 checks:
Letting the |
Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
* duplicate imports * `input` & `data` shadowing * deprecated imports Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
* duplicate imports * `input` & `data` shadowing * deprecated imports Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
* duplicate imports * `input` & `data` shadowing * deprecated imports Fixes: open-policy-agent#6247 Signed-off-by: Johan Fylling <[email protected]>
Adding `future.compat` import for enforcing strict-mode checks and additional `1.0` behavior for the module. Fixes: #6247 Signed-off-by: Johan Fylling <[email protected]>
The
if
,contains
,every
, andin
keywords currently require opt-in to prevent them from breaking existing policies. Eventually we would like to have those keywords be on by default. To get there, we could introduce a newfuture.strict
import that by default:in
andevery
if
andcontains
Requiring
if
andcontains
solves the ambiguity between rules likea.b { true }
vs.a.b.c { true }
. Going forward it would mean:contains
keyword to convert the value into a set.It'll take some time to adjust but this is conceptually simpler than what we have today with so-called complete rules, partial sets, partial objects, and differences in semantics depending on how many dots there are in the name (e.g., today
x.y { ... }
declares a set at at pathdata.x
andx.y.z { ... }
declares a key/value at pathdata.x.y.z
.)It would be nice if there was a way for users to easily migrate, e.g,.
opa fmt --enable-strict ...
which would rewrite the policy to be compatible (and include the import).Once
future.strict
has been released for a while and we see sufficient usage, we could make the switch. One thing that would be good to know is the minimum version required to support these keywords.I'd love to get comments/feedback on this plan.
The text was updated successfully, but these errors were encountered: