-
Notifications
You must be signed in to change notification settings - Fork 95
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
Find suitable value for oneOf property in parameters. Fix #166 #168
base: master
Are you sure you want to change the base?
Conversation
this PR fix #166 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs some fixing for negative cases
@@ -181,6 +183,14 @@ protected function convertToSerializationStyle($value, ?CebeSchema $schema) | |||
if ($schema && $this->style === self::STYLE_DEEP_OBJECT) { | |||
foreach ($value as $key => &$val) { | |||
$childSchema = $this->getChildSchema($schema, (string) $key); | |||
|
|||
if (isset($childSchema->oneOf)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like in this case we should immediately stop validation if we have filled oneOf and none of the schemas matched in findSuitableOneOf
.
|
||
try { | ||
$validator->validate($psrRequest); | ||
$this->assertTrue(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not proper way how to deal with exceptions and zero assertions. proper way would be (without any try..catch)
$validator->validate($psrRequest);
$this->addToAssrtionsCount(1);
any exception thrown here should break the test and if validate
throws one assertTrue(true)
is not called anyway
*/ | ||
final class Issue166Test extends BaseValidatorTest | ||
{ | ||
public function testIssue166(): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some negative cases required
No description provided.