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

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

Closed
headconnect opened this issue Jan 24, 2022 · 2 comments · Fixed by #143
Closed

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

headconnect opened this issue Jan 24, 2022 · 2 comments · Fixed by #143
Assignees
Labels
area/codegen Affects quality or correctness of generated code kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@headconnect
Copy link

headconnect commented Jan 24, 2022

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.

@headconnect headconnect added the kind/bug Some behavior is incorrect or out of spec label Jan 24, 2022
@viveklak viveklak added kind/bug Some behavior is incorrect or out of spec and removed kind/bug Some behavior is incorrect or out of spec labels Feb 1, 2022
@mattolenik mattolenik added the area/codegen Affects quality or correctness of generated code label Jun 2, 2022
@cleverguy25
Copy link

@pulumi-bot
Copy link

This issue has been addressed in PR #143 and shipped in release v1.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/codegen Affects quality or correctness of generated code kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants