Skip to content

Commit 476f5a8

Browse files
authored
MBS-11461: Add TO_JSON to ExampleRelationships
1 parent f7d9af1 commit 476f5a8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/MusicBrainz/Server/Entity/ExampleRelationship.pm

+13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package MusicBrainz::Server::Entity::ExampleRelationship;
22
use Moose;
33

4+
use MusicBrainz::Server::Data::Utils qw( boolean_to_json );
5+
use MusicBrainz::Server::Entity::Util::JSON qw( to_json_object );
6+
47
has name => (
58
isa => 'Str',
69
required => 1,
@@ -18,4 +21,14 @@ has relationship => (
1821
required => 1
1922
);
2023

24+
sub TO_JSON {
25+
my ($self) = @_;
26+
27+
return {
28+
name => $self->name,
29+
published => boolean_to_json($self->published),
30+
relationship => to_json_object($self->relationship),
31+
};
32+
}
33+
2134
1;

lib/MusicBrainz/Server/Entity/LinkType.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ around TO_JSON => sub {
144144
$json->{cardinality1} = $self->entity1_cardinality;
145145
$json->{deprecated} = boolean_to_json($self->is_deprecated);
146146
$json->{documentation} = $self->documentation;
147-
$json->{examples} = $self->examples;
147+
$json->{examples} = to_json_array($self->examples);
148148
$json->{has_dates} = boolean_to_json($self->has_dates);
149149
$json->{id} = $self->id;
150150
$json->{root_id} = $self->root_id;

0 commit comments

Comments
 (0)