Skip to content

Do not require error links object to contain an about member #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2019
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
3 changes: 0 additions & 3 deletions src/Parsers/LinksParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ public function parse($data, string $source): Links
if (!is_object($data)) {
throw new ValidationException(sprintf('Links MUST be an object, "%s" given.', gettype($data)));
}
if ($source === self::SOURCE_ERROR && !property_exists($data, 'about')) {
throw new ValidationException('Error links object MUST contain at least one of the following properties: `about`.');
}
if ($source === self::SOURCE_RELATIONSHIP && !property_exists($data, 'self') && !property_exists($data, 'related')) {
throw new ValidationException('Relationship links object MUST contain at least one of the following properties: `self`, `related`.');
}
Expand Down
13 changes: 0 additions & 13 deletions tests/Parsers/LinksParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,6 @@ public function it_throws_when_related_link_is_null()
$parser->parse(json_decode('{"related": null}', false), LinksParser::SOURCE_DOCUMENT);
}

/**
* @test
*/
public function it_throws_when_error_links_misses_about_link()
{
$parser = new LinksParser($this->createMock(MetaParser::class));

$this->expectException(ValidationException::class);
$this->expectExceptionMessage('Error links object MUST contain at least one of the following properties: `about`.');

$parser->parse(json_decode('{}', false), LinksParser::SOURCE_ERROR);
}

/**
* @test
*/
Expand Down