Closed sanderblue closed 5 months ago
(edited version of the comment posted on 19 Jun 2024)
@sanderblue one more question 😄 in entities/types.go
, looks like Tutone has been deleting a couple of interface unmarshal methods such as func UnmarshalApmApplicationEntityInterface()
, func UnmarshalApmApplicationEntityOutlineInterface()
and changes around these functions (there are other references of deleted unmarshal functions UnmarshalJSON
too, along with other things like func UnmarshalDashboardWidgetCommonsInterface()
, func UnmarshalEntitySummaryMetricValueInterface()
and similar ones but I believe these are mostly related to outdated types we have had for a very long time in the entities package).
Can you please take a look just so we can double check removing these methods is safe? I plan on taking a deeper look into entities/types.go
tomorrow when I'm back again, but just wanted to know your opinion about this.
I see func UnmarshalAiWorkflowsConfigurationInterface()
and func UnmarshalAiNotificationsAuthInterface()
have also been removed from types.go
, but moved to types_.go
, which is why I'm wondering the ones I've listed above also need to be in types_.go
maybe? Just a thought 🤔
@pranav-new-relic
(edited version of the comment posted on 19 Jun 2024)
@sanderblue one more question 😄 in
entities/types.go
, looks like Tutone has been deleting a couple of interface unmarshal methods such asfunc UnmarshalApmApplicationEntityInterface()
,func UnmarshalApmApplicationEntityOutlineInterface()
and changes around these functions (there are other references of deleted unmarshal functionsUnmarshalJSON
too, along with other things likefunc UnmarshalDashboardWidgetCommonsInterface()
,func UnmarshalEntitySummaryMetricValueInterface()
and similar ones but I believe these are mostly related to outdated types we have had for a very long time in the entities package).Can you please take a look just so we can double check removing these methods is safe? I plan on taking a deeper look into
entities/types.go
tomorrow when I'm back again, but just wanted to know your opinion about this.I see
func UnmarshalAiWorkflowsConfigurationInterface()
andfunc UnmarshalAiNotificationsAuthInterface()
have also been removed fromtypes.go
, but moved totypes_.go
, which is why I'm wondering the ones I've listed above also need to be intypes_.go
maybe? Just a thought 🤔
I'm not sure why UnmarshalApmApplicationEntityInterface()
was deleted, but my hunch is the interface definition what it implements changed to where Tutone no longer needs to create a "special" unmarshal method for it. And if I add back the function that's currently in main
, that unmarshal method references a type that doesn't exist anymore (ApmAgentInstrumentedServiceEntityOutline
). And since that type was the only type referenced in the "special" unmarshal method, I think that's why we no longer need that unmarshal method now.
The UnmarshalJSON()
still exists in several areas where it's required for special unmarshalling, but I'm fairly certain type definitions have changed so some no longer need this method I think.
The type EntitySummaryMetricValue
no longer exists (see screenshot), so we're good there.
The type DashboardWidgetCommons
no longer exists as well, so I think we're also good there.
The AiNotificationsAuth
and AiWorkflowsConfiguration
types and associated methods were manually added a while back when we had to do a quick fix for a breaking change that was introduced in the API. We will want to put these types in their proper package at some point, but I didn't want to take any additional risks on top what's already being performing this massive regeneration of code.
Phew, that was a lot to go through, but I'm glad you called all that stuff out. It gives me some more confidence that this huge code regeneration should work out okay. 🙂 😎 🤞
Thanks for clarifying - I just took a final look and I guess we're all set :)
Our
entities
package (along with a few others), contain a mix of manually edited code and generated code. The primary intent of this PR is to clean up and reorganize ourentities
package in a manner that allows us to generate code seamlessly for this package.This PR will require changes in terraform-provider-newrelic and newrelic-cli to accommodate updates to inputs and types. These changes should not be breaking changes.
Important design patterns to discuss as a team:
_
). E.g.entities/entities_api_.go
andentities/types_.go
. We have the option to flip this as well, i.e. make the generated files have the underscore, but that would require a massive overhaul with our code generation across the entire repo.Associated PRs for dependent projects: