Skip to content

Commit

Permalink
[PeerTube] fixes resource validation
Browse files Browse the repository at this point in the history
cs peertube
  • Loading branch information
Elorfin committed Sep 19, 2023
1 parent 3f9b13e commit f94995c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/integration/peertube/Entity/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

/**
* @ORM\Entity()
*
* @ORM\Table(name="claro_peertube_video")
*/
class Video extends AbstractResource
Expand All @@ -30,7 +31,7 @@ class Video extends AbstractResource
private $originalUuid;

/**
* The short UUID of the video (retrieved from the the PeerTube share URL).
* The short UUID of the video (retrieved from the PeerTube share URL).
*
* @ORM\Column(type="string")
*
Expand Down
16 changes: 16 additions & 0 deletions src/integration/peertube/Resources/schemas/video.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The uuid of the PeerTube video"
},
"url": {
"type": "string",
"description": "The original URL of the PeerTube video"
}
},
"required": ["url"],
"claroIds": ["id"]
}
8 changes: 6 additions & 2 deletions src/integration/peertube/Serializer/VideoSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class VideoSerializer
{
use SerializerTrait;

/** @var PeerTubeManager */
private $peerTubeManager;
private PeerTubeManager $peerTubeManager;

public function __construct(PeerTubeManager $peerTubeManager)
{
Expand All @@ -24,6 +23,11 @@ public function getClass(): string
return Video::class;
}

public function getSchema(): string
{
return '#/integration/peertube/video.json';
}

public function serialize(Video $video, ?array $options = []): array
{
return [
Expand Down

0 comments on commit f94995c

Please sign in to comment.