Skip to content

fix: accept boolean and number types for manifest default field#44

Merged
olamide226 merged 2 commits intomainfrom
fix/manifest-default-non-string-types
Mar 21, 2026
Merged

fix: accept boolean and number types for manifest default field#44
olamide226 merged 2 commits intomainfrom
fix/manifest-default-non-string-types

Conversation

@olamide226
Copy link
Copy Markdown
Contributor

@olamide226 olamide226 commented Mar 21, 2026

Summary

  • Widens the default field in .rep.yaml manifest schema from string to string | number | boolean
  • Users can now write default: false instead of default: "false" for boolean variables (and default: 3 for numbers)
  • Fully backward compatible — existing string defaults are unaffected

Changes

  • schema/rep-manifest.schema.json + cli/schema/rep-manifest.schema.json — updated JSON schema type
  • cli/src/utils/manifest.ts — widened TypeScript interface type
  • cli/src/utils/__tests__/manifest.test.ts — added tests for boolean and number defaults

Test plan

  • All 76 existing CLI tests pass
  • New tests verify default: false (boolean) and default: 3 (number) validate successfully
  • Manually test with rep validate against a .rep.yaml using default: false

The `default` field in `.rep.yaml` previously only accepted strings,
forcing users to quote non-string values (e.g. `default: "false"`).
This widens the JSON schema to accept string, number, and boolean,
so `default: false` and `default: 3` now validate correctly.

Backward compatible — string defaults continue to work unchanged.
Copilot AI review requested due to automatic review settings March 21, 2026 03:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands the REP manifest (.rep.yaml) schema and CLI typings so variables.*.default can be specified as a boolean or number (in addition to string), enabling more natural YAML like default: false and default: 3.

Changes:

  • Widened default type in the root and CLI-bundled JSON schemas to allow string | number | boolean.
  • Updated the CLI ManifestVariable TypeScript interface to match the schema.
  • Added CLI unit tests ensuring schema validation accepts boolean/number defaults.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
schema/rep-manifest.schema.json Broadens manifest default type in the published schema.
cli/schema/rep-manifest.schema.json Keeps the CLI-bundled schema in sync with the root schema change.
cli/src/utils/manifest.ts Updates TS types so CLI code can represent boolean/number defaults.
cli/src/utils/tests/manifest.test.ts Adds validation tests for boolean and number default values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +41 to +42
"type": ["string", "number", "boolean"],
"description": "Default value if the environment variable is not set. Only valid for non-required variables. Non-string values are coerced to strings."
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

There are additional checked-in copies of this schema that still restrict variables.*.default to string (e.g. docs/public/schema/rep-manifest.schema.json and the docs table in docs/src/content/docs/reference/manifest-schema.mdx). As-is, the docs site will keep publishing/validating the old schema even though schema/ and cli/schema/ were updated. Please update/remove those copies or introduce a single-source sync step so all published schemas stay consistent.

Suggested change
"type": ["string", "number", "boolean"],
"description": "Default value if the environment variable is not set. Only valid for non-required variables. Non-string values are coerced to strings."
"type": "string",
"description": "Default value if the environment variable is not set. Only valid for non-required variables."

Copilot uses AI. Check for mistakes.
AJV ignores `"format": "uri"` by default, causing a warning during
`rep validate`. Adding ajv-formats enables proper URI validation
for `settings.allowed_origins` items.
@olamide226 olamide226 merged commit 96e3ac4 into main Mar 21, 2026
9 checks passed
@olamide226 olamide226 deleted the fix/manifest-default-non-string-types branch March 21, 2026 04:04
@github-actions github-actions bot mentioned this pull request Mar 21, 2026
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.

2 participants