fix: remove hardcoded OpenCLI schema versions peppered throughout repo - #26
Merged
Merged
Conversation
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved moderate issues remain in version-update coverage and generator validation.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 3
Open (3)
What changed in this PR
This PR centralizes OpenCLI schema-version handling through generated Go and web constants, with tooling to synchronize documents and tests.
Changes:
- Adds schema-version generation and synchronization targets.
- Replaces hardcoded versions across code, adapters, fixtures, and web examples.
- Adds consistency tests for generated artifacts and documents.
| File | Summary |
|---|---|
web/src/views/LandingPage.tsx |
Uses the derived schema version in samples. |
web/src/views/GettingStarted.tsx |
Uses the derived schema version. |
web/src/views/GeneratingYargsCode.tsx |
Uses the derived schema version. |
web/src/views/GeneratingGoCode.tsx |
Uses the derived schema version. |
web/src/schemaVersion.ts |
Exposes the schema version to web code. |
validate/validate_test.go |
Uses the generated version constant. |
spec/types.go |
Adds the schema-version generation directive. |
spec/schema_version_test.go |
Validates generated artifacts and documents. |
spec/schema_version_gen.go |
Contains the generated version constant. |
Makefile |
Adds generation and synchronization targets. |
internal/genschema/main.go |
Generates constants and updates documents. Moderate (3 votes): must reject anything other than exactly one enum value. Moderate (2 votes): the updater pattern does not match JSON object keys. Moderate (1 vote): source fixtures are not covered by the updater or audit. |
internal/cli/app/actions_test.go |
Uses the generated version constant. |
gen/cli_yargs_variadic_test.go |
Uses the generated version constant. |
gen/cli_yargs_requiredaltsources_test.go |
Uses the generated version constant. |
gen/cli_urfave_cli_globalchoices_test.go |
Uses the generated version constant. |
gen/cli_test.go |
Updates selected test fixtures. Moderate (2 votes): later no_alt_sources and with_alt_sources fixtures still hardcode the schema version. |
gen/cli_group_test.go |
Uses the generated version constant. |
codec/default_test.go |
Uses the generated version constant. |
adapters/ourfave/ourfave.go |
Derives document versions from the generated constant. |
adapters/ourfave/ourfave_test.go |
Verifies the generated version. |
adapters/ocobra/ocobra.go |
Derives document versions from the generated constant. |
adapters/ocobra/ocobra_test.go |
Verifies the generated version. |
Files not reviewed (2)
- internal/genschema/main.go: Generated file
- spec/schema_version_gen.go: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.

Remove hardcoded OpenCLI schema versions found throughout the repo and replace with references derived from the schema itself.
at its core, this is accomplished by using a go generate command to parse the schema and create a new file that contains the version exposed form the
specpackage as a constant. That constant can then be referenced throughout the repository. Now when the schema version changes, it can be immediately reflected through the codebase without an error-prone find and replace.