Skip to content

feat: Draft-06 support, adding $id and string content annotations#22

Merged
tymondesigns merged 12 commits intomainfrom
feat/draft-06
Feb 15, 2026
Merged

feat: Draft-06 support, adding $id and string content annotations#22
tymondesigns merged 12 commits intomainfrom
feat/draft-06

Conversation

@tymondesigns
Copy link
Contributor

@tymondesigns tymondesigns commented Feb 5, 2026

This pull request adds support for JSON Schema Draft-06 throughout the documentation and codebase, making it the new default for maximum compatibility with older tools. It updates all feature and format support tables, revises documentation to highlight Draft-06, and extends the converter logic to properly detect and handle Draft-06 schemas. Additionally, it improves string schema support by enabling content annotations (contentEncoding, contentMediaType, contentSchema) and ensures shared fields like $id are applied consistently across all schema types.

Documentation updates for Draft-06 support:

  • Added Draft-06 as a supported version in all documentation, updated feature and format tables, and revised recommendations to make Draft-06 the default for maximum compatibility. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

Feature and format matrix improvements:

  • Updated all feature and format support tables to include Draft-06, clarified which features/formats require Draft-07 or later, and added new format rows for extended string types. [1] [2] [3] [4]

Converter enhancements for Draft-06 and content annotations:

  • Extended JsonConverter to detect Draft-06 schemas, apply $id to all schema types, and support content annotations (contentEncoding, contentMediaType, contentSchema) for string schemas. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Default version and compatibility messaging:

  • Changed all documentation and code examples to recommend Draft-06 as the default version for maximum compatibility, replacing previous recommendations for Draft-07. [1] [2] [3] [4] [5]

String schema documentation improvements:

  • Clarified which string formats and annotations require Draft-07 or later, and added documentation/examples for content annotations and their version requirements. [1] [2]

@tymondesigns tymondesigns changed the title feat: Draft-06 support feat: Draft-06 support, adding $id and string content annotations Feb 5, 2026
@tymondesigns tymondesigns marked this pull request as ready for review February 5, 2026 23:23
@tymondesigns tymondesigns requested a review from Copilot February 5, 2026 23:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for JSON Schema Draft-06 throughout the codebase, making it available as an option for maximum compatibility with older tools. The PR also introduces string content annotation support (contentEncoding, contentMediaType, contentSchema) and ensures the $id field can be applied to all schema types. Additionally, it updates all documentation and feature support matrices to include Draft-06.

Changes:

  • Added Draft-06 as a supported schema version with proper enum values, names, and year mappings
  • Extended format validation to properly restrict Draft-07+ formats (date, time, regex, relative-json-pointer, idn-email, idn-hostname, iri, iri-reference) when using Draft-06
  • Implemented $id support for all schema types through the new HasId trait
  • Added content annotation support (contentEncoding, contentMediaType, contentSchema) for string schemas with validation for contentSchema (Draft 2019-09+)
  • Updated all documentation to include Draft-06 in feature matrices and recommend it for maximum compatibility

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Enums/SchemaVersion.php Added Draft_06 enum case with URI, name, and year (2017)
src/Enums/SchemaFeature.php Added feature cases for Draft-07 formats and $comment, defined minimum versions
src/Enums/SchemaFormat.php Added IdnHostname format enum case
src/Types/StringSchema.php Added content annotation methods and properties, integrated into toArray()
src/Types/AbstractSchema.php Integrated HasId trait and added $id to schema output
src/Types/Concerns/HasId.php New trait providing $id functionality for all schema types
src/Types/Concerns/HasReadWrite.php Added feature validation for readOnly/writeOnly (Draft-07+)
src/Types/Concerns/HasMetadata.php Added feature validation for comment (Draft-07+) and feature reporting
src/Types/Concerns/HasFormat.php Extended format validation for Draft-07+ formats
src/Types/Concerns/HasValidation.php Added decodeContent option to validator for content validation
src/Types/Concerns/ValidatesVersionFeatures.php Changed to use feature support check instead of hardcoded version
src/Converters/JsonConverter.php Added Draft-06 detection, $id application, and content annotation conversion
tests/Unit/VersionSupportTest.php Added tests for Draft-06 version values, names, years, and feature support
tests/Unit/VersionFeatureValidationTest.php Added tests for Draft-06 feature validation (comment, readOnly/writeOnly, formats)
tests/Unit/Types/StringSchemaTest.php Added tests for content annotations with validation
tests/Unit/IdSchemaTest.php New test file for $id functionality
tests/Unit/Converters/JsonConverterTest.php Added tests for Draft-06 detection and content annotation conversion
docs/*.mdx Updated all documentation to include Draft-06 in feature matrices and examples
README.md Updated to mention Draft-06 support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Feb 5, 2026

@tymondesigns I've opened a new pull request, #23, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Feb 5, 2026

@tymondesigns I've opened a new pull request, #24, to work on those changes. Once the pull request is ready, I'll request review from you.

@tymondesigns
Copy link
Contributor Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Feb 5, 2026

@tymondesigns I've opened a new pull request, #25, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits February 5, 2026 23:49
)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tymondesigns <1801923+tymondesigns@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@tymondesigns tymondesigns requested a review from Copilot February 6, 2026 00:00
Copy link
Contributor

Copilot AI commented Feb 6, 2026

@tymondesigns I've opened a new pull request, #26, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 30 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@cortexphp cortexphp deleted a comment from cursor bot Feb 15, 2026
@tymondesigns
Copy link
Contributor Author

cursor review

@cursor
Copy link

cursor bot commented Feb 15, 2026

PR Summary

Medium Risk
Touches core schema generation and validation behavior (new version handling, $id, and decoded-content validation), which could subtly change output/validation results across versions despite strong test coverage.

Overview
Adds JSON Schema Draft-06 support end-to-end: SchemaVersion now includes Draft_06, JsonConverter can detect it from $schema, and keyword selection for definitions now correctly falls back to definitions when $defs isn’t supported.

Introduces schema $id support across all schema types via a new HasId concern and updates JsonConverter to propagate $id from JSON into converted schemas.

Extends string schemas with content annotations (contentEncoding, contentMediaType, contentSchema) including JSON conversion support, feature/version gating, and validator configuration (decodeContent) to enable decoded-content validation.

Updates docs/README and adds a docs-sync GitHub Action (sync-docs.yml) to dispatch changes in docs/** to cortexphp/docs, alongside expanded unit tests covering Draft-06, $id, and content annotations and some test namespace cleanup.

Written by Cursor Bugbot for commit 30d4aab. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON. A Cloud Agent has been kicked off to fix the reported issue.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@cursor
Copy link

cursor bot commented Feb 15, 2026

Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.

  • ✅ Fixed: Missing setter-time validation for content annotation methods
    • Added validateFeatureSupport() calls to both contentEncoding() and contentMediaType() methods, making them consistent with contentSchema() and other Draft-07 feature setters.

View PR

Or push these changes by commenting:

@cursor push b79a969f19
Preview (b79a969f19)
diff --git a/src/Types/StringSchema.php b/src/Types/StringSchema.php
--- a/src/Types/StringSchema.php
+++ b/src/Types/StringSchema.php
@@ -79,6 +79,7 @@
      */
     public function contentEncoding(string $contentEncoding): static
     {
+        $this->validateFeatureSupport(SchemaFeature::ContentEncoding);
         $this->contentEncoding = $contentEncoding;
 
         return $this;
@@ -89,6 +90,7 @@
      */
     public function contentMediaType(string $contentMediaType): static
     {
+        $this->validateFeatureSupport(SchemaFeature::ContentMediaType);
         $this->contentMediaType = $contentMediaType;
 
         return $this;

@tymondesigns tymondesigns merged commit 76bba55 into main Feb 15, 2026
19 checks passed
@tymondesigns tymondesigns deleted the feat/draft-06 branch February 15, 2026 11:32
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.

2 participants