glideapps / glideapps/quicktype-custom-csharp-example

Multiple properties of the same type with default value

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

説明

Hello,
your example does not work if you have multiple properties of the same type with default value.
For example, I've added a property of type string and I want to set a default value.
```typescript
"properties": {
"name": { "type": "string", "default": "Emmerich" },
"test": { "type": "string", "default": "myTest" },
"position": { "$ref": "#/definitions/Coordinates" },
"hitPoints": { "type": "integer", "default": 100 }
},
```
The result is an exception
```
Error: Inconsistent default values
at DefaultValueTypeAttributeKind.combine (mypath\quicktype-custom-csharp-example\app.ts:100:23)
at combine (mypath\quicktype-custom-csharp-example\node_modules\quicktype-core\dist\TypeAttributes.js:93:25)
at Object.mapMap (mypath\quicktype-custom-csharp-example\node_modules\quicktype-core\dist\support\Containers.js:149:23)
at Object.combineTypeAttributes (mypath\quicktype-custom-csharp-example\node_modules\quicktype-core\dist\TypeAttributes.js:9
9:25)
at Object.combineTypeAttributesOfTypes (mypath\quicktype-custom-csharp-example\node_modules\quicktype-core\dist\TypeUtils.js
:81:29)
at GraphRemapBuilder.forceReconstituteTypeRef (mypath\quicktype-custom-csharp-example\node_modules\quicktype-core\dist\Graph
Rewriting.js:258:130)
at GraphRemapBuilder.reconstituteTypeRef (mypath\quicktype-custom-csharp-example\node_modules\quicktype-core\dist\GraphRewri
ting.js:170:21)
at TypeReconstituter.reconstitute (mypath\quicktype-custom-csharp-example\node_modules\quicktype-core\dist\GraphRewriting.js
:72:38)
at mypath\quicktype-custom-csharp-example\node_modules\quicktype-core\dist\Type.js:428:92
at Object.mapMap (mypath\quicktype-custom-csharp-example\node_modules\quicktype-core\dist\support\Containers.js:149:23)
```
Can you give us the right way to do that ?

thank you

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

このリポジトリのコントリビューションガイドは索引されていません

評価

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

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

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