Skip to content

Missing import and attribute in .NET generated code #49

@alexeyzimarev

Description

@alexeyzimarev

When generating CRDs code for .NET the generated code has no import for the correct KubernetesResource base class, as well as using the CrdsResourceType attribute, which is nowhere to be found.

Steps to reproduce

  1. run ./crd2pulumi -d cert-manager.crds.yaml
  2. open the Pulumi.Crds.csproj project
  3. the project has errors in all the generated CDR code files

Expected: the generated project compiles
Actual: the generated project doesn't compile

Example:

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Crds.Certmanager.V1
{
    /// <summary>
    /// A Certificate resource should be created to ensure an up to date and signed x509 certificate is stored in the Kubernetes Secret resource named in `spec.secretName`.
    ///  The stored certificate will be renewed before it expires (as configured by `spec.renewBefore`).
    /// </summary>
    [CrdsResourceType("kubernetes:cert-manager.io/v1:Certificate")]
    public partial class Certificate : KubernetesResource
    {

In this file, the KubernetesResource is not resolved in any using namespace. Adding this:

using Pulumi.crds;

solves the issue, but it must be done in all the files.

Also, the CrdsResourceType attribute is not resolved, and I cannot find it anywhere.

Metadata

Metadata

Assignees

Labels

area/codegenAffects quality or correctness of generated codekind/bugSome behavior is incorrect or out of specresolution/fixedThis issue was fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions