@@ -317,7 +317,7 @@ final readonly class PetCollectionResponse extends AbstractCollectionResponse im
317317 array $items,
318318 int $count,
319319 string $_type,
320- array $_links,
320+ array $_links = [] ,
321321 ) {
322322 parent::__construct(
323323 $offset,
@@ -361,7 +361,6 @@ use Chubbyphp\Framework\Router\UrlGeneratorInterface;
361361use Chubbyphp\Parsing\Enum\Uuid;
362362use Chubbyphp\Parsing\ParserInterface;
363363use Chubbyphp\Parsing\Schema\ObjectSchemaInterface;
364- use Chubbyphp\Parsing\Schema\RecordSchema;
365364use Psr\Http\Message\ServerRequestInterface;
366365
367366final class PetParsing implements ParsingInterface
@@ -374,8 +373,6 @@ final class PetParsing implements ParsingInterface
374373
375374 private ?ObjectSchemaInterface $modelResponseSchema = null;
376375
377- private ?RecordSchema $linksSchema = null;
378-
379376 public function __construct(
380377 private readonly ParserInterface $parser,
381378 private readonly UrlGeneratorInterface $urlGenerator,
@@ -427,7 +424,6 @@ final class PetParsing implements ParsingInterface
427424 'items' => $p->array($this->getModelResponseSchema($request)),
428425 'count' => $p->int(),
429426 '_type' => $p->const('petCollection')->default('petCollection'),
430- '_links' => $this->getLinksSchema(),
431427 ], PetCollectionResponse::class, true)
432428 ->strict()
433429 ->postParse(function (PetCollectionResponse $petCollectionResponse) {
@@ -494,7 +490,6 @@ final class PetParsing implements ParsingInterface
494490 'name' => $p->string(),
495491 'tag' => $p->string()->nullable(),
496492 '_type' => $p->const('pet')->default('pet'),
497- '_links' => $this->getLinksSchema(),
498493 ], PetResponse::class, true)->strict()
499494 ->postParse(
500495 fn (PetResponse $petResponse) => new PetResponse(
@@ -531,22 +526,6 @@ final class PetParsing implements ParsingInterface
531526
532527 return $this->modelResponseSchema;
533528 }
534-
535- private function getLinksSchema(): RecordSchema
536- {
537- if (null === $this->linksSchema) {
538- $p = $this->parser;
539-
540- $this->linksSchema = $p->record($p->assoc([
541- 'href' => $p->string(),
542- 'templated' => $p->bool(),
543- 'rel' => $p->array($p->string()),
544- 'attributes' => $p->record($p->string()),
545- ]))->default([]);
546- }
547-
548- return $this->linksSchema;
549- }
550529}
551530```
552531
0 commit comments