Skip to content

Commit

Permalink
Merge pull request #666 from ergebnis/dependabot/composer/ergebnis/js…
Browse files Browse the repository at this point in the history
…on-schema-validator-3.0.0

composer(deps): bump ergebnis/json-schema-validator from 2.0.0 to 3.0.0
  • Loading branch information
localheinz committed Jan 30, 2022
2 parents 26684d6 + 3ebf8d8 commit bd700d2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

For a full diff see [`2.2.0...main`][2.2.0...main].

### Changed

- Required `ergebnis/json-schema-validator:^3.0.0` ([#666]), by [@dependabot]

## [`2.2.0`][2.2.0]

For a full diff see [`2.1.0...2.2.0`][2.1.0...2.2.0].
Expand Down Expand Up @@ -476,6 +480,7 @@ For a full diff see [`5d8b3e2...0.1.0`][5d8b3e2...0.1.0].
[#632]: https://github.com/ergebnis/json-normalizer/pull/632
[#639]: https://github.com/ergebnis/json-normalizer/pull/639
[#641]: https://github.com/ergebnis/json-normalizer/pull/641
[#666]: https://github.com/ergebnis/json-normalizer/pull/666

[@BackEndTea]: https://github.com/BackEndTea
[@dependabot]: https://github.com/dependabot
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -23,7 +23,7 @@
"ext-json": "*",
"ergebnis/json-pointer": "^2.1.0",
"ergebnis/json-printer": "^3.2.0",
"ergebnis/json-schema-validator": "^2.0.0",
"ergebnis/json-schema-validator": "^3.0.0",
"justinrainbow/json-schema": "^5.2.11"
},
"require-dev": {
Expand Down
29 changes: 15 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/SchemaNormalizer.php
Expand Up @@ -13,6 +13,7 @@

namespace Ergebnis\Json\Normalizer;

use Ergebnis\Json\Pointer;
use Ergebnis\Json\SchemaValidator;
use JsonSchema\Exception\InvalidSchemaMediaTypeException;
use JsonSchema\Exception\JsonDecodingException;
Expand Down Expand Up @@ -53,7 +54,7 @@ public function normalize(Json $json): Json
$resultBeforeNormalization = $this->schemaValidator->validate(
SchemaValidator\Json::fromString($json->encoded()),
SchemaValidator\Json::fromString(\json_encode($schema)),
SchemaValidator\JsonPointer::empty(),
Pointer\JsonPointer::document(),
);

if (!$resultBeforeNormalization->isValid()) {
Expand All @@ -73,7 +74,7 @@ public function normalize(Json $json): Json
$resultAfterNormalization = $this->schemaValidator->validate(
SchemaValidator\Json::fromString($normalized->encoded()),
SchemaValidator\Json::fromString(\json_encode($schema)),
SchemaValidator\JsonPointer::empty(),
Pointer\JsonPointer::document(),
);

if (!$resultAfterNormalization->isValid()) {
Expand Down Expand Up @@ -238,7 +239,7 @@ private function resolveSchema(
$result = $this->schemaValidator->validate(
SchemaValidator\Json::fromString(\json_encode($data)),
SchemaValidator\Json::fromString(\json_encode($anyOfSchema)),
SchemaValidator\JsonPointer::empty(),
Pointer\JsonPointer::document(),
);

if ($result->isValid()) {
Expand All @@ -261,7 +262,7 @@ private function resolveSchema(
$result = $this->schemaValidator->validate(
SchemaValidator\Json::fromString(\json_encode($data)),
SchemaValidator\Json::fromString(\json_encode($oneOfSchema)),
SchemaValidator\JsonPointer::empty(),
Pointer\JsonPointer::document(),
);

if ($result->isValid()) {
Expand Down

0 comments on commit bd700d2

Please sign in to comment.