[Bug]: Add support for goland "alias" types defined in other packages in datamodel
Opened this issue · 1 comments
xmen4xp commented
Contact Details
No response
Tell us the project / group you are associated with
Community (Default)
What happened?
Example datamodel:
Common.go
package common
type ObjectRef struct {
Name string
Version string
}
package nexusapp
import (
"nexusapp-mgr/common"
"golang-appnet.eng.vmware.com/nexus-sdk/nexus/nexus"
)
type OAMApplicationRef common.ObjectRef
type Application struct {
nexus.Node Name string
Version string
OAMAppSpec OAMApplicationRef <----
DependencySpec common.ObjectRef
RuntimeSpec common.ObjectRef
}
The datamodel fails in deepcopy gen with error:
F0123 20:29:52.992923 1091 deepcopy.go:885] Hit an unsupported type invalid type for nexustempmodule/apis/nexusapp.cosmos.vmware.com/v1.OAMApplicationRef, from nexustempmodule/apis/nexusapp.cosmos.vmware.com/v1.ApplicationSpec
This is because the nexus-sdk, when generating CRD definitions for the above does not resolve the import package name in the alias statement.
type ApplicationSpec struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
OAMAppSpec OAMApplicationRef `json:"oAMAppSpec" yaml:"oAMAppSpec"`
DependencySpec commoncosmosvmwarecomv1.ObjectRef `json:"dependencySpec" yaml:"dependencySpec"`
RuntimeSpec commoncosmosvmwarecomv1.ObjectRef `json:"runtimeSpec" yaml:"runtimeSpec"`
}
type OAMApplicationRef common.ObjectRef
```~
The package name of the "common" should have been changed to "commoncosmosvmwarecomv1.ObjectRef".
For explicit import, its handle properly. But not for types imported as alias.
### Describe the expected behavior
Nexus datamodel build should have been successful.
### What version are you running?
➜ nexus version
NexusCli: v0.0.158
NexusCompiler: v0.0.61
NexusAppTemplates: v0.0.10
NexusDatamodelTemplates: v0.0.22
NexusRuntimeManifets: v0.2.63
### How critical is this bug to you?
Critical - solution is severely limited in value
### How can we recreate the bug?
Steps specified in description.
### Any debug data that you are able to share?
_No response_
### What is your operating system?
MacOS
### Any additional / relevant info
_No response_
ramramu3433 commented
New JIRA Created with ID: https://jira.eng.vmware.com/browse/NPT-805