Skip to content

Commit a76920f

Browse files
committed
fix: update tests to match gts-spec v0.7 breaking changes
Update 4 tests in test_entities.py to reflect Issue #25 changes: - test_default_config: $schema no longer in schema_id_fields - test_entity_schema_detection_gts_uri: gts:// in $schema NOT recognized as schema - test_entity_schema_detection_gts_prefix: gts. prefix in $schema NOT recognized as schema - test_entity_schema_id_calculation: use 'type' field instead of $schema These tests were checking old behavior (pre-v0.7) where GTS IDs could be used in $schema field. Per Issue #25, only JSON Schema URLs are allowed in $schema. All 108 tests now pass. Signed-off-by: Dmitrii Efremov <kaidendev@icloud.com>
1 parent ba713b1 commit a76920f

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

tests/test_entities.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def test_default_config(self):
7878
"""Test default config has expected fields."""
7979
assert "$id" in DEFAULT_GTS_CONFIG.entity_id_fields
8080
assert "gtsId" in DEFAULT_GTS_CONFIG.entity_id_fields
81-
assert "$schema" in DEFAULT_GTS_CONFIG.schema_id_fields
81+
# Issue #25: $schema should NOT be in schema_id_fields (only JSON Schema URLs allowed)
82+
assert "$schema" not in DEFAULT_GTS_CONFIG.schema_id_fields
8283
assert "gtsType" in DEFAULT_GTS_CONFIG.schema_id_fields
8384

8485

@@ -119,26 +120,28 @@ def test_entity_schema_detection_https(self):
119120
assert entity.is_schema is True
120121

121122
def test_entity_schema_detection_gts_uri(self):
122-
"""Test schema detection via gts:// URI."""
123+
"""Test that gts:// URI in $schema is NOT recognized as schema (Issue #25)."""
123124
entity = GtsEntity(
124125
content={
125126
"$schema": "gts://vendor.package.namespace.meta.v1~",
126127
"type": "object",
127128
},
128129
)
129130

130-
assert entity.is_schema is True
131+
# Issue #25: GTS IDs (even with gts:// prefix) in $schema should NOT be recognized as schemas
132+
assert entity.is_schema is False
131133

132134
def test_entity_schema_detection_gts_prefix(self):
133-
"""Test schema detection via gts. prefix."""
135+
"""Test that gts. prefix in $schema is NOT recognized as schema (Issue #25)."""
134136
entity = GtsEntity(
135137
content={
136138
"$schema": "gts.vendor.package.namespace.meta.v1~",
137139
"type": "object",
138140
},
139141
)
140142

141-
assert entity.is_schema is True
143+
# Issue #25: GTS IDs in $schema should NOT be recognized as schemas
144+
assert entity.is_schema is False
142145

143146
def test_entity_not_schema(self):
144147
"""Test non-schema entity."""
@@ -163,17 +166,18 @@ def test_entity_id_calculation(self):
163166
assert entity.selected_entity_field == "$id"
164167

165168
def test_entity_schema_id_calculation(self):
166-
"""Test schema ID calculation from content fields."""
169+
"""Test schema ID calculation from content fields (not from $schema per Issue #25)."""
167170
entity = GtsEntity(
168171
content={
169-
"$schema": "gts.vendor.package.namespace.type.v1~",
172+
"type": "gts.vendor.package.namespace.type.v1~",
170173
"name": "test",
171174
},
172175
cfg=DEFAULT_GTS_CONFIG,
173176
)
174177

178+
# Issue #25: $schema is no longer used for schema_id, use 'type' field instead
175179
assert entity.schemaId == "gts.vendor.package.namespace.type.v1~"
176-
assert entity.selected_schema_id_field == "$schema"
180+
assert entity.selected_schema_id_field == "type"
177181

178182
def test_entity_label_from_file(self):
179183
"""Test entity label derived from file."""

0 commit comments

Comments
 (0)