angular / angular/angular-cli

[Schematics CLI] Numeric strings in schematics options

オープン
#24,360 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: @angular-devkit/schematics-cli freq1: low type: bug/fix
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
162

説明

### Command

generate

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

From http://b/196605664.

Apparently you can't pass in a numeric value into a string argument in schematics. This appears to be interpreted as number and leads to a validation error.

### Minimal Reproduction

```
$ schematics run test --stringValue "1234"
Schematic input does not validate against the Schema: {"stringValue":1234}
Errors:

Data path ".stringValue" should be string.
```

Minimist seems to interpret "1234" as a number instead of a string, and schematics treats that as a type mismatch.

### Exception or Error

_No response_

### Your Environment

```text
See http://b/196605664.
```

### Anything else relevant?

_No response_

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

generate コマンドのオプション解析と、レポートで説明されている minimist の処理から始め、次に --stringValue "1234" を指定してコマンドを再現します。引用符で囲まれた値が数値になる箇所を追跡し、string オプションに渡された数値のように見える値が、文字列としてスキーマ検証に到達することを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
cli
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。