gnsi icon indicating copy to clipboard operation
gnsi copied to clipboard

Use of json for policy in authz without a protobuf alternative is obtuse

Open haussli opened this issue 2 years ago • 4 comments

Use of json for policy in authz without a protobuf alternative is obtuse. Why use json at all? And, why not offer a native protobuf alternative?

Use of JSON seems inconsistent and unnecessary. If the server wishes to use JSON internally, that is its prerogative, but should not be part of the API, or the user should have the option of using either.

My suggestion is that at the very least, a native protobuf version should be supported. This is not my call though; @tomek-US probably needs to decide this.

This is a split of issues/99; https://github.com/openconfig/gnsi/issues/99#issuecomment-1652080811

haussli avatar Dec 01 '23 15:12 haussli

Is it the case that we want to support 2 possible policy languages (json/proto) or to support 1, but have 'many' input options (with a proto -> json conversion cleanly supported in tooling)?

(at some point I thought: "proto3 text format is json" - though I admit to always looking at json with 'skepticism'...)

morrowc avatar Dec 01 '23 17:12 morrowc

IMHO, support 1 format - protobuf. json inside protobuf seems unnecessarily kinky. But, I do not think this is my decision and there is clearly some precedence here with the origin of authz.

haussli avatar Dec 01 '23 19:12 haussli

I think the discussion in #99 ended up with: "Hey, the gRPC base level code, for reaosns, expects JSON for this, so this service is just implementing that wish."

I dislike json for a ton of reasons, but.... I don't know that we get to change this implementation bit here. I suppose proposing a change in the gRPC base auth policy is a direction we could pursue.

morrowc avatar Dec 28 '24 19:12 morrowc

Ja; I understand that the server code has implemented json. I think that that is its sloppy problem. :) For consistency, it should convert protobuf to json, if it insists upon using json.

Some quick searching implies that there are ways to translate protobuf to json, though I do not know how well that works nor if it is specific to java nor if it works in the reverse. Worth investigating if there is interest in supporting proto instead of json. Just IMO.

haussli avatar Dec 30 '24 22:12 haussli