feat: Draft-06 support, adding $id and string content annotations#22
feat: Draft-06 support, adding $id and string content annotations#22tymondesigns merged 12 commits intomainfrom
Conversation
There was a problem hiding this comment.
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
$idsupport for all schema types through the newHasIdtrait - 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.
|
@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. |
|
@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. |
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@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. |
There was a problem hiding this comment.
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 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. |
There was a problem hiding this comment.
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>
|
cursor review |
PR SummaryMedium Risk Overview Introduces schema Extends string schemas with content annotations ( Updates docs/README and adds a docs-sync GitHub Action ( Written by Cursor Bugbot for commit 30d4aab. This will update automatically on new commits. Configure here. |
There was a problem hiding this comment.
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.
|
Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.
Or push these changes by commenting: 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; |

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$idare applied consistently across all schema types.Documentation updates for Draft-06 support:
Feature and format matrix improvements:
Converter enhancements for Draft-06 and content annotations:
JsonConverterto detect Draft-06 schemas, apply$idto 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:
String schema documentation improvements: