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

Improve handling of numeric values in AST and storage #473

Closed
jc-m opened this issue Oct 9, 2017 · 1 comment
Closed

Improve handling of numeric values in AST and storage #473

jc-m opened this issue Oct 9, 2017 · 1 comment

Comments

@jc-m
Copy link
Contributor

jc-m commented Oct 9, 2017

In the ast, InterfaceToValue() claims to "converts a native Go value x to a Value" however, json.Number is not a Go value, and this prevents using something like fathil/structs to store objects when using opa as a library.

@tsandall tsandall assigned tsandall and unassigned tsandall Oct 9, 2017
@tsandall
Copy link
Member

tsandall commented Oct 9, 2017

OPA should handle different numeric types gracefully. Currently, OPA will barf if its given float/int types instead of json.Number. OPA should ingest float/int types wherever possible. If ingestion would cause problems, OPA should better error messages and include clear documentation about how callers can supply json.Number values.

@tsandall tsandall changed the title Add support for int types Improve handling of numeric values in AST and storage Oct 10, 2017
tsandall added a commit to tsandall/opa that referenced this issue Nov 28, 2017
In the past, callers have tried to load JSON data without using
json.Number. These changes should make it easier for callers to supply
native Go values as int64, float64, and int will be converted
automatically. Also, add a case for map[string]string which is used
inside of projects like Istio to represent generic key/value
collections.

Fixes open-policy-agent#473
tsandall added a commit that referenced this issue Nov 28, 2017
In the past, callers have tried to load JSON data without using
json.Number. These changes should make it easier for callers to supply
native Go values as int64, float64, and int will be converted
automatically. Also, add a case for map[string]string which is used
inside of projects like Istio to represent generic key/value
collections.

Fixes #473
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

2 participants