refactor(ground): remove the unversioned-file fallback
- A file without a schema number is refused again; the example output in RAG/pierzainer_ground now has schema 2, so the temporary path is not needed. - The legacy fixture is removed; tests cover the missing and null schema numbers and a pier without a ground object. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bfd41d7c8d
commit
0e70cfb969
3 files changed
+9
-417
No files matched your search
@@ -37,16 +37,11 @@ function numOrNull(v: unknown): number | null {
|
||||
return typeof v === 'number' && Number.isFinite(v) ? v : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the shape of a parsed ground_model.json. Throws with the first problem named in Korean.
|
||||
* A file with no `schema` key is the layout written before the number was added: it is read as schema 1, and the
|
||||
* `ground` object is required so that a renamed field is refused instead of loading as empty values.
|
||||
* TODO: remove the no-schema branch once the 옛 파일 (examples/out) is regenerated with schema 1.
|
||||
*/
|
||||
/** Checks the shape of a parsed ground_model.json. Throws with the first problem named in Korean. */
|
||||
export function checkGroundModel(raw: unknown): GroundModelFile {
|
||||
const obj = raw as Partial<GroundModelFile> | null;
|
||||
if (!obj || typeof obj !== 'object') throw new Error('지반 모델 파일 형식이 아닙니다.');
|
||||
if (obj.schema !== undefined && !READABLE_SCHEMAS.includes(obj.schema)) {
|
||||
if (!READABLE_SCHEMAS.includes(obj.schema as number)) {
|
||||
throw new Error(`지반 모델 형식 번호 ${String(obj.schema)}을(를) 읽을 수 없습니다 (지원: ${READABLE_SCHEMAS.join(', ')}).`);
|
||||
}
|
||||
if (!Array.isArray(obj.piers)) throw new Error('지반 모델 파일에 교각 목록(piers)이 없습니다.');
|
||||
|
||||
Reference in new issue
Block a user