ajv-validator / ajv-validator/ajv

additionalProperties/removeAdditional not working with "select"

オープン
#798 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
TypeScript
スター
14.8k
フォーク
1k
PR マージ指標
30日以内にマージされた PR はありません

説明

**Ajv version: 6.5.0**

**Ajv options**

```javascript
{
format:'full',
logger:false,
removeAdditional:true
}
```

**JSON Schema**

```json
{
"type":"object",
"properties":{
"to_contacts":{
"type":"array",
"items":{
"type":"object",
"additionalProperties":false,
"properties":{
"type":{
"type":"string",
"enum":[
"channel",
"user"
]
},
"contact_id":{
"type":"string",
"minLength":1,
"maxLength":60
},
"channel_id":{
"type":"string",
"minLength":1,
"maxLength":30
},
"user_id":{
"type":"string",
"minLength":1,
"maxLength":30
}
},
"select":{
"$data":"0/type"
},
"selectCases":{
"channel":{
"required":[
"type",
"contact_id",
"channel_id"
]
},
"user":{
"required":[
"type",
"contact_id",
"user_id"
]
}
},
"selectDefault":false
},
"minItems":1
}
}
}
```

**Sample data**

```json
{
"to_contacts":[
{
"type":"user",
"contact_id":"reGuyGMB8hHdr1KUjhRc",
"user_id":"U9RQJQHJ9",
"removethisproperty":"anyvalue"
}
]
}
```

**Output**

```
{
"to_contacts":[
{
"type":"user",
"contact_id":"reGuyGMB8hHdr1KUjhRc",
"user_id":"U9RQJQHJ9",
"removethisproperty":"anyvalue"
}
]
}
```

Am I missing something here or Ajv is not removing additional properties when **select** is used?

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

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

評価

この issue はまだ評価されていません。

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

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