Skip to content

Support Annotating Component Constructor Function #390

@ekkohdev

Description

@ekkohdev

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

It does not currently seem possible to provide annotations/documentation for the component resource constructor function. Generated SDKs use slight variations on the same generic phrase.

// New<ComponentName> registers a new resource with the given unique name, arguments, and options.

Expanding on the Go example...

// This is a custom comment.
func NewArgoCD(ctx *pulumi.Context, name string, args ArgoCDArgs, opts ...pulumi.ResourceOption) (*ArgoCD, error) {
	component := &ArgoCD{
		ArgoCDArgs: args,
		Version:    pulumi.String(versionTag),
	}
	err := ctx.RegisterComponentResource(provider.GetTypeToken(ctx), name, component, opts...)
	if err != nil {
		return nil, err
	}

generates...

// NewArgoCD registers a new resource with the given unique name, arguments, and options.
func NewArgoCD(ctx *pulumi.Context,
	name string, args *ArgoCDArgs, opts ...pulumi.ResourceOption) (*ArgoCD, error) {
	if args == nil {
		args = &ArgoCDArgs{}
	}

	opts = internal.PkgResourceDefaultOpts(opts)
	var resource ArgoCD
	err := ctx.RegisterRemoteComponentResource("sekuro-cloud:kubernetes:ArgoCD", name, args, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}

Any doc comments added to the Go function are ignored.

It would be useful to be able to provide an annotation to the constructor so this documentation can be set by the provider authors, instead of every component having the same generic phrase that provides no additional help or guidance as to usage.

Affected area/feature

infer

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedThe issue cannot be resolved without 3rd party action.kind/enhancementImprovements or new features

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions