Skip to content

feat: add boolean field type support to configuration schema#284

Open
larsroettig wants to merge 2 commits intoadobe:mainfrom
larsroettig:bool-support
Open

feat: add boolean field type support to configuration schema#284
larsroettig wants to merge 2 commits intoadobe:mainfrom
larsroettig:bool-support

Conversation

@larsroettig
Copy link
Member

@larsroettig larsroettig commented Mar 4, 2026

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

  • Adds a new boolean field type to the FieldSchema variant, with an optional default value
  • Updates the config POST endpoint to accept boolean values in addition to string and string[]
  • Updates BusinessConfigSchemaField type comment to reflect the new field type
  • Adds test fixtures and unit tests covering boolean fields with default: true, default: false, no default, and invalid (non-boolean) default values

Supports now

	import { defineConfig } from "@adobe/aio-commerce-lib-app/config";

	export default defineConfig({
		metadata: {
			id: "aio-config-test",
			displayName: "AIO Config Test",
			version: "1.4.0",
			description:
				"Test project for Adobe Commerce App Builder configuration API",
		},
		businessConfig: {
			schema: [
				{
					type: "boolean",
					label: "Enable true default",
					description: "Enable the feature",
					name: "enable_true_default",
					default: true,
				},
				{
					type: "boolean",
					label: "Enable true no default",
					description: "Enable the feature",
					name: "enable_true",
				},
				{
					type: "boolean",
					label: "Enable false default",
					description: "Enable the feature",
					name: "enable_false",
					default: false,
				}
			],
		},
	});

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have read the DEVELOPMENT document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

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.
Copilot AI review requested due to automatic review settings March 4, 2026 18:12
@github-actions github-actions bot added without-changeset The PR does not contain a Changeset file pkg: aio-commerce-lib-config Includes changes in `packages/aio-commerce-lib-config` pkg: aio-commerce-lib-app Includes changes in `packages/aio-commerce-lib-app` labels Mar 4, 2026
Copy link
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

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 boolean variant to FieldSchema (with optional default) and updates related schema type docs.
  • Extends the app config POST 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.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@changeset-bot
Copy link

changeset-bot bot commented Mar 4, 2026

⚠️ No Changeset found

Latest commit: a5b49bf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Collaborator

@jnatherley jnatherley left a comment

Choose a reason for hiding this comment

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

LGTM - Please update with changes from main branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: aio-commerce-lib-app Includes changes in `packages/aio-commerce-lib-app` pkg: aio-commerce-lib-config Includes changes in `packages/aio-commerce-lib-config` without-changeset The PR does not contain a Changeset file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants