Draft
Conversation
…ll (#685) Generate JSON Schema from the Zod config schemas in `src/types/config.ts` and serve it via a backend `/schema/config` resource endpoint. Includes CI validation, a pre-commit hook to keep the schema in sync, and an ESLint guard to ensure config types remain self-contained. ### Schema generation - Export `GitHubDataSourceOptionsSchema` and `GitHubSecureJsonDataSchema` from `src/types/config.ts` - All Zod schema fields include `.describe()` calls so that human-readable descriptions (plan types, auth types, URLs, app IDs, tokens, keys) are propagated into the generated JSON Schema - Add `scripts/generate-config-schema.ts` — uses Zod v4's built-in `z.toJSONSchema()` to produce JSON Schema for both `jsonData` and `secureJsonData` - Outputs to `pkg/schema/config.json` (Go embed) - New npm script: `yarn generate:config-schema` ### Backend resource endpoint - `pkg/schema/config.go` — embeds the generated JSON schema via `//go:embed` - `pkg/plugin/instance.go` — `CallResource` intercepts `schema/config` path and returns the embedded schema; all other paths delegate to `SchemaDatasource` as before ```go if req.Path == "schema/config" { return sender.Send(&backend.CallResourceResponse{ Status: http.StatusOK, Headers: map[string][]string{"Content-Type": {"application/json"}}, Body: schema.ConfigSchemaJSON, }) } ``` ### Local import guard (ESLint) - Added an ESLint `no-restricted-imports` rule in `eslint.config.mjs` scoped to `src/types/config.ts` that blocks any relative imports (`'./*'`, `'../*'`), ensuring all config types remain self-contained in a single file - The CI workflow runs `yarn lint` against `src/types/config.ts` to enforce this guard ### CI workflow - `.github/workflows/check-config-schema.yml` — triggers on changes to `src/types/config.ts` or the generation script, lints config types for import violations, regenerates the schema, and fails if the committed version is stale ### Pre-commit hook - `scripts/pre-commit` — auto-regenerates and stages the schema file when `src/types/config.ts` is modified - Install: `cp scripts/pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit` <!-- START COPILOT CODING AGENT TIPS --> --- 📍 Connect Copilot coding agent with [Jira](https://gh.io/cca-jira-docs), [Azure Boards](https://gh.io/cca-azure-boards-docs) or [Linear](https://gh.io/cca-linear-docs) to delegate work to Copilot in one click without leaving your project management tool. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yesoreyeram <153843+yesoreyeram@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.