Skip to content

Create new file / Update existing file in repository return value #893

@jmini

Description

@jmini

Both endpoints:

  1. Create new file in repository
POST /projects/:id/repository/files/:file_path
  1. Update existing file in repository
PUT /projects/:id/repository/files/:file_path

Are returning a response:

{
  "file_path": "app/project.rb",
  "branch": "master"
}

But this client library is mapping the response to a org.gitlab4j.api.models.RepositoryFile where all the fields are set to null except file.getFilePath():

public RepositoryFile createFile(Object projectIdOrPath, RepositoryFile file, String branchName, String commitMessage) throws GitLabApiException {

public RepositoryFile updateFile(Object projectIdOrPath, RepositoryFile file, String branchName, String commitMessage) throws GitLabApiException {

I think this result type is quite misleading. (for example you do not expect file.getCommitId() to be null)

I can understand that changing this would be a breaking change.

Maybe one thing that can be considered is to put the branch attribute value in file.getRef()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions