Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.1.0] - 2026-04-09

### Added

- SARIF reporter now includes `region` with `startLine`/`startColumn` for inline PR annotations in GitHub Actions
- `ValidationError` type with optional `Line`/`Column` fields for structured error positions
- Multiple validation errors are now separated across all reporters: each error on its own line (standard), array of errors (JSON), individual result entries (SARIF), newline-separated in failure message (JUnit)
- `SchemaErrors` type to carry individual schema validation error messages
- Validation errors are prefixed with `syntax:` or `schema:` to distinguish error types
- `error-type` groupby option to group output by syntax errors, schema errors, and passed files
- GitHub Action section in README and index referencing `Boeing/validate-configs-action@v2.0.0`

### Fixed

- XSD validation errors now show detailed diagnostics instead of generic "xsd: validation failed"
- XSD error format cleaned up from `(string):5: Schemas validity error : ...` to `line 5: ...`

## [2.0.0] - 2026-04-08

### Added

- SARIF syntax and schema validation using the go-sarif library
Expand Down
6 changes: 3 additions & 3 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Maintainer: Clayton Kehoe <clayton.j.kehoe at boeing dot com>
# Contributor : wiz64 <wiz64 dot com>
pkgname=config-file-validator
pkgver=1.11.0
pkgver=2.1.0
pkgrel=1
pkgdesc="A tool to validate the syntax of configuration files"
pkgdesc="A tool to validate the syntax and schema of configuration files"
arch=('x86_64')
url="https://github.com/Boeing/config-file-validator"
license=('Apache 2.0')
depends=('glibc')
makedepends=('go>=1.25' 'git' 'sed')
makedepends=('go>=1.26.2' 'git' 'sed')
source=("git+https://github.com/Boeing/config-file-validator.git")
sha256sums=('SKIP')
md5sums=('SKIP')
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ If you have a go environment on your desktop you can use [go install](https://go
go install github.com/Boeing/config-file-validator/cmd/validator@latest
```

## GitHub Action

A GitHub Action is available to run the config-file-validator as part of your CI/CD pipeline. It posts validation results as PR comments with inline annotations on the affected files and lines.

```yaml
- uses: Boeing/validate-configs-action@v2.0.0
```

See the [validate-configs-action](https://github.com/Boeing/validate-configs-action) repository for full usage and configuration options.

## Usage

```
Expand Down Expand Up @@ -152,7 +162,7 @@ optional flags:
-globbing
If globbing flag is set, check for glob patterns in the arguments.
-groupby string
Group output by filetype, directory, pass-fail. Supported for Standard and JSON reports
Group output by filetype, directory, pass-fail, error-type. Supported for Standard and JSON reports
-no-schema
Disable all schema validation. Only syntax is checked.
Cannot be used with --require-schema, --schema-map, or --schemastore.
Expand Down Expand Up @@ -279,7 +289,7 @@ validator --reporter=json:output.json --reporter=standard /path/to/search

### Group report output

Group the report output by file type, directory, or pass-fail. Supports one or more groupings.
Group the report output by file type, directory, pass-fail, or error-type. Supports one or more groupings.

```shell
validator -groupby filetype
Expand Down
13 changes: 13 additions & 0 deletions cmd/validator/testdata/groupby.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ stdout 'Summary'
exec validator -groupby=pass-fail files
stdout 'Passed'

# Group by error-type (all valid files → Passed group)
exec validator -groupby=error-type files
stdout 'Passed'

# Group by error-type with failures
! exec validator -groupby=error-type mixed
stdout 'syntax'
stdout 'Passed'

# Double grouping
exec validator -groupby=filetype,directory files
stdout 'json'
Expand Down Expand Up @@ -39,3 +48,7 @@ stdout 'totalPassed'
{"key": "value"}
-- files/good.yaml --
key: value
-- mixed/good.json --
{"key": "value"}
-- mixed/bad.json --
{"key": value}
20 changes: 10 additions & 10 deletions cmd/validator/testdata/json_schema.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ stdout '✓'
# Invalid package.json (version must be string)
! exec validator invalid_package.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# --- tsconfig.json schema ---

Expand All @@ -22,7 +22,7 @@ stdout '✓'
# Invalid tsconfig.json (target must be string)
! exec validator invalid_tsconfig.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# --- eslintrc schema ---

Expand All @@ -39,7 +39,7 @@ stdout '✓'
# Invalid workflow (missing required jobs)
! exec validator invalid_workflow.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# --- Strict config schema ---

Expand All @@ -50,27 +50,27 @@ stdout '✓'
# Missing required field
! exec validator missing_required.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# Wrong type
! exec validator wrong_type.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# Extra property not allowed
! exec validator extra_property.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# Value out of range
! exec validator out_of_range.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# Enum violation
! exec validator bad_enum.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# --- Array schema ---

Expand All @@ -81,12 +81,12 @@ stdout '✓'
# Too few items
! exec validator too_few_items.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# Wrong item type
! exec validator wrong_item_type.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# --- Mixed: files with and without $schema ---

Expand Down
2 changes: 1 addition & 1 deletion cmd/validator/testdata/no_schema.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ stdout '✓'
# Without --no-schema it fails
! exec validator bad_with_schema.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# --no-schema with YAML schema comment — skips validation
exec validator --no-schema bad_with_schema.yaml
Expand Down
2 changes: 1 addition & 1 deletion cmd/validator/testdata/schema_map.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stdout '✓'
# --schema-map with invalid data fails
! exec validator --schema-map=bad.json:schema.json bad.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# --schema-map with glob pattern
exec validator --schema-map=**/*.json:schema.json subdir/config.json
Expand Down
22 changes: 11 additions & 11 deletions cmd/validator/testdata/schemastore.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ stdout '✓'
# Invalid package.json (version must be string)
! exec validator --schemastore schemastore invalid/package.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# Valid nodemon.json
exec validator --schemastore schemastore valid/nodemon.json
Expand All @@ -23,7 +23,7 @@ stdout '✓'
# Invalid nodemon.json (unknown field, additionalProperties: false)
! exec validator --schemastore schemastore invalid/nodemon.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# ============================================================
# PART 2: --schemastore automatic matching (YAML)
Expand All @@ -36,7 +36,7 @@ stdout '✓'
# Invalid GitHub workflow (missing required 'jobs')
! exec validator --schemastore schemastore invalid/.github/workflows/ci.yml
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# Valid artifacthub-repo.yml
exec validator --schemastore schemastore valid/artifacthub-repo.yml
Expand All @@ -45,7 +45,7 @@ stdout '✓'
# Invalid artifacthub-repo.yml (additionalProperties: false)
! exec validator --schemastore schemastore invalid/artifacthub-repo.yml
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# ============================================================
# PART 3: --schemastore automatic matching (TOML)
Expand All @@ -58,7 +58,7 @@ stdout '✓'
# Invalid stylua.toml (column_width must be integer)
! exec validator --schemastore schemastore invalid/stylua.toml
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# ============================================================
# PART 4: --schemastore automatic matching (TOON)
Expand All @@ -71,7 +71,7 @@ stdout '✓'
# Invalid app.toon (port out of range)
! exec validator --schemastore schemastore invalid/app.toon
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# ============================================================
# PART 5: Unmatched files pass syntax-only
Expand Down Expand Up @@ -115,7 +115,7 @@ stdout '✓'
# schema-map points to strict schema that rejects the file
! exec validator --schema-map=package.json:strict_schema.json --schemastore schemastore valid/package.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# ============================================================
# PART 9: --schema-map with YAML
Expand All @@ -126,7 +126,7 @@ stdout '✓'

! exec validator --schema-map=config.yaml:server_schema.json invalid/config.yaml
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# ============================================================
# PART 10: --schema-map with TOML
Expand All @@ -137,7 +137,7 @@ stdout '✓'

! exec validator --schema-map=config.toml:server_schema.json invalid/config.toml
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# ============================================================
# PART 11: --schema-map with TOON
Expand All @@ -148,7 +148,7 @@ stdout '✓'

! exec validator --schema-map=config.toon:server_schema.json invalid/config.toon
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# ============================================================
# PART 12: --schema-map with glob patterns
Expand All @@ -159,7 +159,7 @@ stdout '✓'

! exec validator --schema-map=**/configs/*.json:server_schema.json invalid/configs/db.json
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# ============================================================
# PART 13: Multiple files, mixed results
Expand Down
2 changes: 1 addition & 1 deletion cmd/validator/testdata/toml_schema.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stdout '✓'
# TOML with invalid data fails schema validation
! exec validator invalid.toml
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# TOML without $schema passes (syntax only)
exec validator plain.toml
Expand Down
2 changes: 1 addition & 1 deletion cmd/validator/testdata/toon_schema.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stdout '✓'
# TOON with invalid data fails schema validation
! exec validator invalid.toon
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# TOON without $schema passes (syntax only)
exec validator plain.toon
Expand Down
6 changes: 3 additions & 3 deletions cmd/validator/testdata/xml_schema.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ stdout '✓'
# Invalid type
! exec validator xsd_invalid.xml
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# No schema passes syntax-only
exec validator plain.xml
Expand All @@ -87,7 +87,7 @@ stdout '✓'
# --schema-map with XSD invalid
! exec validator --schema-map=mapped_bad.xml:schema.xsd mapped_bad.xml
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# ============================================================
# DTD + XSD together
Expand All @@ -100,7 +100,7 @@ stdout '✓'
# DTD valid but XSD fails (wrong type)
! exec validator dtd_ok_xsd_bad.xml
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# DTD fails (missing element) — never reaches XSD
! exec validator dtd_bad_xsd_ok.xml
Expand Down
2 changes: 1 addition & 1 deletion cmd/validator/testdata/yaml_schema.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stdout '✓'
# YAML with invalid data fails schema validation
! exec validator invalid.yaml
stdout '×'
stdout 'schema validation failed'
stdout 'error:'

# YAML without schema comment passes (syntax only)
exec validator plain.yaml
Expand Down
6 changes: 3 additions & 3 deletions cmd/validator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func getFlags(args []string) (validatorConfig, error) {
excludeFileTypesPtr = flagSet.String("exclude-file-types", "", "A comma separated list of file types to ignore")
fileTypesPtr = flagSet.String("file-types", "", "A comma separated list of file types to validate")
versionPtr = flagSet.Bool("version", false, "Version prints the release version of validator")
groupOutputPtr = flagSet.String("groupby", "", "Group output by filetype, directory, pass-fail. Supported for Standard and JSON reports")
groupOutputPtr = flagSet.String("groupby", "", "Group output by filetype, directory, pass-fail, error-type. Supported for Standard and JSON reports")
quietPtr = flagSet.Bool("quiet", false, "If quiet flag is set. It doesn't print any output to stdout.")
globbingPrt = flagSet.Bool("globbing", false, "If globbing flag is set, check for glob patterns in the arguments.")
requireSchemaPtr = flagSet.Bool("require-schema", false,
Expand Down Expand Up @@ -321,14 +321,14 @@ func validateReporterConf(conf map[string]string, groupBy *string) error {
func validateGroupByConf(groupBy *string) error {
groupByCleanString := cleanString("groupby")
groupByUserInput := strings.Split(groupByCleanString, ",")
groupByAllowedValues := []string{"filetype", "directory", "pass-fail"}
groupByAllowedValues := []string{"filetype", "directory", "pass-fail", "error-type"}
seenValues := make(map[string]bool)

// Check that the groupby values are valid and not duplicates
if groupBy != nil && isFlagSet("groupby") {
for _, groupBy := range groupByUserInput {
if !slices.Contains(groupByAllowedValues, groupBy) {
return errors.New("wrong parameter value for groupby, only supports filetype, directory, pass-fail")
return errors.New("wrong parameter value for groupby, only supports filetype, directory, pass-fail, error-type")
}
if _, ok := seenValues[groupBy]; ok {
return errors.New("wrong parameter value for groupby, duplicate values are not allowed")
Expand Down
Loading
Loading