feat(validate): add validate command with structured JSON output#1611
Open
samuraisatoshi wants to merge 2 commits intoyonaskolb:masterfrom
Open
feat(validate): add validate command with structured JSON output#1611samuraisatoshi wants to merge 2 commits intoyonaskolb:masterfrom
samuraisatoshi wants to merge 2 commits intoyonaskolb:masterfrom
Conversation
Adds a new --dry-run flag to the generate command that generates the Xcode project in memory and prints a JSON diff of what would change compared to the existing project on disk, without writing any files. New type ProjectDiff captures added/removed/modified file keys in the pbxproj and serialises them as JSON. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a new `xcodegen validate` command that validates the project spec without generating a project. Output is always a JSON object with three keys: - valid (bool): whether the spec passed all checks - errors (array): each with stage and message fields - warnings (array): same shape This separates validation from generation and enables CI pipelines to get machine-readable validation results. Supports comma-separated --spec paths and all existing ProjectCommand flags (--no-env, --project-root). Exit code is 1 when the spec has errors, 0 when valid. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Summary
Adds a new
xcodegen validatecommand that validates the project spec without generating a project, producing structured JSON output.--specpaths)validateProjectDictionaryWarnings,validateMinimumXcodeGenVersion, andproject.validate()— each attributed to a stagevalid,errors, andwarningsarraysJSON output
{ "errors": [], "valid": true, "warnings": [] }Error/warning objects:
{ "errors": [ { "stage": "parsing", "message": "..." }, { "stage": "validation", "message": "Target 'Missing' not found" } ], "valid": false, "warnings": [] }Use cases
generate, with machine-readable output--spec app/project.yml,lib/project.ymlvalidates both, aggregates resultsTest plan
xcodegen validateon valid spec →"valid": true, exit 0xcodegen validateon invalid spec →"valid": false, errors populated, exit 1xcodegen validate --spec missing.yml→ parsing error captured in JSON, exit 1xcodegen validate --spec a.yml,b.yml→ errors from both specs aggregatedswift testpasses🤖 Generated with Claude Code