(errors: string[], path: string, c: PrefabChild, seenIds: Set<string>)
| 122 | } |
| 123 | |
| 124 | function validatePrefabChild(errors: string[], path: string, c: PrefabChild, seenIds: Set<string>): void { |
| 125 | if (!c) { |
| 126 | errors.push(path + ' is null'); |
| 127 | return; |
| 128 | } |
| 129 | if (typeof c.id !== 'string' || c.id.length === 0) { |
| 130 | errors.push(path + '.id must be a non-empty string'); |
| 131 | } else if (seenIds.has(c.id)) { |
| 132 | errors.push(path + '.id "' + c.id + '" is duplicated'); |
| 133 | } else { |
| 134 | seenIds.add(c.id); |
| 135 | } |
| 136 | |
| 137 | const hasModel = typeof c.modelRef === 'string' && c.modelRef.length > 0; |
| 138 | const hasPrefab = typeof c.prefabRef === 'string' && c.prefabRef.length > 0; |
| 139 | if (hasModel === hasPrefab) { |
| 140 | errors.push(path + ' must have exactly one of modelRef or prefabRef'); |
| 141 | } |
| 142 | |
| 143 | validateTransform(errors, path + '.transform', c.transform); |
| 144 | } |
| 145 | |
| 146 | function validateTransform(errors: string[], path: string, t: TransformData): void { |
| 147 | if (!t) { |
no test coverage detected