Skip to content

validator command can now output JSON to stdout, with extras optionally included#537

Merged
irees merged 4 commits intomainfrom
validate-cmd-args
Jan 6, 2026
Merged

validator command can now output JSON to stdout, with extras optionally included#537
irees merged 4 commits intomainfrom
validate-cmd-args

Conversation

@drewda
Copy link
Copy Markdown
Member

@drewda drewda commented Dec 11, 2025

This PR enhances the validator command with JSON output capabilities and additional data inclusion options.

New Features

  • JSON output to stdout: Use -o - to write JSON validation results directly to stdout, which automatically enables quiet mode
  • Quiet mode: New -q/--quiet flag to suppress log output, useful for scripting and CI pipelines
  • Extended JSON output options:
    • --include-entities - Include GTFS entities in JSON output
    • --include-route-geometries - Include route geometries in JSON output
    • --include-service-levels - Include service levels in JSON output

Changes

  • Renamed output flag from --o to -o/--out for consistency with CLI conventions
  • Improved help text with usage examples showing the new functionality

Example Usage

# Output JSON to stdout with entities included
transitland validate -o - --include-entities "http://developer.trimet.org/schedule/gtfs.zip"

# Write JSON to file with all extras
transitland validate -o report.json --include-entities --include-route-geometries --include-service-levels gtfs.zip

# Validate with quiet mode (logs suppressed)
transitland validate -q "https://www.bart.gov/dev/schedules/google_transit.zip"

Motivation

These changes make it easier to programmatically consume validation results by:

  1. Allowing JSON output to stdout for piping to other tools
  2. Suppressing log messages that would interfere with JSON parsing
  3. Providing optional inclusion of additional data (entities, geometries, service levels) in the output

Copilot AI review requested due to automatic review settings December 11, 2025 05:22
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 11, 2025

Generated Code Check ✅

All generated code is up to date.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds JSON output functionality to the validator command, allowing validation results to be written to stdout in JSON format with log suppression, making it easier to programmatically consume the output. The changes also expose options to include additional data in the JSON output such as GTFS entities, route geometries, and service levels.

Key Changes:

  • Added --output-format json flag to output JSON to stdout while suppressing log messages
  • Added three new include flags (--include-entities, --include-route-geometries, --include-service-levels) to optionally include extra data in JSON output
  • Renamed the output flag from -o to --output/-o with improved help text

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@irees irees merged commit b901112 into main Jan 6, 2026
6 checks passed
@irees irees deleted the validate-cmd-args branch January 6, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants