Skip to content

feat: add missing PUT /projects/:id attributes to ProjectApi.updateProject (#1324)#1325

Open
bigpuritz wants to merge 1 commit into
gitlab4j:mainfrom
bigpuritz:feature/issue-1324-update-project-params
Open

feat: add missing PUT /projects/:id attributes to ProjectApi.updateProject (#1324)#1325
bigpuritz wants to merge 1 commit into
gitlab4j:mainfrom
bigpuritz:feature/issue-1324-update-project-params

Conversation

@bigpuritz
Copy link
Copy Markdown

Summary

ProjectApi.updateProject(Project) was missing 35 attributes that the GitLab REST API supports for PUT /projects/:id. As a result, those settings could not be changed through GitLab4J-API even though the GitLab server accepts them.

Reference: GitLab API – Edit/Update a project.

Closes #1324

Changes

  • Project model: added 20 new fields (with getters/setters/withXxx builders) that had no representation yet — e.g. merge_trains_enabled, merge_trains_skip_train_allowed, max_pipelines_per_merge_train, package_registry_access_level, mr_default_title_template, mr_default_target_self, mirror_user_id, mirror_overwrites_diverged_branches, only_mirror_protected_branches, prevent_merge_without_jira_issue, protect_merge_request_pipelines, spp_repository_pipeline_access, web_based_commit_signing_enabled, web-/duo-/ci-related flags, max_artifacts_size, merge_pipelines_enabled, auto_duo_code_review_enabled.
  • ProjectApi.updateProject(): wired all 35 attributes into the request. The other 15 already had model getters but were never sent (e.g. auto_devops_enabled, ci_default_git_depth, import_url, service_desk_enabled, keep_latest_artifact, allow_merge_on_skipped_pipeline, …). ci_id_token_sub_claim_components is sent via the List<?> overload.
  • Test fixture: extended project.json with the 20 new attributes so TestGitLabApiBeans.testProject round-trips (serialize/deserialize) every new field.

Intentionally excluded

  • emails_disabled, restrict_user_defined_variables — deprecated and already superseded by attributes that are present (emails_enabled, ci_pipeline_variables_minimum_override_role).
  • avatar — already covered by the dedicated multipart method setProjectAvatar(...); not applicable to the form-data updateProject.

Test plan

  • ./gradlew build — BUILD SUCCESSFUL (Spotless/Palantir formatting check, compilation of both modules, all tests)
  • TestGitLabApiBeans.testProject — strict JSON round-trip passes with all 20 new fields
  • Integration test against a live GitLab server (TestProjectApi) — not run here (requires a configured GitLab instance)

Notes (out of scope, not changed here)

updateProject still sends build_coverage_regex, which no longer exists in the current PUT /projects/:id specification; template_name, use_custom_template, group_with_project_templates_id, and repository_object_format are create-only parameters with no effect on update. These can be addressed separately if desired.

ProjectApi.updateProject() was missing 35 attributes supported by the
GitLab REST API for PUT /projects/:id, so those settings could not be
changed through GitLab4J-API.

- Add 20 new fields (+ getters/setters/builders) to the Project model
  that had no representation yet (e.g. merge_trains_enabled,
  package_registry_access_level, mr_default_title_template, ...).
- Wire all 35 attributes into ProjectApi.updateProject(); the remaining
  15 already had model getters but were never sent.
- Extend the project.json test fixture with the 20 new attributes so
  TestGitLabApiBeans.testProject round-trips them.

Deprecated/superseded attributes (emails_disabled,
restrict_user_defined_variables) and the multipart-only `avatar`
attribute are intentionally not included.

Refs gitlab4j#1324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ProjectApi.updateProject() is missing 35 supported PUT /projects/:id attributes

1 participant