You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[project/schemas]: go types contains conflicting code if two xrd's in same api-group has integer enum field #444
The generated go schemas from `crossplane project build`` seems to be conflicting when two XRDs in the same API group and version contain integer enums.
Example:
XRD's for custom Subnet and VirtualNetwork resources define a .spec.size integer enum with the values 8, 16, 32, 64, 128, 256, 512.
The generated models will declare the same package-level constant name for both enum types:
// Subnet model
const (
Empty SubnetSpecSize = 8
)
// VirtualNetwork model
const (
Empty VirtualNetworkSpecSize = 8
)
These declarations collide and the embedded functions that imports a type from this api group will fail:
crossplane: error: failed to build function "firewall": failed to build runtime images: failed to build function: build: go build: exit status 1: # dev.crossplane.io/models/io/example/azure/v1alpha1
../../schemas/go/io/example/azure/v1alpha1/virtualnetwork.go:109:2: Empty redeclared in this block
../../schemas/go/io/example/azure/v1alpha1/subnet.go:91:2: other declaration of Empty
../../schemas/go/io/example/azure/v1alpha1/virtualnetwork.go:115:7: invalid case Empty in switch on e (mismatched types SubnetSpecSize and VirtualNetworkSpecSize)
Expected behavior: Go model generation should generate unique constant names so resources in the same package compile successfully.
How can we reproduce it?
Use a Crossplane project with Go schema generation enabled (spec.schemas.languages: ["go"]) and an embedded Go function that imports the generated API package.
changed the title [-]Crossplane Project build generates incorrect Go code for integer enums[/-][+]Crossplane Project build generates conflicting code if two xrd's in same api-group has same integer enum field[/+]on Oct 22, 2026
changed the title [-]Crossplane Project build generates conflicting code if two xrd's in same api-group has same integer enum field[/-][+]Crossplane Project build generates conflicting code if two xrd's in same api-group has integer enum field[/+]on Oct 22, 2026
changed the title [-]Crossplane Project build generates conflicting code if two xrd's in same api-group has integer enum field[/-][+][project/schemas]: go types contains conflicting code if two xrd's in same api-group has integer enum field[/+]on Oct 22, 2026
Activity
[-]Crossplane Project build generates incorrect Go code for integer enums[/-][+]Crossplane Project build generates conflicting code if two xrd's in same api-group has same integer enum field[/+][-]Crossplane Project build generates conflicting code if two xrd's in same api-group has same integer enum field[/-][+]Crossplane Project build generates conflicting code if two xrd's in same api-group has integer enum field[/+][-]Crossplane Project build generates conflicting code if two xrd's in same api-group has integer enum field[/-][+][project/schemas]: go types contains conflicting code if two xrd's in same api-group has integer enum field[/+]nkzk commentedon Oct 22, 2026
The generated code also seems to be missing enum values but created a separate issue for that: #445