-
Notifications
You must be signed in to change notification settings - Fork 68
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
Chore: Move jsonitere outside of the internal package #837
Conversation
In the root doesn't feel optimal. Since data/frame_json.go is the only one using it maybe data/util/jsonitere or data/jsonitere. Depending on how/where you want to use it, maybe backend/utils/jsonitere or backend/jsonitere (but this one feels a bit misplaced) Nit. Personally I find it hard to read the package name jsonitere and as long it's been internal doesn't matter that much, but making it public now I think we should take the opportunity and change it if there's consensus. |
We are gonna use it as a wrapper for "github.com/json-iterator/go" package. And then we use it everywhere we use Regarding the naming, do you have any suggestions? cc: @kylebrandt |
The library suggest using I would go with Apart from that, I'd suggest to add some basic test coverage, any package exposed should have that. |
I'll make the necessary changes. Testing makes sense. |
I like backend utils, since this is for parsing json, it doesn't have to be used with the data layer (even though that is practically when we would use it generally). |
@marefr @andresmgot I made the updates. Please check them. I am not sure what else I can test since this is just a wrapper. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is good enough to go, I have a couple of suggestions but not feeling strongly about those
data/frame_json.go
Outdated
@@ -17,7 +17,7 @@ import ( | |||
jsoniter "github.com/json-iterator/go" | |||
"github.com/mattetti/filebuffer" | |||
|
|||
"github.com/grafana/grafana-plugin-sdk-go/internal/jsonitere" | |||
jiter "github.com/grafana/grafana-plugin-sdk-go/data/utils/jsoniter" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sdkjsoniter
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes sense. I'll do the change.
const ( | ||
InvalidValue = j.InvalidValue | ||
StringValue = j.StringValue | ||
NumberValue = j.NumberValue | ||
NilValue = j.NilValue | ||
BoolValue = j.BoolValue | ||
ArrayValue = j.ArrayValue | ||
ObjectValue = j.ObjectValue | ||
) | ||
|
||
var ( | ||
ConfigDefault = j.ConfigDefault | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you are mapping some of the things exported in the original package, maybe we should go over the rest of things that frame_json.go
is using so it doesn't use directly github.com/json-iterator/go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that. But for this PR it'll make things much more complicated. Maybe I'll do it in a separate PR.
What this PR does / why we need it:
With the current state we cannot use
jsonitere
package ingrafana/grafana
or in any project.Please advise otherwise if you think the root is not a good place for that package.