Skip to content

[FEATURE] Add .v8rrc.yml for v8r schema validation configuration #120

@WilliamBerryiii

Description

@WilliamBerryiii

IMPORTANT: Before submitting, please remove all sensitive data, secrets, tokens, or confidential information. Ensure you've redacted any NDA-covered information, IP addresses, resource names, or security-related details that shouldn't be publicly disclosed.

Problem Statement

v8r (JSON/YAML schema validator) is not currently enabled in MegaLinter and has no configuration file. This means:

  • YAML/JSON files are not validated against their schemas
  • No custom schema mappings for project-specific files
  • No ignore patterns for files without schemas (false positives)
  • Direct tool usage requires manual configuration

Proposed Solution

Create .v8rrc.yml configuration file at repository root:

---
catalogs:
  - https://www.schemastore.org/api/json/catalog.json

customCatalog:
  schemas:
    - name: Docker Compose
      fileMatch:
        - "**/docker-compose.yml"
        - "**/docker-compose.yaml"
        - "**/compose.yml"
        - "**/compose.yaml"
      url: https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json
    - name: MegaLinter
      fileMatch:
        - ".mega-linter.yml"
        - ".mega-linter.yaml"
      url: https://raw.githubusercontent.com/oxsecurity/megalinter/main/megalinter/descriptors/schemas/megalinter-configuration.jsonschema.json

ignoreUnknownFiles: true

Create .v8rignore file:

**/schemas/**
**/*schema*.json
learning/**/*.yaml
learning/**/*.yml
.copilot-tracking/**
**/*.tfvars
node_modules/**
.terraform/**
**/testdata/**
package-lock.json
**/*.bicepparam
dist/**
build/**

Enable v8r in MegaLinter by adding to .mega-linter.yml:

ENABLE_LINTERS:
  # Quality
  - SPELL_CSPELL
  - YAML_YAMLLINT
  - YAML_V8R  # Add this

# v8r schema validation configuration
YAML_V8R_CONFIG_FILE: .v8rrc.yml

Alternative Solutions

  • Use only yamllint (no schema validation)
  • Rely on IDE schema validation only (not enforced in CI)

Target Components

  • Terraform modules
  • Bicep modules
  • Blueprints
  • GitHub Actions
  • Documentation
  • Other: MegaLinter configuration, YAML/JSON files

Implementation Ideas

  1. Create .v8rrc.yml at repository root
  2. Create .v8rignore at repository root
  3. Add YAML_V8R to ENABLE_LINTERS in .mega-linter.yml
  4. Add YAML_V8R_CONFIG_FILE: .v8rrc.yml to .mega-linter.yml
  5. Run npx v8r to validate files against schemas
  6. Address any schema validation errors found

Additional Context

Setting Value Rationale
catalogs SchemaStore Standard schema catalog
ignoreUnknownFiles true Prevent errors for files without schemas
customCatalog Docker Compose, MegaLinter Project-specific schema mappings

Files excluded via .v8rignore:

  • Schema definition files (would cause circular validation)
  • Learning/training content (may have intentional schema deviations)
  • Generated files (terraform lock, package-lock)
  • Bicep parameter files (not JSON schema validated)

Benefits

  • Validates YAML/JSON files against their schemas in CI
  • Catches schema violations before runtime
  • Custom schema mappings for project files
  • Enables direct v8r usage outside MegaLinter

Potential Challenges

  • May discover existing schema violations in YAML files
  • Custom schemas may need periodic updates
  • Some files may need to be added to ignore list

Metadata

Metadata

Labels

configurationConfiguration files and settingsenhancementNew feature or requestmegalinterMegaLinter configuration and rulestoolingDeveloper tooling and utilities

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions