From 646f04bb42da359eca93a2a66b2fb6fe79b7636d Mon Sep 17 00:00:00 2001 From: Marco Hutter Date: Sun, 12 May 2024 16:23:40 +0200 Subject: [PATCH] Use underscore in auto-generated schema IDs --- specs/tools/migration/TileFormatsMigrationSpec.ts | 2 +- src/tools/gltfExtensionsUtils/StructuralMetadataMerger.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/specs/tools/migration/TileFormatsMigrationSpec.ts b/specs/tools/migration/TileFormatsMigrationSpec.ts index 37a3dd5..9bda869 100644 --- a/specs/tools/migration/TileFormatsMigrationSpec.ts +++ b/specs/tools/migration/TileFormatsMigrationSpec.ts @@ -88,7 +88,7 @@ describe("TileFormatsMigration", function () { //SpecHelpers.forceDeleteDirectory(outputDir); }); beforeEach(function () { - StructuralMetadataMerger.setMergedSchemaIdSuffix("SPEC-SCHEMA-ID-SUFFIX"); + StructuralMetadataMerger.setMergedSchemaIdSuffix("SPEC_SCHEMA_ID_SUFFIX"); }); //========================================================================== diff --git a/src/tools/gltfExtensionsUtils/StructuralMetadataMerger.ts b/src/tools/gltfExtensionsUtils/StructuralMetadataMerger.ts index 90214c3..f5c94f5 100644 --- a/src/tools/gltfExtensionsUtils/StructuralMetadataMerger.ts +++ b/src/tools/gltfExtensionsUtils/StructuralMetadataMerger.ts @@ -247,7 +247,8 @@ export class StructuralMetadataMerger { if (schemaIdSuffix === undefined) { schemaIdSuffix = crypto.randomUUID(); } - const newId = "SCHEMA-ID-" + schemaIdSuffix; + schemaIdSuffix = schemaIdSuffix.replace(/-/g, "_"); + const newId = "SCHEMA_ID_" + schemaIdSuffix; log("Target schema was modified - assigning ID " + newId); targetSchema.setId(newId); }