Skip to content

Commit 90bdae7

Browse files
committed
implement header
1 parent a72dda0 commit 90bdae7

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/spec/Header.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@
1919
* @link https://github.com/OAI/OpenAPI-Specification/blob/3.0.2/versions/3.0.2.md#headerObject
2020
*
2121
*/
22-
class Header
22+
class Header extends Parameter
2323
{
24-
// TODO implement
24+
public function performValidation()
25+
{
26+
if (!empty($this->name)) {
27+
$this->addError("'name' must not be specified in Header Object.");
28+
}
29+
if (!empty($this->in)) {
30+
$this->addError("'in' must not be specified in Header Object.");
31+
}
32+
if (!empty($this->content) && !empty($this->schema)) {
33+
$this->addError("A Header Object MUST contain either a schema property, or a content property, but not both. ");
34+
}
35+
}
2536
}

src/spec/Parameter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected function performValidation()
7171
}
7272
}
7373
if (!empty($this->content) && !empty($this->schema)) {
74-
$this->addError("A parameter MUST contain either a schema property, or a content property, but not both. ");
74+
$this->addError("A Parameter Object MUST contain either a schema property, or a content property, but not both. ");
7575
}
7676
}
7777
}

0 commit comments

Comments
 (0)