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
extend project schema to include status, revamp existing status to be active
ulfertsa5621578e26f
diff --git a/lib/api/v3/projects/schemas/project_schema_representer.rb b/lib/api/v3/projects/schemas/project_schema_representer.rbindex de7b1fb1cce..cd94aa7df2a 100644--- a/lib/api/v3/projects/schemas/project_schema_representer.rb+++ b/lib/api/v3/projects/schemas/project_schema_representer.rb@@ -58,12 +58,16 @@ module APIrequired: falseschema :public,- as: :public,type: 'Boolean',visibility: false- schema_with_allowed_string_collection :status,- type: 'String'+ schema :active,+ type: 'Boolean',+ visibility: false++ schema :status,+ type: 'ProjectStatus',+ visibility: falseschema_with_allowed_link :parent,type: 'Project',diff --git a/spec/lib/api/v3/projects/schemas/project_schema_representer_spec.rb b/spec/lib/api/v3/projects/schemas/project_schema_representer_spec.rbindex 99beeabef6e..d6e1bbf688f 100644--- a/spec/lib/api/v3/projects/schemas/project_schema_representer_spec.rb+++ b/spec/lib/api/v3/projects/schemas/project_schema_representer_spec.rb@@ -47,7 +47,7 @@ describe ::API::V3::Projects::Schemas::ProjectSchemaRepresenter doallow(contract).to receive(:writable?) do |attribute|- writable = %w(name identifier description public status parent)+ writable = %w(name identifier description public status parent active)writable.include?(attribute.to_s)end@@ -166,11 +166,24 @@ describe ::API::V3::Projects::Schemas::ProjectSchemaRepresenter doit_behaves_like 'has no visibility property'end+ describe 'active' do+ let(:path) { 'active' }++ it_behaves_like 'has basic schema properties' do+ let(:type) { 'Boolean' }+ let(:name) { I18n.t('attributes.active') }+ let(:required) { true }+ let(:writable) { true }+ end++ it_behaves_like 'has no visibility property'+ end+describe 'status' dolet(:path) { 'status' }it_behaves_like 'has basic schema properties' do- let(:type) { 'String' }+ let(:type) { 'ProjectStatus' }let(:name) { I18n.t('attributes.status') }let(:required) { true }let(:writable) { true }@@ -181,12 +194,11 @@ describe ::API::V3::Projects::Schemas::ProjectSchemaRepresenter do.not_to have_json_path("#{path}/_links/allowedValues")end- it 'embeds the allowed values' do+ it 'embeds no values' doallowed_path = "#{path}/_embedded/allowedValues"is_expected- .to be_json_eql(allowed_status.to_json)- .at_path(allowed_path)+ .not_to have_json_path(allowed_path)endenddiff --git a/spec/requests/api/v3/projects/schemas/project_schema_resource_spec.rb b/spec/requests/api/v3/projects/schemas/project_schema_resource_spec.rbindex 2b0f8ca73b8..4704ede2443 100644--- a/spec/requests/api/v3/projects/schemas/project_schema_resource_spec.rb+++ b/spec/requests/api/v3/projects/schemas/project_schema_resource_spec.rb@@ -60,9 +60,9 @@ describe 'API v3 Projects schema resource', type: :request, content_type: :json.at_path '_type'end- #it 'does not embed' do- # expect(subject.body)- # .not_to have_json_path('page/_links/allowedValues')- #end+ it 'does not embed' do+ expect(subject.body)+ .not_to have_json_path('parent/_links/allowedValues')+ endendend