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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2.1

orbs:
ci-caching: jobcloud/ci-caching@1.0.2
ci-php: jobcloud/ci-php@0.32
ci-caching: jobcloud/ci-caching@3.0
ci-php: jobcloud/ci-php@2.0

workflows:
test-console-kafka-schema-registry:
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

## Installation
```
composer require jobcloud/php-console-kafka-schema-registry "^1.1"
composer require jobcloud/php-console-kafka-schema-registry
```

## Requirements
- php: >= 7.4

## Register commands
You can register each command separately like this:
```php
Expand Down
16 changes: 9 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@
}
],
"require": {
"php": ">=7.4",
"ext-json": "*",
"flix-tech/avro-php": "^3.0|^4.0",
"symfony/console": "^4.3|^5.1",
"jobcloud/php-kafka-schema-registry-client": "^1.0",
"kriswallsmith/buzz": "^1.2",
"nyholm/psr7": "^1.4",
"pimple/pimple": "^3.2",
"jobcloud/php-kafka-schema-registry-client": "^0.1",
"guzzlehttp/guzzle": "^6.3|^7.3"
"symfony/console": "^4.3|^5.1"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"infection/infection": "^0.25",
"phpstan/phpstan": "^0.12",
"infection/infection": "^0.18",
"squizlabs/php_codesniffer": "^3.4",
"rregeer/phpunit-coverage-check": "^0.3.1"
"phpunit/phpunit": "^9.5",
"rregeer/phpunit-coverage-check": "^0.3.1",
"squizlabs/php_codesniffer": "^3.6"
},
"autoload": {
"psr-4": {
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.14
FROM php:7.4-cli-alpine3.15

ARG HOST_USER_ID

Expand Down
5 changes: 1 addition & 4 deletions src/Command/AbstractModeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@

namespace Jobcloud\SchemaConsole\Command;

use GuzzleHttp\Exception\ClientException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

abstract class AbstractModeCommand extends AbstractSchemaCommand implements ModeCommandInterface
{

/**
* @return void
*/
Expand All @@ -23,10 +21,9 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws ClientException
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
1 change: 0 additions & 1 deletion src/Command/AbstractSchemaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

abstract class AbstractSchemaCommand extends Command
{

/**
* @var KafkaSchemaRegistryApiClientInterface
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Command/CheckAllSchemaTemplatesDefaultTypeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Jobcloud\SchemaConsole\Command;

use GuzzleHttp\Exception\RequestException;
use Jobcloud\SchemaConsole\Helper\SchemaFileHelper;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
Expand Down Expand Up @@ -41,7 +40,6 @@ protected function configure(): void
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws RequestException
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
6 changes: 3 additions & 3 deletions src/Command/CheckAllSchemaTemplatesDocCommentsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Jobcloud\SchemaConsole\Command;

use GuzzleHttp\Exception\RequestException;
use Jobcloud\SchemaConsole\Helper\SchemaFileHelper;
use JsonException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -34,10 +34,9 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws RequestException
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down Expand Up @@ -66,6 +65,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
* @param array<string, mixed> $avroFiles
* @param array<string, mixed> $failed
* @return boolean
* @throws JsonException
*/
private function checkDocCommentsOnSchemaTemplates(array $avroFiles, array &$failed = []): bool
{
Expand Down
2 changes: 0 additions & 2 deletions src/Command/CheckAllSchemasAreValidAvroCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use AvroSchema;
use AvroSchemaParseException;
use GuzzleHttp\Exception\RequestException;
use Jobcloud\SchemaConsole\Helper\SchemaFileHelper;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
Expand All @@ -30,7 +29,6 @@ protected function configure(): void
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws RequestException
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
5 changes: 1 addition & 4 deletions src/Command/CheckAllSchemasCompatibilityCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Jobcloud\SchemaConsole\Command;

use GuzzleHttp\Exception\RequestException;
use Jobcloud\SchemaConsole\Helper\SchemaFileHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -11,7 +10,6 @@

class CheckAllSchemasCompatibilityCommand extends AbstractSchemaCommand
{

/**
* @return void
*/
Expand All @@ -25,10 +23,9 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws RequestException
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
5 changes: 1 addition & 4 deletions src/Command/CheckCompatibilityCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

namespace Jobcloud\SchemaConsole\Command;

use GuzzleHttp\Exception\ClientException;
use Jobcloud\SchemaConsole\Helper\SchemaFileHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class CheckCompatibilityCommand extends AbstractSchemaCommand
{

/**
* @return void
*/
Expand All @@ -27,10 +25,9 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws ClientException
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
4 changes: 1 addition & 3 deletions src/Command/CheckDocCommentsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Jobcloud\SchemaConsole\Command;

use GuzzleHttp\Exception\RequestException;
use Jobcloud\SchemaConsole\Helper\SchemaFileHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -30,10 +29,9 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws RequestException
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
3 changes: 1 addition & 2 deletions src/Command/CheckIsRegistredCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

class CheckIsRegistredCommand extends AbstractSchemaCommand
{

/**
* @return void
*/
Expand All @@ -25,7 +24,7 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
Expand Down
4 changes: 1 addition & 3 deletions src/Command/DeleteAllSchemasCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class DeleteAllSchemasCommand extends AbstractSchemaCommand
{

/**
* @return void
*/
Expand All @@ -22,13 +21,12 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
public function execute(InputInterface $input, OutputInterface $output): int
{

$schemas = $this->schemaRegistryApi->getSubjects();

foreach ($schemas as $schemaName) {
Expand Down
3 changes: 1 addition & 2 deletions src/Command/GetCompatibilityModeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class GetCompatibilityModeCommand extends AbstractSchemaCommand
{

/**
* @return void
*/
Expand All @@ -22,7 +21,7 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Command/GetCompatibilityModeForSchemaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

class GetCompatibilityModeForSchemaCommand extends AbstractSchemaCommand
{

/**
* @return void
*/
Expand All @@ -24,7 +23,7 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
Expand Down
6 changes: 2 additions & 4 deletions src/Command/GetLatestSchemaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Jobcloud\SchemaConsole\Command;

use GuzzleHttp\Exception\ClientException;
use Buzz\Exception\ClientException;
use Jobcloud\Kafka\SchemaRegistryClient\KafkaSchemaRegistryApiClientInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -13,7 +13,6 @@

class GetLatestSchemaCommand extends AbstractSchemaCommand
{

/**
* @return void
*/
Expand All @@ -28,10 +27,9 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws ClientException
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
8 changes: 3 additions & 5 deletions src/Command/GetSchemaByVersionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,27 @@

class GetSchemaByVersionCommand extends AbstractSchemaCommand
{

/**
* @return void
*/
protected function configure(): void
{
$this
->setName('kafka-schema-registry:fetch:schema')
->setDescription('List all versions for given schema')
->setHelp('List all versions for given schema')
->setDescription('Get schema by version number')
->setHelp('Get schema by version number')
->addArgument('schemaName', InputArgument::REQUIRED, 'Name of the schema')
->addArgument('schemaVersion', InputArgument::REQUIRED, 'Version of the schema')
->addArgument('outputFile', InputArgument::REQUIRED, 'Path to output file');
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
public function execute(InputInterface $input, OutputInterface $output): int
{

/** @var string $outputFile */
$outputFile = $input->getArgument('outputFile');

Expand Down
4 changes: 1 addition & 3 deletions src/Command/ListAllSchemasCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class ListAllSchemasCommand extends AbstractSchemaCommand
{

/**
* @return void
*/
Expand All @@ -22,13 +21,12 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
public function execute(InputInterface $input, OutputInterface $output): int
{

$schemas = $this->schemaRegistryApi->getSubjects();

foreach ($schemas as $schema) {
Expand Down
Loading