Skip to content

Commit dc6cb01

Browse files
Apply same fix to scanForSubschemas method
Apply the same conditional check to scanForSubschemas to ensure consistency. This prevents definitions named 'enum' or 'const' from being skipped during subschema scanning. Co-authored-by: DannyvdSluijs <618940+DannyvdSluijs@users.noreply.github.com>
1 parent c241986 commit dc6cb01

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/JsonSchema/SchemaStorage.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ private function scanForSubschemas($schema, string $parentId): void
207207
$potentialSubSchemaId = $this->findSchemaIdInObject($potentialSubSchema);
208208
if (is_string($potentialSubSchemaId) && property_exists($potentialSubSchema, 'type')) {
209209
// Enum and const don't allow id as a keyword, see https://github.com/json-schema-org/JSON-Schema-Test-Suite/pull/471
210-
if (in_array($propertyName, ['enum', 'const'])) {
210+
// Only skip if we're in an actual schema context, not when 'enum'/'const' is a property/definition name
211+
if (in_array($propertyName, ['enum', 'const']) && $this->isSchemaObject($schema)) {
211212
continue;
212213
}
213214

0 commit comments

Comments
 (0)