-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from swaggest/deep-ref-export
keep intermediate references in path
- Loading branch information
Showing
10 changed files
with
269 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Swaggest\JsonSchema\Tests\Helper; | ||
|
||
|
||
use Swaggest\JsonSchema\Constraint\Properties; | ||
use Swaggest\JsonSchema\Schema; | ||
use Swaggest\JsonSchema\Structure\ClassStructure; | ||
|
||
class DeepRefAnotherTitle extends ClassStructure | ||
{ | ||
/** | ||
* @param Properties|static $properties | ||
* @param Schema $ownerSchema | ||
*/ | ||
public static function setUpProperties($properties, Schema $ownerSchema) | ||
{ | ||
$ownerSchema->setFromRef('http://json-schema.org/draft-04/schema#/properties/title'); | ||
$ownerSchema->setFromRef('#/definitions/anotherTitle'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Swaggest\JsonSchema\Tests\Helper; | ||
|
||
use Swaggest\JsonSchema\Constraint\Properties; | ||
use Swaggest\JsonSchema\Schema; | ||
use Swaggest\JsonSchema\Structure\ClassStructure; | ||
|
||
class DeepRefProperty extends ClassStructure | ||
{ | ||
/** | ||
* @param Properties|static $properties | ||
* @param Schema $ownerSchema | ||
*/ | ||
public static function setUpProperties($properties, Schema $ownerSchema) | ||
{ | ||
$ownerSchema->type = Schema::OBJECT; | ||
$ownerSchema->setFromRef('#/definitions/lvlA'); | ||
$ownerSchema->setFromRef('#/definitions/lvlB'); | ||
$ownerSchema->setFromRef('#/definitions/lvlC'); | ||
$ownerSchema->setFromRef('#/definitions/lvlD'); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Swaggest\JsonSchema\Tests\Helper; | ||
|
||
|
||
use Swaggest\JsonSchema\Constraint\Properties; | ||
use Swaggest\JsonSchema\Schema; | ||
use Swaggest\JsonSchema\Structure\ClassStructure; | ||
|
||
class DeepRefRoot extends ClassStructure | ||
{ | ||
public $directTitle; | ||
|
||
public $intermediateTitle; | ||
|
||
public $anotherTitle; | ||
|
||
public $prop; | ||
|
||
/** | ||
* @param Properties|static $properties | ||
* @param Schema $ownerSchema | ||
*/ | ||
public static function setUpProperties($properties, Schema $ownerSchema) | ||
{ | ||
$properties->prop = DeepRefProperty::schema(); | ||
|
||
$properties->directTitle = new Schema(); | ||
$properties->directTitle->ref = 'http://json-schema.org/draft-04/schema#/properties/title'; | ||
|
||
$properties->intermediateTitle = DeepRefTitle::schema(); | ||
|
||
$properties->anotherTitle = DeepRefAnotherTitle::schema(); | ||
|
||
$ownerSchema->type = Schema::STRING; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Swaggest\JsonSchema\Tests\Helper; | ||
|
||
|
||
use Swaggest\JsonSchema\Constraint\Properties; | ||
use Swaggest\JsonSchema\Schema; | ||
use Swaggest\JsonSchema\Structure\ClassStructure; | ||
|
||
class DeepRefTitle extends ClassStructure | ||
{ | ||
/** | ||
* @param Properties|static $properties | ||
* @param Schema $ownerSchema | ||
*/ | ||
public static function setUpProperties($properties, Schema $ownerSchema) | ||
{ | ||
$ownerSchema->setFromRef('http://json-schema.org/draft-04/schema#/properties/title'); | ||
$ownerSchema->setFromRef('#/definitions/title'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters