Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 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
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
"require": {
"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
9 changes: 5 additions & 4 deletions src/Command/AbstractModeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace Jobcloud\SchemaConsole\Command;

use GuzzleHttp\Exception\ClientException;
use JsonException;
use Psr\Http\Client\ClientExceptionInterface;
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 +23,11 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws ClientException
* @throws JsonException
* @throws ClientExceptionInterface
*/
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
7 changes: 4 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,10 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws RequestException
* @throws JsonException
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down Expand Up @@ -66,6 +66,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
12 changes: 8 additions & 4 deletions src/Command/CheckAllSchemasCompatibilityCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

namespace Jobcloud\SchemaConsole\Command;

use GuzzleHttp\Exception\RequestException;
use Jobcloud\Kafka\SchemaRegistryClient\Exception\SchemaRegistryExceptionInterface;
use Jobcloud\SchemaConsole\Helper\SchemaFileHelper;
use JsonException;
use Psr\Http\Client\ClientExceptionInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

class CheckAllSchemasCompatibilityCommand extends AbstractSchemaCommand
{

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

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws RequestException
* @throws ClientExceptionInterface
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down Expand Up @@ -57,6 +58,9 @@ public function execute(InputInterface $input, OutputInterface $output): int
* @param array<string, mixed> $avroFiles
* @param array<string, mixed> $failed
* @return boolean
* @throws SchemaRegistryExceptionInterface
* @throws JsonException
* @throws ClientExceptionInterface
*/
private function checkSchemas(array $avroFiles, array &$failed = []): bool
{
Expand Down
11 changes: 7 additions & 4 deletions src/Command/CheckCompatibilityCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

namespace Jobcloud\SchemaConsole\Command;

use GuzzleHttp\Exception\ClientException;
use Jobcloud\Kafka\SchemaRegistryClient\Exception\SchemaRegistryExceptionInterface;
use Jobcloud\SchemaConsole\Helper\SchemaFileHelper;
use JsonException;
use Psr\Http\Client\ClientExceptionInterface;
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 +28,12 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws ClientException
* @throws SchemaRegistryExceptionInterface
* @throws JsonException
* @throws ClientExceptionInterface
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
6 changes: 3 additions & 3 deletions src/Command/CheckDocCommentsCommand.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 All @@ -30,10 +30,10 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws RequestException
* @throws JsonException
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
9 changes: 7 additions & 2 deletions src/Command/CheckIsRegistredCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

namespace Jobcloud\SchemaConsole\Command;

use Jobcloud\Kafka\SchemaRegistryClient\Exception\SchemaRegistryExceptionInterface;
use Jobcloud\SchemaConsole\Helper\SchemaFileHelper;
use JsonException;
use Psr\Http\Client\ClientExceptionInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class CheckIsRegistredCommand extends AbstractSchemaCommand
{

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

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws SchemaRegistryExceptionInterface
* @throws JsonException
* @throws ClientExceptionInterface
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
10 changes: 7 additions & 3 deletions src/Command/DeleteAllSchemasCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

namespace Jobcloud\SchemaConsole\Command;

use Jobcloud\Kafka\SchemaRegistryClient\Exception\SchemaRegistryExceptionInterface;
use JsonException;
use Psr\Http\Client\ClientExceptionInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DeleteAllSchemasCommand extends AbstractSchemaCommand
{

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

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

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

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

namespace Jobcloud\SchemaConsole\Command;

use Jobcloud\Kafka\SchemaRegistryClient\Exception\SchemaRegistryExceptionInterface;
use JsonException;
use Psr\Http\Client\ClientExceptionInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class GetCompatibilityModeCommand extends AbstractSchemaCommand
{

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

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws SchemaRegistryExceptionInterface
* @throws JsonException
* @throws ClientExceptionInterface
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
9 changes: 7 additions & 2 deletions src/Command/GetCompatibilityModeForSchemaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

namespace Jobcloud\SchemaConsole\Command;

use Jobcloud\Kafka\SchemaRegistryClient\Exception\SchemaRegistryExceptionInterface;
use JsonException;
use Psr\Http\Client\ClientExceptionInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class GetCompatibilityModeForSchemaCommand extends AbstractSchemaCommand
{

/**
* @return void
*/
Expand All @@ -24,9 +26,12 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws SchemaRegistryExceptionInterface
* @throws JsonException
* @throws ClientExceptionInterface
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
Loading