Skip to content

Commit

Permalink
Fixed method convertJsonPointerIntoPropertyPath() that was not in the…
Browse files Browse the repository at this point in the history
… right class (JsonSchema\Constraints\Constraint instead of JsonSchema\Constraints\BaseConstraint). Closes jsonrainbow#654 (jsonrainbow#655)

Co-authored-by: Emmanuel GUITON <[email protected]>
Co-authored-by: Jordi Boggiano <[email protected]>
  • Loading branch information
3 people committed Jul 28, 2021
1 parent f0b8661 commit f4fce1b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
17 changes: 17 additions & 0 deletions src/JsonSchema/Constraints/BaseConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,21 @@ public static function arrayToObjectRecursive($array)

return (object) json_decode($json);
}

/**
* @param JsonPointer $pointer
*
* @return string property path
*/
protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
{
$result = array_map(
function ($path) {
return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
},
$pointer->getPropertyPaths()
);

return trim(implode('', $result), '.');
}
}
17 changes: 0 additions & 17 deletions src/JsonSchema/Constraints/Constraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,4 @@ protected function getTypeCheck()
{
return $this->factory->getTypeCheck();
}

/**
* @param JsonPointer $pointer
*
* @return string property path
*/
protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
{
$result = array_map(
function ($path) {
return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
},
$pointer->getPropertyPaths()
);

return trim(implode('', $result), '.');
}
}

0 comments on commit f4fce1b

Please sign in to comment.