@@ -142,13 +142,13 @@ |
||
142 | 142 | return $this; |
143 | 143 | |
144 | 144 | case 'model': |
145 | - case 'model!': |
|
145 | + case 'model!': |
|
146 | 146 | case 'definition': |
147 | - case 'definition!': |
|
147 | + case 'definition!': |
|
148 | 148 | $definition = new Schema($this); |
149 | 149 | if(substr($command, -1) === '!') { |
150 | - $definition->setReadOnly(); |
|
151 | - } |
|
150 | + $definition->setReadOnly(); |
|
151 | + } |
|
152 | 152 | $name = self::wordShift($data); |
153 | 153 | if (empty($name)) { |
154 | 154 | throw new \SwaggerGen\Exception('Missing definition name'); |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | */ |
52 | 52 | private $title = null; |
53 | 53 | |
54 | - /** |
|
55 | - * @var bool |
|
56 | - */ |
|
57 | - private $readOnly = null; |
|
54 | + /** |
|
55 | + * @var bool |
|
56 | + */ |
|
57 | + private $readOnly = null; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @var \SwaggerGen\Swagger\Type\AbstractType |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | return self::arrayFilterNull(array_merge($this->type->toArray(), array( |
119 | 119 | 'title' => empty($this->title) ? null : $this->title, |
120 | 120 | 'description' => empty($this->description) ? null : $this->description, |
121 | - 'readOnly' => $this->readOnly |
|
121 | + 'readOnly' => $this->readOnly |
|
122 | 122 | ), parent::toArray())); |
123 | 123 | } |
124 | 124 | |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | return __CLASS__; |
128 | 128 | } |
129 | 129 | |
130 | - public function setReadOnly() |
|
131 | - { |
|
132 | - $this->readOnly = true; |
|
133 | - } |
|
130 | + public function setReadOnly() |
|
131 | + { |
|
132 | + $this->readOnly = true; |
|
133 | + } |
|
134 | 134 | |
135 | 135 | } |
@@ -337,23 +337,23 @@ |
||
337 | 337 | . ',"tags":[{"name":"Test"}]}', json_encode($array, JSON_NUMERIC_CHECK)); |
338 | 338 | } |
339 | 339 | |
340 | - public function testObjectPropertiesReadOnly() |
|
341 | - { |
|
342 | - $object = new \SwaggerGen\SwaggerGen(); |
|
343 | - $array = $object->getSwagger(array(' |
|
340 | + public function testObjectPropertiesReadOnly() |
|
341 | + { |
|
342 | + $object = new \SwaggerGen\SwaggerGen(); |
|
343 | + $array = $object->getSwagger(array(' |
|
344 | 344 | api Test |
345 | 345 | endpoint /test |
346 | 346 | method GET something |
347 | 347 | response 200 object(a!:array(A),b:array(B)) |
348 | 348 | ')); |
349 | 349 | |
350 | - $this->assertSame('{"swagger":2,"info":{"title":"undefined","version":0}' |
|
351 | - . ',"paths":{"\/test":{"get":{"tags":["Test"],"summary":"something"' |
|
352 | - . ',"responses":{"200":{"description":"OK","schema":{"type":"object","required":["b"]' |
|
353 | - . ',"properties":{"a":{"type":"array","items":{"$ref":"#\/definitions\/A"}}' |
|
354 | - . ',"b":{"type":"array","items":{"$ref":"#\/definitions\/B"}}}}}}}}}' |
|
355 | - . ',"tags":[{"name":"Test"}]}', json_encode($array, JSON_NUMERIC_CHECK)); |
|
356 | - } |
|
350 | + $this->assertSame('{"swagger":2,"info":{"title":"undefined","version":0}' |
|
351 | + . ',"paths":{"\/test":{"get":{"tags":["Test"],"summary":"something"' |
|
352 | + . ',"responses":{"200":{"description":"OK","schema":{"type":"object","required":["b"]' |
|
353 | + . ',"properties":{"a":{"type":"array","items":{"$ref":"#\/definitions\/A"}}' |
|
354 | + . ',"b":{"type":"array","items":{"$ref":"#\/definitions\/B"}}}}}}}}}' |
|
355 | + . ',"tags":[{"name":"Test"}]}', json_encode($array, JSON_NUMERIC_CHECK)); |
|
356 | + } |
|
357 | 357 | |
358 | 358 | public function testDeepObjectProperties() |
359 | 359 | { |
@@ -81,20 +81,20 @@ |
||
81 | 81 | ), $object->toArray()); |
82 | 82 | } |
83 | 83 | |
84 | - /** |
|
85 | - * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct |
|
86 | - */ |
|
87 | - public function testConstructReadOnly() |
|
88 | - { |
|
89 | - $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string', 'Some words here', true); |
|
90 | - $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object); |
|
91 | - |
|
92 | - $this->assertSame(array( |
|
93 | - 'type' => 'string', |
|
94 | - 'description' => 'Some words here', |
|
95 | - 'readOnly' => true |
|
96 | - ), $object->toArray()); |
|
97 | - } |
|
84 | + /** |
|
85 | + * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct |
|
86 | + */ |
|
87 | + public function testConstructReadOnly() |
|
88 | + { |
|
89 | + $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string', 'Some words here', true); |
|
90 | + $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object); |
|
91 | + |
|
92 | + $this->assertSame(array( |
|
93 | + 'type' => 'string', |
|
94 | + 'description' => 'Some words here', |
|
95 | + 'readOnly' => true |
|
96 | + ), $object->toArray()); |
|
97 | + } |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | */ |
49 | 49 | private $description; |
50 | 50 | |
51 | - /** |
|
52 | - * Whether property is read only |
|
53 | - * @var bool |
|
54 | - */ |
|
51 | + /** |
|
52 | + * Whether property is read only |
|
53 | + * @var bool |
|
54 | + */ |
|
55 | 55 | private $readOnly; |
56 | 56 | |
57 | 57 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param \SwaggerGen\Swagger\AbstractObject $parent |
66 | 66 | * @param string $definition Either a built-in type or a definition name |
67 | 67 | * @param string $description description of the property |
68 | - * @param bool $readOnly Whether the property is read only |
|
68 | + * @param bool $readOnly Whether the property is read only |
|
69 | 69 | * @throws \SwaggerGen\Exception |
70 | 70 | */ |
71 | 71 | public function __construct(\SwaggerGen\Swagger\AbstractObject $parent, $definition, $description = null, $readOnly = null) |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | return self::arrayFilterNull(array_merge($valueType, array( |
132 | 132 | 'description' => empty($this->description) ? null : $this->description, |
133 | - 'readOnly' => $this->readOnly |
|
133 | + 'readOnly' => $this->readOnly |
|
134 | 134 | ), parent::toArray())); |
135 | 135 | } |
136 | 136 |