Skip to content

CRD for Percona Server for MongoDB Operator generates invalid typescript: #70

@headconnect

Description

@headconnect

Hello!

  • Vote on this issue by adding a 👍 reaction
  • To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already)

Issue details

I would like to generate typescript CRDs for Percona Server for MongoDB Operator.

Source CRD: https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/crd.yaml

Unfortunately, it generates invalid code - see generated psmdb\index.ts:

// *** WARNING: this file was generated by crd2pulumi. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

// Export sub-modules:
import * as v1 from "./v1";
import * as v1-1-0 from "./v1-1-0";
import * as v1-10-0 from "./v1-10-0";
import * as v1-11-0 from "./v1-11-0";
import * as v1-2-0 from "./v1-2-0";
import * as v1-3-0 from "./v1-3-0";
import * as v1-4-0 from "./v1-4-0";
import * as v1-5-0 from "./v1-5-0";
import * as v1-6-0 from "./v1-6-0";
import * as v1-7-0 from "./v1-7-0";
import * as v1-8-0 from "./v1-8-0";
import * as v1-9-0 from "./v1-9-0";
import * as v1alpha1 from "./v1alpha1";

export {
    v1,
    v1-1-0,
    v1-10-0,
    v1-11-0,
    v1-2-0,
    v1-3-0,
    v1-4-0,
    v1-5-0,
    v1-6-0,
    v1-7-0,
    v1-8-0,
    v1-9-0,
    v1alpha1,
};

This leads to typescript error ts(2300) with the message Duplicate identifier 'v1'

Steps to reproduce

  1. Download https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/crd.yaml
  2. execute crd2pulumi against it
  3. See typescript error

Expected:

I would expect crd2pulumi to ensure naming is valid for imports:

// This: 
import * as v1-1-0 from "./v1-1-0";
// Should be this: (replacing - with _)
import * as v1_1_0 from "./v1-1-0";

Actual:
Produces invalid code.

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