Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/semantic-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
- uses: amannn/action-semantic-pull-request@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion generated/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Client extends Runtime\Client\Client
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @return \myvendor\mynamespace\Generated\Model\Pet[]|\myvendor\mynamespace\Generated\Model\Error|\Psr\Http\Message\ResponseInterface|null
* @return Model\Pet[]|Model\Error|\Psr\Http\Message\ResponseInterface|null
*/
public function listPets(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
Expand Down
168 changes: 48 additions & 120 deletions generated/Normalizer/ErrorNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,147 +13,75 @@
use Jane\Component\JsonSchemaRuntime\Reference;
use myvendor\mynamespace\Generated\Runtime\Normalizer\CheckArray;
use myvendor\mynamespace\Generated\Runtime\Normalizer\ValidatorTrait;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) {
class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
use CheckArray;
use ValidatorTrait;

public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
use CheckArray;
use ValidatorTrait;
return \myvendor\mynamespace\Generated\Model\Error::class === $type;
}

public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return \myvendor\mynamespace\Generated\Model\Error::class === $type;
}
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return is_object($data) && \myvendor\mynamespace\Generated\Model\Error::class === get_class($data);
}

public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return is_object($data) && \myvendor\mynamespace\Generated\Model\Error::class === get_class($data);
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (isset($data['$ref'])) {
return new Reference($data['$ref'], $context['document-origin']);
}

public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (isset($data['$ref'])) {
return new Reference($data['$ref'], $context['document-origin']);
}
if (isset($data['$recursiveRef'])) {
return new Reference($data['$recursiveRef'], $context['document-origin']);
}
$object = new \myvendor\mynamespace\Generated\Model\Error();
if (null === $data || false === \is_array($data)) {
return $object;
}
if (\array_key_exists('code', $data)) {
$object->setCode($data['code']);
unset($data['code']);
}
if (\array_key_exists('message', $data)) {
$object->setMessage($data['message']);
unset($data['message']);
}
foreach ($data as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$object[$key] = $value;
}
}

if (isset($data['$recursiveRef'])) {
return new Reference($data['$recursiveRef'], $context['document-origin']);
}
$object = new \myvendor\mynamespace\Generated\Model\Error();
if (null === $data || false === \is_array($data)) {
return $object;
}

public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
$data = [];
$data['code'] = $object->getCode();
$data['message'] = $object->getMessage();
foreach ($object as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$data[$key] = $value;
}
}

return $data;
if (\array_key_exists('code', $data)) {
$object->setCode($data['code']);
unset($data['code']);
}

public function getSupportedTypes(?string $format = null): array
{
return [\myvendor\mynamespace\Generated\Model\Error::class => false];
if (\array_key_exists('message', $data)) {
$object->setMessage($data['message']);
unset($data['message']);
}
}
} else {
class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
use CheckArray;
use ValidatorTrait;

public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool
{
return \myvendor\mynamespace\Generated\Model\Error::class === $type;
foreach ($data as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$object[$key] = $value;
}
}

public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return is_object($data) && \myvendor\mynamespace\Generated\Model\Error::class === get_class($data);
}
return $object;
}

public function denormalize($data, $type, $format = null, array $context = [])
{
if (isset($data['$ref'])) {
return new Reference($data['$ref'], $context['document-origin']);
}
if (isset($data['$recursiveRef'])) {
return new Reference($data['$recursiveRef'], $context['document-origin']);
}
$object = new \myvendor\mynamespace\Generated\Model\Error();
if (null === $data || false === \is_array($data)) {
return $object;
}
if (\array_key_exists('code', $data)) {
$object->setCode($data['code']);
unset($data['code']);
}
if (\array_key_exists('message', $data)) {
$object->setMessage($data['message']);
unset($data['message']);
}
foreach ($data as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$object[$key] = $value;
}
public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
$dataArray = [];
$dataArray['code'] = $data->getCode();
$dataArray['message'] = $data->getMessage();
foreach ($data as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$dataArray[$key] = $value;
}

return $object;
}

/**
* @return array|string|int|float|bool|\ArrayObject|null
*/
public function normalize($object, $format = null, array $context = [])
{
$data = [];
$data['code'] = $object->getCode();
$data['message'] = $object->getMessage();
foreach ($object as $key => $value) {
if (preg_match('/.*/', (string) $key)) {
$data[$key] = $value;
}
}

return $data;
}
return $dataArray;
}

public function getSupportedTypes(?string $format = null): array
{
return [\myvendor\mynamespace\Generated\Model\Error::class => false];
}
public function getSupportedTypes(?string $format = null): array
{
return [\myvendor\mynamespace\Generated\Model\Error::class => false];
}
}
Loading