Skip to content
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
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@
}
],
"repositories": [
{"type": "vcs", "no-api": true, "url": "[email protected]:jobcloud/php-kafka-schema-registry-client.git"}
{
"type": "vcs", "no-api": true, "url": "[email protected]:jobcloud/php-kafka-schema-registry-client.git"
}
],
"require": {
"ext-json": "*",
"flix-tech/avro-php": "^3.0|^4.0",
"symfony/console": "^4.3|^5.1",
"pimple/pimple": "^3.2",
"jobcloud/php-kafka-schema-registry-client": "^0.1",
"guzzlehttp/guzzle": "^6.3|^7.3",
"ext-json": "*"
"guzzlehttp/guzzle": "^6.3|^7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
Expand Down
2 changes: 1 addition & 1 deletion docker/dev/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.3-cli-alpine3.13
FROM php:7.3-cli-alpine3.14

ARG HOST_USER_ID

Expand Down
8 changes: 4 additions & 4 deletions src/Command/CheckAllSchemaTemplatesDefaultTypeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ protected function configure(): void
{
$this
->setName('kafka-schema-registry:check:template:default:type:all')
->setDescription('Checks for default value type for all schema templates in folder')
->setHelp('Checks for default value type for all schema templates in folder')
->setDescription('Checks if default type is the first type in union for all schema templates in folder')
->setHelp('Checks if default type is the first type in union for all schema templates in folder')
->addArgument(
'schemaTemplateDirectory',
InputArgument::REQUIRED,
Expand Down Expand Up @@ -122,8 +122,8 @@ private function checkAllFields($decodedSchema, array $defaultFields = []): arra
$fieldTypes = [$fieldTypes];
}

foreach ($fieldTypes as $fieldType) {
$defaultFields = $this->checkSingleField($fieldType, $field, $defaultFields);
if (count($fieldTypes)) {
$defaultFields = $this->checkSingleField($fieldTypes[0], $field, $defaultFields);
}
}

Expand Down
18 changes: 12 additions & 6 deletions tests/Command/CheckAllSchemaTemplatesDefaultTypeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ class CheckAllSchemaTemplatesDefaultTypeCommandTest extends AbstractSchemaRegist
},
{
"name": "name2",
"type": ["null","string"],
"type": ["string","null"],
"default": "",
"doc": "some desc"
},
{
"name": "bool1",
"type": ["null","boolean"],
"type": ["boolean","null"],
"default": false,
"doc": "some desc"
},
Expand All @@ -57,19 +57,25 @@ class CheckAllSchemaTemplatesDefaultTypeCommandTest extends AbstractSchemaRegist
"doc": "some desc"
},
{
"name": "number3",
"name": "number4",
"type": ["double","float"],
"default": 0,
"doc": "some desc"
},
{
"name": "number5",
"type": ["float","int"],
"default": 0,
"doc": "some desc"
},
{
"name": "array1",
"type": [
"null",
{
"type": "array",
"items": "ch.jobcloud.item"
}
},
"null"
],
"default": [],
"doc": "some desc"
Expand Down Expand Up @@ -105,7 +111,7 @@ class CheckAllSchemaTemplatesDefaultTypeCommandTest extends AbstractSchemaRegist
{
"name": "name2",
"type": ["null","string"],
"default": "",
"default": "VALUE",
"doc": "some desc"
},
{
Expand Down