Skip to content

Validate merged comment-ops config against a JSON Schema#539

Merged
timja merged 2 commits into
mainfrom
copilot/validate-config-schema
Jul 25, 2026
Merged

Validate merged comment-ops config against a JSON Schema#539
timja merged 2 commits into
mainfrom
copilot/validate-config-schema

Conversation

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

The app loaded .github/comment-ops.yml and merged it with defaults, but never verified that the resulting config matched the supported shape. This adds runtime schema validation using a validator that supports the current JSON Schema spec and rejects malformed command config early.

  • Schema validation

    • add a JSON Schema 2020-12 definition for the supported commands structure
    • validate booleans for toggle-only commands and string arrays for allowedLabels
    • reject unknown properties within command blocks to keep config shape explicit
  • Router integration

    • validate the merged config returned by octokit.config.get(...) before command execution
    • keep validation at the existing config boundary so org/repo/default merging is checked as one final object
  • Focused coverage

    • add tests for:
      • default config
      • valid label config with allowedLabels
      • invalid boolean types
      • invalid allowedLabels types
      • unexpected extra properties
  • Example

    const { config } = await octokit.config.get({
      owner,
      repo,
      path: ".github/comment-ops.yml",
      defaults: (configs) => deepmerge.all([defaultConfig, ...configs]),
    });
    
    validateConfig(config);

Copilot AI linked an issue Jul 25, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Validate config schema for JSON schema compliance Validate merged comment-ops config against a JSON Schema Jul 25, 2026
Copilot finished work on behalf of timja July 25, 2026 08:00
Copilot AI requested a review from timja July 25, 2026 08:00
@timja timja added the enhancement New feature or request label Jul 25, 2026
@timja
timja marked this pull request as ready for review July 25, 2026 10:27
@timja
timja enabled auto-merge (squash) July 25, 2026 10:27
@timja
timja merged commit d977739 into main Jul 25, 2026
4 checks passed
@timja
timja deleted the copilot/validate-config-schema branch July 25, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate config schema

2 participants