From b79a969f19f4dbc35c73d821249cfe9f374c2fdf Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 15 Feb 2026 11:16:15 +0000 Subject: [PATCH] Fix: Add setter-time validation for contentEncoding() and contentMediaType() methods Both methods now call validateFeatureSupport() before setting values, making them consistent with contentSchema() and other Draft-07 feature setters (readOnly, writeOnly, comment). This ensures immediate validation when these methods are called on incompatible schema versions (e.g. Draft-06) rather than deferring errors until toArray() is called. --- src/Types/StringSchema.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Types/StringSchema.php b/src/Types/StringSchema.php index b37e146..1954b1f 100644 --- a/src/Types/StringSchema.php +++ b/src/Types/StringSchema.php @@ -79,6 +79,7 @@ public function pattern(string $pattern): static */ public function contentEncoding(string $contentEncoding): static { + $this->validateFeatureSupport(SchemaFeature::ContentEncoding); $this->contentEncoding = $contentEncoding; return $this; @@ -89,6 +90,7 @@ public function contentEncoding(string $contentEncoding): static */ public function contentMediaType(string $contentMediaType): static { + $this->validateFeatureSupport(SchemaFeature::ContentMediaType); $this->contentMediaType = $contentMediaType; return $this;