Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support boolean default #30

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion schema/app.config.yaml.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
"additionalProperties": false
}
},
"configSchemaValue": { "type": "string", "maxLength": 1000 },
"configSchemaValue": { "type": ["string", "boolean"], "maxLength": 1000 },
"productDependencies": {
"type": "array",
"items": {
Expand Down
26 changes: 26 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,32 @@ application:
}))
})

test('default boolean = true', async () => {
global.fakeFileSystem.addJson(
{
'/package.json': '{}',
'/app.config.yaml': `
application:
runtimeManifest: { packages: {}}
configSchema:
properties:
- envKey: BYE
type: boolean
default: true
`
}
)
await expect(appConfig.load({})).resolves.toEqual(expect.objectContaining({
configSchema: {
properties: [{
envKey: 'BYE',
type: 'boolean',
default: true
}]
}
}))
})

test('valid no configSchema', async () => {
global.fakeFileSystem.addJson(
{
Expand Down
Loading