Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

fix(@angular/cli): support array options defined in oneOf schemas - #34607

Open
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix/cli-oneof-array-options
Open

alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix/cli-oneof-array-options

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Previously, getSupportedTypes in json-schema.ts only checked top-level items when determining if an array type in a JSON schema was supported on the CLI. Options like allowedHosts in @angular/build:dev-server, which define their array schema inside a oneOf alongside boolean, had their array type filtered out and were registered in Yargs as boolean only.

Additionally, when an option supports both array (or string) and boolean, Yargs parses bare flags (e.g. --allowed-hosts) as [] and --allowed-hosts=true as ['true']. This change checks oneOf/anyOf subschemas for supported array items and coerces empty or boolean-like values to booleans when boolean is also a supported type.

Fixes #33955

Previously, `getSupportedTypes` in `json-schema.ts` only checked top-level `items` when determining if an `array` type in a JSON schema was supported on the CLI. Options like `allowedHosts` in `@angular/build:dev-server`, which define their `array` schema inside a `oneOf` alongside `boolean`, had their `array` type filtered out and were registered in Yargs as `boolean` only.

Additionally, when an option supports both `array` (or `string`) and `boolean`, Yargs parses bare flags (e.g. `--allowed-hosts`) as `[]` and `--allowed-hosts=true` as `['true']`. This change checks `oneOf`/`anyOf` subschemas for supported array items and coerces empty or boolean-like values to booleans when `boolean` is also a supported type.

Closes angular#33955
@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label Oct 30, 2026
@alan-agius4
alan-agius4 requested a review from clydin October 30, 2026 13:00
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 30, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for options that can be either an array or a boolean (such as allowedHosts in oneOf schemas) by introducing a coerceToBoolean helper and updating schema parsing. The review feedback points out an issue where default values (like an empty array []) are incorrectly coerced to true when generating help output. To resolve this, the reviewer suggests wrapping the coercion logic in a factory function createCoerceToBoolean(defaultValue) to bypass coercion for the default value.

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

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/cli target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-server

1 participant