Skip to content

fix: remove hardcoded OpenCLI schema versions peppered throughout repo - #26

Merged
bcdxn merged 3 commits into
mainfrom
feature/consolidate-version-refs
Sep 22, 2026
Merged

bcdxn merged 3 commits into
mainfrom
feature/consolidate-version-refs

Conversation

@bcdxn

@bcdxn bcdxn commented Sep 22, 2026

Copy link
Copy Markdown
Owner

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 spec package 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.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 2.66667% with 73 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/genschema/main.go 0.00% 73 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 Medium severity

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.

Comment thread gen/cli_test.go
Comment thread internal/genschema/main.go
Comment thread internal/genschema/main.go Outdated
bcdxn and others added 2 commits September 22, 2026 14:11
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@bcdxn
bcdxn merged commit 87d0b43 into main Sep 22, 2026
7 checks passed
@bcdxn
bcdxn deleted the feature/consolidate-version-refs branch September 22, 2026 18:19
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