PageSourceSearch

https://www.openpolicyagent.org/assets/js/b11b4ce9.d3caa67e.js

js openpolicyagent.org collected 2026-09-24 08:29:01 UTC 3,882 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkopa_website=self.webpackChunkopa_website||[]).push([[12784],{28453:(e,o,n)=>{n.d(o,{R:()=>t,x:()=>a});var r=n(96540);const i={},s=r.createContext(i);function t(e){const o=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(o):{...o,...e}}),[o,e])}function a(e){let o;return o=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:t(e.components),r.createElement(s.Provider,{value:o},e.children)}},83047:(e,o,n)=>{n.r(o),n.d(o,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>t,metadata:()=>r,toc:()=>l});const r=JSON.parse('{"id":"configuration/rego-version","title":"rego-version","description":"Rego Version | Regal","source":"@site/projects/regal/configuration/rego-version.md","sourceDirName":"configuration","slug":"/configuration/rego-version","permalink":"/projects/regal/configuration/rego-version","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":8,"frontMatter":{"sidebar_position":8,"sidebar_label":"Rego Version"},"sidebar":"autoSidebar","previous":{"title":"Project Roots","permalink":"/projects/regal/configuration/project-roots"},"next":{"title":"Custom Rules","permalink":"/projects/regal/custom-rules/"}}');var i=n(74848),s=n(28453);const t={sidebar_position:8,sidebar_label:"Rego Version"},a="Configuring Rego Version",c={},l=[];function d(e){const o={code:"code",h1:"h1",header:"header",p:"p",pre:"pre",...(0,s.R)(),...e.components},{Head:n}=o;return n||function(e,o){throw new Error("Expected "+(o?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Head",!0),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n,{children:(0,i.jsx)("title",{children:"Rego Version | Regal"})}),"\n",(0,i.jsx)(o.header,{children:(0,i.jsx)(o.h1,{id:"configuring-rego-version",children:"Configuring Rego Version"})}),"\n",(0,i.jsxs)(o.p,{children:["From OPA 1.0 and onwards, it is no longer necessary to include ",(0,i.jsx)(o.code,{children:"import rego.v1"})," in your policies in order to use\nkeywords like ",(0,i.jsx)(o.code,{children:"if"})," and ",(0,i.jsx)(o.code,{children:"contains"}),'. Since Regal works with with both 1.0+ policies and older versions of Rego, the linter\nwill first try to parse a policy as 1.0 and if that fails, parse using "v0" rules. This process isn\'t 100% foolproof,\nas some policies are valid in both versions. Additionally, parsing the same file multiple times adds some overhead that\ncan be skipped if the version is known beforehand. To help Regal determine (and enforce) the version of your policies,\nthe ',(0,i.jsx)(o.code,{children:"rego-version"})," attribute can be set in the ",(0,i.jsx)(o.code,{children:"project"})," configuration:"]}),"\n",(0,i.jsx)(o.pre,{children:(0,i.jsx)(o.code,{className:"language-yaml",children:"project:\n  # Rego version 1.0, set to 0 for pre-1.0 policies\n  rego-version: 1\n"})}),"\n",(0,i.jsx)(o.p,{children:"It is also possible to set the Rego version for individual project roots (see below for more information):"}),"\n",(0,i.jsx)(o.pre,{children:(0,i.jsx)(o.code,{className:"language-yaml",children:"project:\n  roots:\n  - path: lib/legacy\n    rego-version: 0\n  - path: main\n    rego-version: 1\n"})}),"\n",(0,i.jsxs)(o.p,{children:["Additionally, Regal will scan the project for any ",(0,i.jsx)(o.code,{children:".manifest"})," files, and use any ",(0,i.jsx)(o.code,{children:"rego_version"})," found in the manifest\nfor all policies under that directory."]}),"\n",(0,i.jsxs)(o.p,{children:["Note: the ",(0,i.jsx)(o.code,{children:"rego-version"})," attribute in the configuration file has precedence over ",(0,i.jsx)(o.code,{children:"rego_version"})," found in manifest files."]})]})}function p(e={}){const{wrapper:o}={...(0,s.R)(),...e.components};return o?(0,i.jsx)(o,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.