OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
return empty array instead of `null`
ulferts7b4db8460935
diff --git a/lib/api/decorators/sql_collection_representer.rb b/lib/api/decorators/sql_collection_representer.rbindex ebca2749cfb..881d3aa7521 100644--- a/lib/api/decorators/sql_collection_representer.rb+++ b/lib/api/decorators/sql_collection_representer.rb@@ -130,7 +130,7 @@ module APIrepresentation: ->(walker_result) doreplacement = walker_result.replace_map['elements']- replacement ? "json_agg(#{replacement})" : nil+ replacement ? "COALESCE(json_agg(#{replacement}), '[]')" : nilendendenddiff --git a/spec/requests/api/v3/capability_resource_spec.rb b/spec/requests/api/v3/capability_resource_spec.rbindex c74494807cf..8d96796fb7c 100644--- a/spec/requests/api/v3/capability_resource_spec.rb+++ b/spec/requests/api/v3/capability_resource_spec.rb@@ -372,10 +372,14 @@ describe 'API v3 capabilities resource', type: :request, content_type: :json do} }]end- it 'is empty' do+ it 'is empty and includes an empty element set', :aggregate_failures doexpect(subject.body).to be_json_eql('0').at_path('total')++ expect(subject.body)+ .to be_json_eql([].to_json)+ .at_path('_embedded/elements')endend