feat(config): add config struct json schemas#381
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR forward-ports the work to generate and ship JSON Schema definitions for rig’s protocol configuration structs (SSH, OpenSSH, WinRM, Localhost), along with tooling and CI checks to keep the schemas valid.
Changes:
- Added generated JSON/YAML schema artifacts under
schemas/for SSH, OpenSSH, WinRM, and Localhost configs. - Added an
internal/jsonschemagenerator module plus schema validation tests and a CI job to compile/validate the schemas. - Annotated protocol config structs with
jsonandjsonschematags to drive schema generation.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| schemas/winrm.yaml | Adds generated YAML schema for WinRM (including embedded SSH bastion). |
| schemas/winrm.json | Adds generated JSON schema for WinRM (including embedded SSH bastion). |
| schemas/ssh.yaml | Adds generated YAML schema for SSH config. |
| schemas/ssh.json | Adds generated JSON schema for SSH config. |
| schemas/openssh.yaml | Adds generated YAML schema for OpenSSH config. |
| schemas/openssh.json | Adds generated JSON schema for OpenSSH config. |
| schemas/localhost.yaml | Adds generated YAML schema for localhost config (bool + legacy object form). |
| schemas/localhost.json | Adds generated JSON schema for localhost config (bool + legacy object form). |
| protocol/winrm/config.go | Adds json + jsonschema tags to WinRM config struct fields. |
| protocol/ssh/config.go | Adds json + jsonschema tags to SSH config struct fields. |
| protocol/openssh/config.go | Adds json + jsonschema tags to OpenSSH config struct fields. |
| Makefile | Adds schemas target to build schemas via the generator. |
| internal/jsonschema/schema_validation_test.go | Adds tests that compile schemas and validate sample JSON documents. |
| internal/jsonschema/Makefile | Adds generator build targets for JSON/YAML outputs into schemas/. |
| internal/jsonschema/go.mod | Introduces a nested Go module for the schema generator and tests. |
| internal/jsonschema/go.sum | Adds dependency lockfile for the generator module. |
| internal/jsonschema/gen_schema.go | Implements schema generation and post-processing (e.g., address format anyOf). |
| .github/workflows/go.yml | Adds a CI job to run the schema validation tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.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.
forwardport #267