Skip to content

Docs: auto generate plugin schema reference #1770

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

Merged
merged 6 commits into from
May 8, 2025
Merged

Conversation

hugohaggmark
Copy link
Contributor

@hugohaggmark hugohaggmark commented May 7, 2025

What this PR does / why we need it:
This PR downloads the plugins-schema and generates markdown from the schema using jsonschema2mk.

LIMITATIONS
This approach unfortunately comes with a small (or big, depends how you feel) limitation and that is the linking from tables to headers are based on full paths of properties in the json schema. This means that the Docusaurus quick links and headers in the document show the full path to properties. I've tried different approaches by customizing different partials but I think we would need to hook into extensions to make the links unique because for example exposedcomponents appears twice in the document.

Before After
image image
image image

Which issue(s) this PR fixes:

Fixes #1651 , #1650

Special notes for your reviewer:
Passing runs here https://github.com/grafana/plugin-tools/actions/runs/14875523629/job/41772019976?pr=1770 and here https://github.com/grafana/plugin-tools/actions/runs/14875523629/job/41772019976?pr=1770 look for Markdown generation complete! in the Build documentation website (Dev Portal) step

Deployed the latest commit to DEV bucket so you can test

To test this PR:

  1. git clone this repo
  2. run npm ci
  3. run npm run docs:clear
  4. run DEV_PORTAL_ENV=dev npm run docs:build, shouldn't create any build errors ✅
  5. run npm run docs, should render a new Metadata (plugin.json) page that is in sync with plugin schema ✅

@hugohaggmark hugohaggmark added type/docs Changes only affect the documentation no-changelog Don't include in changelog and version calculations documentation labels May 7, 2025
Copy link
Contributor

github-actions bot commented May 7, 2025

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.

@hugohaggmark hugohaggmark marked this pull request as ready for review May 8, 2025 07:55
@hugohaggmark hugohaggmark requested review from a team as code owners May 8, 2025 07:55
@tolzhabayev tolzhabayev moved this from 📬 Triage to 🔬 In review in Plugins Platform / Grafana Community May 8, 2025
@tolzhabayev
Copy link
Collaborator

Docusaurus quick links and headers in the document show the full path to properties

I actually like it better this way 👍

Copy link
Collaborator

@tolzhabayev tolzhabayev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@hugohaggmark hugohaggmark merged commit 5821e91 into main May 8, 2025
20 checks passed
@github-project-automation github-project-automation bot moved this from 🔬 In review to 🚀 Shipped in Plugins Platform / Grafana Community May 8, 2025
@hugohaggmark hugohaggmark deleted the hugoh/auto-schema branch May 8, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Don't include in changelog and version calculations type/docs Changes only affect the documentation
Projects
Development

Successfully merging this pull request may close these issues.

Docs: Update the representation of the plugin.json schema docs
2 participants