Skip to content
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

Bug in parsing of "request" and "data" rules #202

Closed
tsandall opened this issue Dec 21, 2016 · 0 comments
Closed

Bug in parsing of "request" and "data" rules #202

tsandall opened this issue Dec 21, 2016 · 0 comments

Comments

@tsandall
Copy link
Member

tsandall commented Dec 21, 2016

Rules with the name "request" and "data" may be defined for test purposes to mock out the normal request/data documents. The parser currently does not recognize expressions of the form "request = term" or "data = term" as rules.

ParseRuleFromBody should be updated to handle the "request" and "data" refs.

Example:

package ex

request = {"foo":1,"bar":2}

or

package ex

data = {"foo": 1, "data": 2}

A simple workaround is to declare the rule body, e.g., request = {"foo": 1} :- true.

@tsandall tsandall changed the title Bug in parsing of "request" Bug in parsing of "request" and "data" rules Dec 21, 2016
tsandall added a commit to tsandall/opa that referenced this issue Dec 21, 2016
With the request document changes, the "request" var in "request = <term>"
is transformed into a ref. As a result, the body to rule conversion was not
working (and returning an error).

Fixes open-policy-agent#202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant