Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ class Context extends MagicMap

public $isRef = false;

/**
* Dereference $ref unless there is a $ref property defined with format not equal to `uri-reference`.
* Default JSON Schema behavior is to dereference only if there is a $ref property defined with format
* equal to `uri-reference`.
*
* @var bool
*/
public $dereference = false;

/**
* @param boolean $skipValidation
* @return Context
Expand Down
6 changes: 3 additions & 3 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ private function processObject($data, Context $options, $path, $result = null)
try {

$refProperty = null;
$dereference = false;
$dereference = $options->dereference;

if ($this->properties !== null && isset($array[self::PROP_REF])) {
$refPropName = self::PROP_REF;
Expand All @@ -675,8 +675,8 @@ private function processObject($data, Context $options, $path, $result = null)

$refProperty = $this->properties[$refPropName];

if (isset($refProperty) && ($refProperty->format === Format::URI_REFERENCE)) {
$dereference = true;
if (isset($refProperty)) {
$dereference = $refProperty->format === Format::URI_REFERENCE;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Structure/ClassStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Swaggest\JsonSchema\Structure;

abstract class ClassStructure implements ClassStructureContract
abstract class ClassStructure implements ClassStructureContract, WithResolvedValue
{
use ClassStructureTrait;
}