feat: add boolean field type support to configuration schema#284
feat: add boolean field type support to configuration schema#284larsroettig wants to merge 2 commits intoadobe:mainfrom
Conversation
Adds a new 'boolean' field type to the business configuration schema, allowing toggle fields to accept true/false values. Updates the config action endpoint to accept boolean values alongside strings and string arrays.
There was a problem hiding this comment.
Pull request overview
Adds first-class boolean support to the business configuration schema so config UIs/actions can represent toggle fields with optional boolean defaults.
Changes:
- Adds a
booleanvariant toFieldSchema(with optionaldefault) and updates related schema type docs. - Extends the app
configPOST body validation to accept boolean values. - Adds fixtures + unit tests for boolean schema validation (true/false/no default + invalid default).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/aio-commerce-lib-config/test/unit/schema/validator.test.ts | Adds unit tests validating the new boolean field schema behavior. |
| packages/aio-commerce-lib-config/test/fixtures/configuration-schema.ts | Extends the valid schema fixture with boolean fields. |
| packages/aio-commerce-lib-config/source/modules/schema/types.ts | Updates schema field type documentation to mention boolean. |
| packages/aio-commerce-lib-config/source/modules/schema/fields.ts | Introduces BooleanSchema and registers it in FieldSchema variant. |
| packages/aio-commerce-lib-app/source/actions/config.ts | Accepts boolean values in POST /config request validation. |
You can also share your feedback on Copilot code review. Take the survey.
packages/aio-commerce-lib-config/source/modules/schema/types.ts
Outdated
Show resolved
Hide resolved
packages/aio-commerce-lib-config/source/modules/schema/fields.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Adds a new 'boolean' field type to the business configuration schema, allowing toggle fields to accept true/false values. Updates the config action endpoint to accept boolean values alongside strings and string arrays.
Description
booleanfield type to theFieldSchemavariant, with an optionaldefaultvaluebooleanvalues in addition tostringandstring[]BusinessConfigSchemaFieldtype comment to reflect the new field typedefault: true,default: false, no default, and invalid (non-boolean) default valuesSupports now
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: