New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge api on Create or update file contents #29419
base: main
Are you sure you want to change the base?
Conversation
0e047e0
to
0f2cc99
Compare
if apiOpts.SHA == "" { | ||
ctx.JSON(http.StatusCreated, fileResponse) | ||
} else { | ||
ctx.JSON(http.StatusOK, fileResponse) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part looks bit awkward to use SHA as flag of response. If you have any idea for this please let me know
I tried using file_service.GetContents
to make clear for this but couldn't get more understandable code
@@ -41,7 +41,7 @@ func ApplyDiffPatch(ctx *context.APIContext) { | |||
// in: body | |||
// required: true | |||
// schema: | |||
// "$ref": "#/definitions/UpdateFileOptions" | |||
// "$ref": "#/definitions/ApplyDiffPatchFileOptions" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swagger doc was using wrong schema
@@ -50,95 +49,7 @@ func getCreateFileOptions() api.CreateFileOptions { | |||
} | |||
} | |||
|
|||
func getExpectedFileResponseForCreate(repoFullName, commitID, treePath, latestCommitSHA string) *api.FileResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why delete these functions and tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate code and testing. Same function and test are in api_repo_file_create_or_update_test.go
This PR is related to (#19008).
After this PR merged, CreateFile API get deprecated and UpdateFile became CreateAndUpdateFile. Also some signature changed.
Added another PR on https://gitea.com/gitea/go-sdk/pulls/652, connected with this PR