Skip to content

Commit 957e5f1

Browse files
committed
fix: accept boolean and number types for manifest default field
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.
1 parent 3904a29 commit 957e5f1

4 files changed

Lines changed: 37 additions & 5 deletions

File tree

cli/schema/rep-manifest.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"default": false
3939
},
4040
"default": {
41-
"type": "string",
42-
"description": "Default value if the environment variable is not set. Only valid for non-required variables."
41+
"type": ["string", "number", "boolean"],
42+
"description": "Default value if the environment variable is not set. Only valid for non-required variables. Non-string values are coerced to strings."
4343
},
4444
"description": {
4545
"type": "string",

cli/src/utils/__tests__/manifest.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,38 @@ describe('manifest', () => {
159159
expect(() => validateManifest(manifest)).not.toThrow();
160160
});
161161

162+
it('should accept boolean default values', () => {
163+
const manifest = {
164+
version: '0.1.0',
165+
variables: {
166+
COMING_SOON: {
167+
tier: 'public',
168+
type: 'boolean',
169+
required: false,
170+
default: false,
171+
},
172+
},
173+
};
174+
175+
expect(() => validateManifest(manifest)).not.toThrow();
176+
});
177+
178+
it('should accept number default values', () => {
179+
const manifest = {
180+
version: '0.1.0',
181+
variables: {
182+
MAX_RETRIES: {
183+
tier: 'public',
184+
type: 'number',
185+
required: false,
186+
default: 3,
187+
},
188+
},
189+
};
190+
191+
expect(() => validateManifest(manifest)).not.toThrow();
192+
});
193+
162194
it('should accept settings object', () => {
163195
const manifest = {
164196
version: '0.1.0',

cli/src/utils/manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface ManifestVariable {
1212
tier: 'public' | 'sensitive' | 'server';
1313
type?: 'string' | 'url' | 'number' | 'boolean' | 'csv' | 'json' | 'enum';
1414
required?: boolean;
15-
default?: string;
15+
default?: string | number | boolean;
1616
description?: string;
1717
example?: string;
1818
pattern?: string;

schema/rep-manifest.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"default": false
3939
},
4040
"default": {
41-
"type": "string",
42-
"description": "Default value if the environment variable is not set. Only valid for non-required variables."
41+
"type": ["string", "number", "boolean"],
42+
"description": "Default value if the environment variable is not set. Only valid for non-required variables. Non-string values are coerced to strings."
4343
},
4444
"description": {
4545
"type": "string",

0 commit comments

Comments
 (0)