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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The typeDisplayName (rendered name of Type) is not correct when it is of type Slice of Pointers #36

Closed
AxiomSamarth opened this issue Jun 4, 2021 · 2 comments

Comments

@AxiomSamarth
Copy link
Contributor

AxiomSamarth commented Jun 4, 2021

One more level of dereferencing is required when the type is slice so as to handle the type like Slice of Pointers better.

Currently, the tool is not creating the correct display type for api fields of type slice of pointers, that is - []*Type. The reference spec is here for the types defined here

The display type of []*GCPDisks should have ideally shown up as either []*GCPDisks (for developer persona) or []GCPDisks (for operator persona) instead of []*github.com/gardener/machine-controller-manager-provider-gcp/pkg/gcp/apis/v1.GCPDisk.

In the main.go here, if the type is a Slice & specifically Slice of Pointers (i.e, Type.Elem.Kind is Pointer), then we have to add another deferencing on t.Elem and return the pointer name.

@AxiomSamarth
Copy link
Contributor Author

AxiomSamarth commented Jun 4, 2021

I faced this issue with my project related types which has one level deferencing of type []*Type.

However, there can be a scenario of any level of pointers. For example - []**Type or []***Type or []****Type. So, I have now proposed in PR #37 a generic solution which renders the typeDisplayName of the type for any levels of pointers when the type is Slice of Pointers :)

Kindly review! cc: @ahmetb

@AxiomSamarth AxiomSamarth changed the title One more level of deferencing required when the type is Slice The typeDisplayName (rendered name of Type) is not correct when it is of type Slice of Pointers Jun 4, 2021
@AxiomSamarth AxiomSamarth changed the title The typeDisplayName (rendered name of Type) is not correct when it is of type Slice of Pointers The typeDisplayName (rendered name of Type) is not correct when it is of type *Slice of Pointers* Jun 4, 2021
@AxiomSamarth AxiomSamarth changed the title The typeDisplayName (rendered name of Type) is not correct when it is of type *Slice of Pointers* The typeDisplayName (rendered name of Type) is not correct when it is of type Slice of Pointers Jun 4, 2021
@AxiomSamarth
Copy link
Contributor Author

Closing the issue as PR #37 is now merged! Thank you for guiding me through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant