Skip to content

Commit 4f031d4

Browse files
committed
some fixes
1 parent e133826 commit 4f031d4

File tree

11 files changed

+1206
-126
lines changed

11 files changed

+1206
-126
lines changed

spec/swagger-schema.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,19 @@
4040
},
4141
"consumes": {
4242
"description": "A list of MIME types accepted by the API.",
43-
"$ref": "#/definitions/mediaTypeList"
43+
"allOf": [
44+
{
45+
"$ref": "#/definitions/mediaTypeList"
46+
}
47+
]
4448
},
4549
"produces": {
4650
"description": "A list of MIME types the API can produce.",
47-
"$ref": "#/definitions/mediaTypeList"
51+
"allOf": [
52+
{
53+
"$ref": "#/definitions/mediaTypeList"
54+
}
55+
]
4856
},
4957
"paths": {
5058
"$ref": "#/definitions/paths"
@@ -263,11 +271,19 @@
263271
},
264272
"produces": {
265273
"description": "A list of MIME types the API can produce.",
266-
"$ref": "#/definitions/mediaTypeList"
274+
"allOf": [
275+
{
276+
"$ref": "#/definitions/mediaTypeList"
277+
}
278+
]
267279
},
268280
"consumes": {
269281
"description": "A list of MIME types the API can consume.",
270-
"$ref": "#/definitions/mediaTypeList"
282+
"allOf": [
283+
{
284+
"$ref": "#/definitions/mediaTypeList"
285+
}
286+
]
271287
},
272288
"parameters": {
273289
"$ref": "#/definitions/parametersList"

src/Constraint/Ref.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,34 @@
22

33
namespace Swaggest\JsonSchema\Constraint;
44

5-
use Swaggest\JsonSchema\Schema;
6-
75
class Ref implements Constraint
86
{
97
public $ref;
10-
public function __construct($ref, Schema $schema = null)
8+
public function __construct($ref, $data = null)
119
{
1210
$this->ref = $ref;
13-
$this->schema = $schema;
11+
$this->data = $data;
1412
}
1513

16-
/** @var Schema */
17-
private $schema;
14+
/** @var mixed */
15+
private $data;
1816

1917
/**
20-
* @param Schema $schema
18+
* @param mixed $data
2119
* @return Ref
2220
*/
23-
public function setSchema($schema)
21+
public function setData($data)
2422
{
25-
$this->schema = $schema;
23+
$this->data = $data;
2624
return $this;
2725
}
2826

2927
/**
30-
* @return Schema
28+
* @return mixed
3129
* @throws \Exception
3230
*/
33-
public function getSchema()
31+
public function getData()
3432
{
35-
return $this->schema;
33+
return $this->data;
3634
}
3735
}

src/Constraint/UniqueItems.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace Swaggest\JsonSchema\Constraint;
44

55

6+
use Swaggest\JsonSchema\Structure\ObjectItem;
7+
68
class UniqueItems
79
{
810
/**
@@ -20,7 +22,9 @@ public static function isValid(array $data)
2022
if (is_bool($value)) {
2123
$value = '_______BOOL' . $value;
2224
}
23-
25+
if ($value instanceof ObjectItem) {
26+
$value = json_encode($value);
27+
}
2428
$tmp = &$index[$value];
2529
if ($tmp !== null) {
2630
return false;

0 commit comments

Comments
 (0)