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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataSource: Use the same struct for both Add+Update commands #88018

Closed
wants to merge 3 commits into from

Conversation

ryantxu
Copy link
Member

@ryantxu ryantxu commented May 17, 2024

See an alternative approach #88036


In #87718 -- we need to duplicate the validation functions because the commands for Add/Update are almost identical -- but not identical.

An alternative approach would be to make a base class for the common properties and extend the explicit ones for each -- but that seems like more work than it is worth.

The difference is that Update has a version and internal ID -- and Add has a UserID 馃し馃徎

@ryantxu ryantxu added no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels May 17, 2024
@@ -4645,6 +4597,58 @@
},
"type": "object"
},
"DataSourceCommand": {
Copy link
Member Author

Choose a reason for hiding this comment

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

really just a name change for the command object

Copy link
Contributor

@IevaVasiljeva IevaVasiljeva left a comment

Choose a reason for hiding this comment

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

The internal changes look fine to me, but could we still specify separate swagger definitions for adding and updating? Firstly, it helps to make it clearer for users which fields can be specified for which operation. Secondly, it means that we don't introduce a breaking change for Terraform where we use the current commands (DS resource in Terraform).

@marefr
Copy link
Member

marefr commented May 20, 2024

Con: It makes things less explicit/harder for devs to understand what fields to provide for a create vs update and easier to introduce unexpected bugs.

@ryantxu
Copy link
Member Author

ryantxu commented May 22, 2024

Closing this in favor of #88036 -- the syntax is annoying, but I think leads to a better solution

@ryantxu ryantxu closed this May 22, 2024
@grafana-delivery-bot grafana-delivery-bot bot removed this from the 11.1.x milestone May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants