Skip to content

Commit

Permalink
chore(zms-3235): fixed some schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabinatix97 committed Feb 5, 2025
1 parent d50a84b commit 2682444
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion zmsentities/schema/department.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}
]
},
"additionalProperties": false,
"additionalProperties": true,
"properties": {
"id": {
"type": "number"
Expand Down
2 changes: 1 addition & 1 deletion zmsentities/schema/dereferenced/process.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
"description": "estimated time in minutes to wait for a call (optimistic value for views with timespan)"
},
"withAppointment": {
"type": "boolean",
"type": ["integer", "boolean"],
"description": "true if corresponding process has an appointment",
"default": false
},
Expand Down
2 changes: 1 addition & 1 deletion zmsentities/schema/dereferenced/queue.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"description": "estimated time in minutes to wait for a call (optimistic value for views with timespan)"
},
"withAppointment": {
"type": "boolean",
"type": ["integer", "boolean"],
"description": "true if corresponding process has an appointment",
"default": false
},
Expand Down
2 changes: 1 addition & 1 deletion zmsentities/schema/dereferenced/session.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"type": "string"
},
"clientTelehone": {
"type": "number"
"type": "string"
},
"clientAmendment": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion zmsentities/schema/queue.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"description": "estimated time in minutes to wait for a call (optimistic value for views with timespan)"
},
"withAppointment": {
"type": "boolean",
"type": ["integer", "boolean"],
"description": "true if corresponding process has an appointment",
"default": false
},
Expand Down
6 changes: 3 additions & 3 deletions zmsentities/schema/session.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@
},
"scope": {
"type": [
"number"
"string"
]
},
"process": {
"type": [
"number"
"string"
]
},
"date": {
"type": [
"number"
"string"
]
},
"firstDay": {
Expand Down
5 changes: 5 additions & 0 deletions zmsentities/src/Zmsentities/Schema/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public function __construct($data, Schema $schemaObject, $locale)
// Convert data to JSON object
$data = json_decode(json_encode($data));

// Debugging
// var_dump("Schema:", json_encode($schemaJson, JSON_PRETTY_PRINT));
// var_dump("*********************************************");
// var_dump("Data:", json_encode($data, JSON_PRETTY_PRINT));

// Set max errors and validate
$this->validator->setMaxErrors(1000);
$this->validator->setStopAtFirstError(false);
Expand Down
12 changes: 6 additions & 6 deletions zmsentities/tests/Zmsentities/DayoffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,27 @@ protected function getDayOffExampleList()
{
$list = [
[
"date" => "1458856800",
"date" => 1458856800,
"name" => "Karfreitag"
],
[
"date" => "1459116000",
"date" => 1459116000,
"name" => "Ostermontag"
],
[
"date" => "1462053600",
"date" => 1462053600,
"name" => "Maifeiertag"
],
[
"date" => "1462399200",
"date" => 1462399200,
"name" => "Christi Himmelfahrt"
],
[
"date" => "1463349600",
"date" => 1463349600,
"name" => "Pfingstmontag"
],
[
"date" => "1475445600",
"date" => 1475445600,
"name" => "Tag der Deutschen Einheit"
]
];
Expand Down
2 changes: 1 addition & 1 deletion zmsentities/tests/Zmsentities/SchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function getTestEntityMapping()
'contact__country' => 'Germany',
'contact__name' => 'Flughafen Schönefeld, Landebahn',
'email' => '[email protected]',
'id' => '1234',
'id' => 1234,
'name' => 'Flughafen Schönefeld, Landebahn',
'preferences__notifications__enabled' => true,
'preferences__notifications__identification' => '[email protected]',
Expand Down
4 changes: 2 additions & 2 deletions zmsentities/tests/Zmsentities/UseraccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public function testWithDepartmentListIds()
$entity = $this->getExample();
unset($entity->departments);
$entity->departments = array(
'141',
'143'
141,
143
);
$entity = $entity->withDepartmentList();
$this->assertEquals(2, $entity->getDepartmentList()->count());
Expand Down
10 changes: 6 additions & 4 deletions zmsentities/tests/Zmsentities/ValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function testTestValidObject()
$this->fail("Expected exception SchemaValidation not thrown");
} catch (\BO\Zmsentities\Exception\SchemaValidation $exception) {
foreach ($exception->data as $error) {
$error = $exception->data['/preferences/client/emailFrom'];
$this->assertContainsEquals(
'Die E-Mail Adresse muss eine valide E-Mail im Format [email protected] sein',
$error['messages']
Expand All @@ -44,6 +45,7 @@ public function testTestValidObjectReference()
$this->fail("Expected exception SchemaValidation not thrown");
} catch (\BO\Zmsentities\Exception\SchemaValidation $exception) {
foreach ($exception->data as $error) {
$error = $exception->data['/contact/email'];
$this->assertContainsEquals(
'Die E-Mail Adresse muss eine valide E-Mail im Format [email protected] sein',
$error['messages']
Expand All @@ -63,10 +65,10 @@ public function testLocale()
$this->fail("Expected exception SchemaValidation not thrown");
} catch (\BO\Zmsentities\Exception\SchemaValidation $exception) {
$errorList = $exception->data;
// merge conflict, the following two lines might fail??
$this->assertEquals('changePassword', key($errorList));
$this->assertArrayHasKey('minLength', $errorList['changePassword']['messages']);
$this->assertArrayHasKey('format', $errorList['changePassword']['messages']);
var_dump($errorList);
$this->assertArrayHasKey('/changePassword', $errorList);
$this->assertArrayHasKey('minLength', $errorList['/changePassword/0']['messages']);
$this->assertArrayHasKey('format', $errorList['/changePassword/0']['messages']);
}
}
}

0 comments on commit 2682444

Please sign in to comment.