Skip to content

Type aliases get collapsed down into the underlying type. #23

Open
@jpeach

Description

@jpeach
Contributor

Over in service-apis, we have a CRD that uses Go type aliases:

type ConfigMapsDefaultLocalObjectReference struct {
...
}

type GatewayClassParametersObjectReference = ConfigMapsDefaultLocalObjectReference
type RouteHostExtensionObjectReference = ConfigMapsDefaultLocalObjectReference
type RouteActionExtensionObjectReference = ConfigMapsDefaultLocalObjectReference

Each alias has unique doc comments describing how it should be used in context.

What happens is that a single documentation block for ConfigMapsDefaultLocalObjectReference gets generated, and it takes the comments from one of the aliases.

https://kubernetes-sigs.github.io/service-apis/spec/#networking.x-k8s.io/v1alpha1.ConfigMapsDefaultLocalObjectReference

What I'm hoping for is for each alias to emit its own unique documentation, and probably inline the fields of the type it is aliasing.

Activity

jpeach

jpeach commented on Jun 10, 2020

@jpeach
ContributorAuthor

Looks like gengo is doing the type alias flattening, see kubernetes/gengo#180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jpeach

        Issue actions

          Type aliases get collapsed down into the underlying type. · Issue #23 · ahmetb/gen-crd-api-reference-docs