Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Add validation on the r.Kind field #221

Open
remyleone opened this issue Feb 3, 2022 · 2 comments
Open

Add validation on the r.Kind field #221

remyleone opened this issue Feb 3, 2022 · 2 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@remyleone
Copy link

remyleone commented Feb 3, 2022

What happened?

I've used a configurator like this:

	p.AddResourceConfigurator("scaleway_instance_ip", func(r *config.Resource) {
		// Identifier for this resource is assigned by the provider. In other
		// words it is not simply the name of the resource.
		r.ExternalName = config.IdentifierFromProvider
		r.ShortGroup = "instance"
		r.Kind = "ip"
	})

The problem is that it created issue in angryjet like this:

angryjet: error: error loading packages using pattern ./...: /Users/sieben/workspace/crossplane-scaleway-provider/apis/instance/v1alpha1/zz_ip_types.go:97:25: cannot use &(ip literal) (value of type *ip) as "k8s.io/apimachinery/pkg/runtime".Object value in argument to SchemeBuilder.Register: missing method DeepCopyObject
exit status 1
apis/generate.go:38: running "go": exit status 1
11:00:24 [FAIL]
make[1]: *** [go.generate] Error 1
make: *** [generate] Error 2

I've fixed it using IP instead of ip. Maybe it could be a good idea to add validation on the r.Kind field about the convention for kind (uppercased, lowercase, camelcase, ...)

How can we reproduce it?

@remyleone remyleone added the bug Something isn't working label Feb 3, 2022
@muvaf
Copy link
Member

muvaf commented Feb 3, 2022

@remyleone The reason it fails is because the type has to be exported, hence start with uppercase in Go. But it's a great idea to have a validation since it's not clear that this is the problem. Maybe here after all configurators are run?

@turkenh turkenh added enhancement New feature or request and removed bug Something isn't working labels Feb 7, 2022
@stale
Copy link

stale bot commented Aug 13, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Aug 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants