Skip to content
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

[feat] add Json::assertMatchesSchema() #102

Merged
merged 1 commit into from
Aug 26, 2022

Conversation

nikophil
Copy link
Member

No description provided.

@@ -110,6 +111,26 @@ public function assertThatEach(string $selector, callable $assert): void
foreach ($value as $item) {
$assert(self::encode($item));
}

return $this;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops 😅

}

$validator = new Validator();
$decoded = \json_decode($this->source, null, 512, \JSON_THROW_ON_ERROR);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

justinrainbow/json-schema actually requests a \stdclass

return $this;
}

public function assertMatchesSchema(string $jsonSchema): self
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not require a file name here, because it would prevent users to provide json "hard coded"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

@nikophil nikophil marked this pull request as ready for review August 25, 2022 07:19
@kbond kbond merged commit 29171b7 into zenstruck:1.x Aug 26, 2022
@kbond
Copy link
Member

kbond commented Aug 26, 2022

Thanks @nikophil!

@kbond kbond mentioned this pull request Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants