You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently OPA supports YAML encoded input documents via the command line but not as inputs to queries. It would be nice to be able to POST YAML inputs. The server has two helper functions that read the input from the request: readInputV0 and readInputV1. These functions should be extended to check the request header content-type (defaulting to util.Unmarshal if no header is supplied.)
The text was updated successfully, but these errors were encountered:
I thought this would be useful and worked on a fix, but it turns out the changes needed are deeper than originally thought (although very doable).
The code today is very much hardwired to JSON everywhere. For example, although my changes allow input documents in YAML, the response comes back in JSON, which I am sure is not what a potential client would expect.
In order to send responses back in YAML (including explain, pretty, diag, etc) we would need to change v1DataPost() to either:
Produce everything in YAML and we write to yaml to response.writer
At the very end check if Content-Type is yaml and if yes, convert from JSON to yaml and write to response.writer
Others?
thanks
PS: I believe another discussion to have is whether we would want to support additional mime-types in the future
I'm less inclined to support YAML responses for the time being. I think that sending JSON responses is acceptable. Supporting YAML inputs is a nice-to-have when the policy input is a configuration file (e.g., a Kubernetes manifest.)
Currently OPA supports YAML encoded input documents via the command line but not as inputs to queries. It would be nice to be able to POST YAML inputs. The server has two helper functions that read the input from the request:
readInputV0
andreadInputV1
. These functions should be extended to check the request header content-type (defaulting toutil.Unmarshal
if no header is supplied.)The text was updated successfully, but these errors were encountered: