-
Notifications
You must be signed in to change notification settings - Fork 2
Add a cli tool to the Go version of foundation-sdk #595
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
base: main
Are you sure you want to change the base?
Conversation
Note: in addition to the changes introduced by this PR, the diff includes unreleased changes living in
grafana-foundation-sdk@next+cog-v0.0.x |
I'll wait to merge this until we can do a proper validation of resources, instead of the naive "json unmarshal" that we currently do. |
dd49dca
to
4d943f8
Compare
} | ||
|
||
func unmarshalQueryStrict(input []byte, hint string) (validableResource, error) { | ||
query, err := cog.StrictUnmarshalDataquery(input, hint) |
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.
StrictUnmarshalDataquery
should be UnmarshalJSONStrict
like dashboards and panels to follow the same pattern. It could be fixed in other PR.
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.
Good catch! I'll fix that 👍
Let's wait to merge this: I feel we need to properly think about how to expose CLI capabilities (and if it makes sense at all) |
This PR introduces the code for a
grafana-foundation-sdk
CLI tool with - for now - two main capabilities:1: by resources, I mean dashboards, panels and queries
2: the validation process is currently quite limited, as it only unmarshals a JSON input into structs. It can be improved later on, for example by implementing proper
Validate()
functions on the objects generated by cogNote: in its current form, this tool will be provided for each version of the Go SDK. A possible "parent" tool that could serve as unified entry point for any language/any version of the SDK could be introduced later.
ToDo:
grafana-foundation-sdk
to build and publish an artifact with that CLI tool.queries can't support "strict validation" mode yet, cog's runtime in the SDK needs some change for that