Skip to content
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

REST: Fix PATCH method #151

Merged
merged 3 commits into from
Jun 26, 2024
Merged

REST: Fix PATCH method #151

merged 3 commits into from
Jun 26, 2024

Conversation

isinyaaa
Copy link
Contributor

@isinyaaa isinyaaa commented Jun 21, 2024

Description

Use a converter to reconcile the PATCH body with the existing instance.

Fixes https://issues.redhat.com/browse/RHOAIENG-8534

How Has This Been Tested?

Refer to reproducers in the Jira.

Merge criteria:

  • The commits and have meaningful messages; the author will squash them after approval or will ask to merge with squash.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

cc @tarilabs

Copy link
Member

@tarilabs tarilabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
and thank you so much @isinyaaa

before approving one remaining question: since this was raised by UI team, would you think an update to RobotFramework with a user-story dedicated to using Patch with this PR, on in a subsequent PR, please?

@isinyaaa
Copy link
Contributor Author

/lgtm and thank you so much @isinyaaa

before approving one remaining question: since this was raised by UI team, would you think an update to RobotFramework with a user-story dedicated to using Patch with this PR, on in a subsequent PR, please?

that's surely a good idea, will look into it asap :)

As that fixed a nil assignment override[1][2] which prevented us from
emulating copy constructors[3].
The update also allows us to use generics.

[1]: jmattheis/goverter#146 (comment)
[2]: jmattheis/goverter#97
[3]: jmattheis/goverter#147

Signed-off-by: Isabella Basso do Amaral <[email protected]>
Signed-off-by: Isabella do Amaral <[email protected]>
@isinyaaa
Copy link
Contributor Author

Added a simple test for the use-case. wdyt @tarilabs ?

@isinyaaa isinyaaa requested a review from tarilabs June 25, 2024 19:52
Copy link
Member

@tarilabs tarilabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you so much @isinyaaa 👍 🚀

/lgtm
/approve

@@ -130,7 +130,7 @@ bin/golangci-lint:

GOVERTER ?= ${PROJECT_BIN}/goverter
bin/goverter:
GOBIN=$(PROJECT_PATH)/bin ${GO} install github.com/jmattheis/goverter/cmd/goverter@v1.1.1
GOBIN=$(PROJECT_PATH)/bin ${GO} install github.com/jmattheis/goverter/cmd/goverter@v1.4.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bumps goverter 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should eventually look into avoiding specifying the version (it was required for previous work by @lampajr during some ad-interim) ... would you mind @isinyaaa logging an issue/jira to eventually change this to use a latest or some version specified in gomod if it's possible to just consolidate the version please? wdyt? (in a subsequent task of course)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure can look into it. I agree the Makefile is a rather "forgotten" place to specify this, as neither us nor dependabot will keep it up to date.

internal/converter/openapi_converter.go Show resolved Hide resolved
internal/converter/openapi_converter_util.go Show resolved Hide resolved
internal/converter/openapi_reconciler.go Show resolved Hide resolved
test/robot/UserStory.robot Show resolved Hide resolved
@google-oss-prow google-oss-prow bot added the lgtm label Jun 26, 2024
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tarilabs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 90ae8f4 into kubeflow:main Jun 26, 2024
11 checks passed
@isinyaaa isinyaaa deleted the fix-patch branch June 26, 2024 13:55
mzhl1111 pushed a commit to mzhl1111/model-registry that referenced this pull request Jul 1, 2024
* update goverter to 1.4.1

As that fixed a nil assignment override[1][2] which prevented us from
emulating copy constructors[3].
The update also allows us to use generics.

[1]: jmattheis/goverter#146 (comment)
[2]: jmattheis/goverter#97
[3]: jmattheis/goverter#147

Signed-off-by: Isabella Basso do Amaral <[email protected]>
Signed-off-by: Isabella do Amaral <[email protected]>

* simplify converter utils using generics

Signed-off-by: Isabella do Amaral <[email protected]>

* server: update existing objects on PATCH

Signed-off-by: Isabella do Amaral <[email protected]>

---------

Signed-off-by: Isabella Basso do Amaral <[email protected]>
Signed-off-by: Isabella do Amaral <[email protected]>
Signed-off-by: muzhouliu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants