feat: Add JSON schema generation and validation for digger.yml (#2541)#2566
Open
joshuamkite-nfb wants to merge 4 commits intodiggerhq:developfrom
Open
feat: Add JSON schema generation and validation for digger.yml (#2541)#2566joshuamkite-nfb wants to merge 4 commits intodiggerhq:developfrom
joshuamkite-nfb wants to merge 4 commits intodiggerhq:developfrom
Conversation
…rhq#2541) - Fixed schema-gen tool for jsonschema v0.13.0 API changes - Added comprehensive developer documentation in schema-gen/ - Integrated schema validation into CI/CD pipeline - Updated user documentation with IDE support guidance - Validated schema against 3 production digger.yml configs - Created Makefile with schema-generate, schema-validate, and schema-check targets New dependencies (scoped to schema-gen tool): - github.com/invopop/jsonschema v0.13.0 - github.com/wk8/go-ordered-map/v2 v2.1.8 AI Assistance: This PR was developed with AI assistance (Claude via Roo Code) under human direction. The human directed the overall approach, validation strategy, and ensured adherence to repository conventions. The AI helped with code fixes, documentation, and validation testing.
e919dfe to
ce0af05
Compare
- Add schema_test.go with tests for enum values, defaults, and required fields - Validates generated schema structure and constraints
…ema-generation-2541
- Merged upstream/develop to include trusted_appIDs field - Regenerated schema to match current struct definitions - Schema now includes trusted_appIDs array field
Contributor
Author
|
Can even see schema test failing my PR because my branch was out of date LOL |
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.
Add JSON Schema Generation Tool for digger.yml
Fixes #2541
Summary
Implements an automated JSON Schema generation tool for
digger.ymlconfiguration files, addressing documentation drift issues identified in #2541. The tool generates schema from Go structs in the code, ensuring the schema stays synchronized with the codebase.Changes
Core Implementation
libs/digger_config/cmd/schema-gen/): Standalone Go tool that generates JSON Schema fromDiggerConfigYamlstructlibs/digger_config/digger-schema.json): Complete JSON Schema with type validation, enum constraints, and field descriptionsschema-generate,schema-validate,schema-checkfor schema maintenancelibs/digger_config/schema_test.go): Validation tests for enum values, defaults, and required fieldsCI/CD Integration
.github/workflows/libs_test.yml): Addedschema-checkstep to validate schema on every PRDocumentation
libs/digger_config/cmd/schema-gen/README.md- Tool usage and development guidelibs/digger_config/README.md- Library overview with schema maintenance workflowdocs/ce/reference/digger.yml.mdx):comment_render_modeenum values:→detailedgroup_by_moduleTechnical Details
Dependencies Added (scoped to schema-gen tool only):
github.com/invopop/jsonschemav0.13.0 - Schema generation via reflectiongithub.com/wk8/go-ordered-map/v2v2.1.8 - Ordered property maps (transitive)Key Features:
yaml:struct tags for field namingCommentRenderModeBasic).PHONY,GOWORK=off)Testing
Unit Tests
Production Config Validation
The generated schema was validated against 3 real production
digger.ymlfiles from active repositories:foo/digger.yml(1007 lines, Terragrunt config with 100+ projects)bar/digger.yml(68 lines, OpenTofu config with staging/production workflows)baz/digger.yml(46 lines, multi-environment configuration)All production configs validated successfully, confirming the schema accurately represents real-world usage patterns.
All existing tests pass. Schema validation now runs in CI on every PR.
Benefits
Migration Notes
None required. This is a new tool that doesn't affect existing functionality.
Future Work
https://docs.opentaco.dev/schemas/digger.yml.json🧠 AI Usage Details:
This PR was developed with assistance from Claude (Anthropic) under human direction.
Human Direction:
AI Assistance:
All code has been reviewed, tested against production configs, and verified manually.