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

[IA-4912] Add DELETE chartVersion endpoint #6

Merged
merged 10 commits into from
May 22, 2024

Conversation

lucymcnatt
Copy link
Contributor

Adding the DELETE CRUD Admin endpoint for Sherlock to use to interact with the APP VERSION table

DELETE /api/admin/v1/charts/versions/{chartNames}

Soft-deletes a record in the APP VERSION table (DELETE) (sets their inactive_at datetime)

@lucymcnatt lucymcnatt marked this pull request as ready for review May 17, 2024 15:06
@lucymcnatt lucymcnatt requested a review from a team as a code owner May 17, 2024 15:06
@lucymcnatt lucymcnatt requested a review from jdcanas May 17, 2024 15:06
type: array
items:
type: string
style: pipeDelimited
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... do we really want to take a pipedelimited list of parameters as a raw string in the query params? Would it be possible to take a json payload with a proper array in a POST request?

Copy link
Contributor Author

@lucymcnatt lucymcnatt May 17, 2024

Choose a reason for hiding this comment

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

the possible styles are form, spaceDelimited, pipeDelimited, deepObject

spaceDelimited and pipeDelimited are what you'd expect, this is what the other 2 look like on swagger

Form:
api/admin/v1/charts/versions?chartNames=string1&chartNames=string2
deepObject:
api/admin/v1/charts/versions?chartNames=string1,string2

https://swagger.io/docs/specification/serialization/#:~:text=values%20get%20prefixed.-,Query%20Parameters,-Query%20parameters%20support

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh wait I see what you were suggesting, to make this a POST to a different endpoint instead of a DELETE?

Copy link
Contributor

@jdcanas jdcanas May 17, 2024

Choose a reason for hiding this comment

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

yeah, I think I would prefer that to parsing query parameters. Open to other thoughts though, but it seems preferable to either have it take a JSON payload to delete multiple or to have the delete endpoint take a single chartName for deletion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cc: @cpate4 what are your thoughts on making this a POST vs. DELETE? or sticking to a single chartName?

Copy link
Contributor

Choose a reason for hiding this comment

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

My original thoughts were that we would use this URL form:
DELETE api/admin/v1/charts/versions?chartName=string1&chartName=string2

... and let the framework do "the parsing" for us.

If the hangup is around syntax for deleting multiple, I would recommend just keeping it simple and using @lucymcnatt's original format of:
DELETE api/admin/v1/charts/versions/chartName

Total random aside, and happy for any feedback on this ...
I am seeing the syntax of our URL and wondering if we should just drop the versions/ from the URL, making our URL format:
ACTION api/admin/v1/charts/chartName

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to agree on the versions/ point, it feels a little redundant when we already have charts/

and I feel comfortable sticking with Form style (...versions?chartName=string1&chartName=string2), @jdcanas is that ok with you?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am tempted to keep it "as is" for now for the following reasons:

  1. ... if we did this, would we rename chartVersion to chart with the following structure?
{
  name: ...
  version: ...

  app_version: ...
  ... 
}
  1. but ultimately, the app_version is just a param into the chart, and therefore, should we introduce params or options as a map?

... so I go back to, the is a specific case at the moment. I am back to recommending that we leave it, with its current structure, and simplify the endpoint to only delete singles.

@lucymcnatt lucymcnatt force-pushed the IA-4912-deleteChartVersions branch from 6d4c717 to 37e8767 Compare May 21, 2024 18:00
@lucymcnatt lucymcnatt force-pushed the IA-4912-deleteChartVersions branch from a9eb8eb to 2a08258 Compare May 21, 2024 22:02
@lucymcnatt lucymcnatt requested review from cpate4 and jdcanas May 21, 2024 22:05
@mlilynolting
Copy link

this looks good - there are some remaining "chartVersion" references in the code; is there a reason to keep this and not just change everything to "chart"?

Copy link
Contributor

@jdcanas jdcanas left a comment

Choose a reason for hiding this comment

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

LGTM, just remove the unnecessary throws exception sonarcube is pointing out

Copy link

sonarcloud bot commented May 22, 2024

@lucymcnatt lucymcnatt merged commit 54ee182 into main May 22, 2024
11 checks passed
@lucymcnatt lucymcnatt deleted the IA-4912-deleteChartVersions branch May 22, 2024 21:55
@lucymcnatt lucymcnatt restored the IA-4912-deleteChartVersions branch May 22, 2024 21:58
@lucymcnatt lucymcnatt deleted the IA-4912-deleteChartVersions branch May 22, 2024 21:58
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.

4 participants