-
Notifications
You must be signed in to change notification settings - Fork 31
POC: codegen from plugin.json #1563
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
Hello! 👋 This repository uses Auto for releasing packages using PR labels. ✨ This PR can be merged. It will not be considered when calculating future versions of the npm packages and will not appear in the changelogs. |
…-from-plugin-json
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.
Nice one @hugohaggmark, this looks like a good direction to me! 🚀
I guess one of the main benefits of an auto-generated type file for these metadata would be the following: (over just importing the plugin.json, which is what plugins are usually doing now)
- easier to discover available properties without looking at the JSON
- better type safety during development (now the code actually "knows" what includes are available)
Obviously not part of the POC, but if we take this further we could probably somehow "generalise" the generation methods, so it's easy to introduce a new type?
One thing that I haven't added to this POC yet is that we need to run the code generation before we build too, otherwise the build could potentially break if someone was using the code generated classes/functions/enums. |
…-from-plugin-json
my bad, has nothing to do with the generation of the generic schema docs |
What this PR does / why we need it:
Initial POC that illustrates how we could generate Typescript files from the
plugin.json
file.Kapture.2025-02-21.at.08.27.36.mp4
plugin.json
, for example For data source plugins, if the plugin supports alerting. Requires backend to be set to true. Those types of rules could be added hereplugin.json
have immediate impact on the backend that isWhich issue(s) this PR fixes:
Fixes #grafana/grafana#100898
Special notes for your reviewer: