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:
Cole Helbling
2021-04-26 16:37:25 -07:00
parent f0ede5f8b8
commit 50fab154a4
3 changed files with 7 additions and 3 deletions

View File

@ -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;
}

View File

@ -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",