Skip to content

version 0.7 - BREAKING changes#33

Merged
Artifizer merged 5 commits intoGlobalTypeSystem:mainfrom
Artifizer:main
Dec 22, 2025
Merged

version 0.7 - BREAKING changes#33
Artifizer merged 5 commits intoGlobalTypeSystem:mainfrom
Artifizer:main

Conversation

@Artifizer
Copy link
Copy Markdown
Contributor

New breaking changes:

doc: recommend gts:// in JSON Schema $ref; tests: enforce invalid $ref errors
doc: strict schema/instance distinction based on $schema field

BREAKING CHANGE: Entity classification now strictly follows the rule that
a JSON document is a schema if and only if it has a "$schema" field.

This commit implements a clear distinction between 5 categories of GTS entities:

1. **GTS Schemas** - Have `$schema` field + `$id` with `gts://...~` format
2. **Non-GTS Schemas** - Have `$schema` but no valid GTS `$id` (unsupported)
3. **Well-Known Instances** - No `$schema`, `id` field contains GTS ID with chain
4. **Anonymous Instances** - No `$schema`, `id` field contains UUID, `type` field has GTS schema ID
5. **Unknown Instances** - No `$schema`, no identifiable schema (unsupported)

- **Before**: Schema detection used multiple heuristics (ID ending with `~`, `$id` field, `$schema` URL patterns)
- **After**: A document is a schema **if and only if** it has a `$schema` field
…ef errors

Document that JSON Schema $ref should be URI-compatible with gts://, same as $id,
and trimmed back to canonical gts.a.b.c.d... for resolution/registry keys.

Update OP#7 relationship-resolution fixtures to use gts:// for all schema refs.
Add OP#7 tests asserting POST /entities?validate=true returns 422 for:

  $ref that is not gts://...
  $ref that has gts:// but contains a malformed GTS identifier

Signed-off-by: Artifizer <artifizer@gmail.com>
Signed-off-by: Artifizer <artifizer@gmail.com>
Signed-off-by: Artifizer <artifizer@gmail.com>
@Artifizer Artifizer merged commit 9b5d165 into GlobalTypeSystem:main Dec 22, 2025
1 check passed
KvizadSaderah added a commit to KvizadSaderah/gts-python that referenced this pull request Dec 23, 2025
Implement Issues #25, #31, #32 from gts-spec v0.7:

Issue #25: Never use GTS ID in $schema
- Strict validation in _is_json_schema_entity()
- Reject gts.* IDs and gts:// URIs in $schema field
- Only JSON Schema URLs allowed
- Add validation in validate_schema() method

Issue #31: Normalize gts:// prefix in $id
- Strip gts:// prefix in _get_field_value()
- Applies to all entity_id_fields and schema_id_fields
- Automatic normalization during ID extraction

Issue #32: Strict $ref validation with gts:// requirement
- Add _validate_schema_refs() static method
- Require gts:// prefix for external GTS refs
- Allow local JSON Pointer refs (#/definitions/...)
- Reject bare GTS IDs and HTTP/HTTPS refs
- Reject malformed GTS IDs after gts:// prefix
- Integrate into validate_schema() as first validation step

Reference implementations:
- gts-rust PR #19: GlobalTypeSystem/gts-rust#19
- gts-spec PR #33: GlobalTypeSystem/gts-spec#33

Signed-off-by: Dmitrii Efremov <kaidendev@icloud.com>
KvizadSaderah added a commit to KvizadSaderah/gts-python that referenced this pull request Dec 23, 2025
Implement Issues #25, #31, #32 from gts-spec v0.7:

Issue #25: Never use GTS ID in $schema
- Strict validation in _is_json_schema_entity()
- Reject gts.* IDs and gts:// URIs in $schema field
- Only JSON Schema URLs allowed

Issue #31: Normalize gts:// prefix in $id
- Strip gts:// prefix in _get_field_value()
- Applies to all entity_id_fields and schema_id_fields
- Automatic normalization during ID extraction

Issue #32: Strict $ref validation with gts:// requirement
- Add _validate_schema_refs() static method
- Require gts:// prefix for external GTS refs
- Allow local JSON Pointer refs (#/definitions/...)
- Reject bare GTS IDs and HTTP/HTTPS refs
- Integrate into validate_schema() as first validation step

Reference implementations:
- gts-rust PR #19: GlobalTypeSystem/gts-rust#19
- gts-spec PR #33: GlobalTypeSystem/gts-spec#33

Signed-off-by: Dmitrii Efremov <kaidendev@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant