forked from lix-project/hydra
ToJSON: serialize string_columns to JSON
If the column is undefined, then it should be an empty string according to your API spec.
This commit is contained in:
parent
f0ede5f8b8
commit
50fab154a4
|
@ -18,6 +18,10 @@ sub TO_JSON {
|
|||
$json{$column} = $self->get_column($column);
|
||||
}
|
||||
|
||||
foreach my $column (@{$hint->{string_columns}}) {
|
||||
$json{$column} = $self->get_column($column) // "";
|
||||
}
|
||||
|
||||
foreach my $column (@{$hint->{boolean_columns}}) {
|
||||
$json{$column} = $self->get_column($column) ? JSON::true : JSON::false;
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ __PACKAGE__->many_to_many("usernames", "projectmembers", "username");
|
|||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+4yWd9UjCyxxLZYDrVUAxA
|
||||
|
||||
my %hint = (
|
||||
columns => [
|
||||
string_columns => [
|
||||
"name",
|
||||
"displayname",
|
||||
"description",
|
||||
|
|
|
@ -25,11 +25,11 @@ my $projectinfo = request(GET '/project/tests',
|
|||
|
||||
ok($projectinfo->is_success);
|
||||
is(decode_json($projectinfo->content), {
|
||||
description => undef,
|
||||
description => "",
|
||||
displayname => "",
|
||||
enabled => JSON::true,
|
||||
hidden => JSON::false,
|
||||
homepage => undef,
|
||||
homepage => "",
|
||||
jobsets => [],
|
||||
name => "tests",
|
||||
owner => "root"
|
||||
|
|
Loading…
Reference in a new issue