Skip to content
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

POC: RTK Query API Client for Plugins #87540

Closed
2 tasks
joshhunt opened this issue May 9, 2024 · 1 comment
Closed
2 tasks

POC: RTK Query API Client for Plugins #87540

joshhunt opened this issue May 9, 2024 · 1 comment
Assignees
Labels
internal for issues made by grafanistas

Comments

@joshhunt
Copy link
Contributor

joshhunt commented May 9, 2024

To solve #84494, we've settled on generating an RTK Query client and exposting that through @grafana/runtime. While this is relatively straight forward for 'legacy' APIs, new App Platform APIs may require more finesse to make them usable through code generation.

This POC should be timeboxed to 1-2 days to explore what the current state of OpenAPI -> RTK Query codegen is like for App Platform, and try to identify what more is needed to get it usable.

Tasks

@joshhunt
Copy link
Contributor Author

Explored generating RTK Query clients from App Platform OpenAPI specs in #87545

It's a good start, but there's a bunch of usability issues with what's generated that we would like to address:

  • Clients are required to pass in namespace each time - we expect grafana to populate this automatically from config
  • We want to provide a higher-level api on top of some of the arguments, such as labelSelector / fieldSelector
  • ‘Well known’ k8s annotations that have special meaning in grafana are typed too loosely (Record<string, string> instead of a specific interface)
  • Naming of endpoints and interfaces aren’t ideal. E.g. readNamespacedPlaylist instead of getPlaylist, or ComGithubGrafanaGrafanaPkgApisPlaylistV0Alpha1Playlist instead of Playlist

We're now discussing the problem and solutions in this design doc https://docs.google.com/document/d/1Dnbe42QKIhwsH-H6ZN6iImt0-f0-aGZvx22lKMVr1Pc/edit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal for issues made by grafanistas
Projects
Status: 🚀 Done
Development

No branches or pull requests

1 participant