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

[nodejs] Generated code is broken for grafana crd #92

Closed
roya opened this issue Jul 19, 2022 · 5 comments
Closed

[nodejs] Generated code is broken for grafana crd #92

roya opened this issue Jul 19, 2022 · 5 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue

Comments

@roya
Copy link

roya commented Jul 19, 2022

What happened?

When running a grafana-operator crd the generated code is broken.
I think the issue is the crd yaml is using dots which don't convert well to TS and should use instead a '_' char or something else that is supported in TS classes/interfaces names.

Steps to reproduce

download the crd file https://github.com/bitnami/charts/blob/master/bitnami/grafana-operator/crds/grafanas.integreatly.org.yaml

run:

crd2pulumi --nodejsPath grafanas grafanas.yaml

### Expected Behavior

the tool should generate code with no errors

### Actual Behavior

Generated code has a lot of errors such as: 

Namespace 'grafanas/types/input".integreatly.v1alpha1' has no exported member 'XYZ'


### Versions used

I am using the latest crd2pulumi v1.2.0

### Additional context

_No response_

### Contributing

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). 
@roya roya added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jul 19, 2022
@viveklak viveklak removed the needs-triage Needs attention from the triage team label Jul 20, 2022
@viveklak
Copy link
Contributor

@mattolenik - could you take a look?

@roya
Copy link
Author

roya commented Aug 23, 2022

Hey @viveklak @mattolenik
Are there any updates on this issue?

@jabbrwcky
Copy link

Ran into the issue as well while generating code for nodejs/typescript from the grafana-operator:

Sample output:

Invalid type names generated

export interface GrafanaSpecConfigExternal_image_storage.azure_blob {
    account_key?: string;
    account_name?: string;
    container_name?: string;
}

Invalid property names generated:

/**
 * GrafanaConfig is the configuration for grafana
 */
export interface GrafanaSpecConfig {
    alerting?: outputs.integreatly.v1alpha1.GrafanaSpecConfigAlerting;
    analytics?: outputs.integreatly.v1alpha1.GrafanaSpecConfigAnalytics;
    auth?: outputs.integreatly.v1alpha1.GrafanaSpecConfigAuth;
    auth.anonymous?: outputs.integreatly.v1alpha1.GrafanaSpecConfigAuthAnonymous;
    auth.azuread?: outputs.integreatly.v1alpha1.GrafanaSpecConfigAuthAzuread;
     // ...
}

I think the property names chosen by grafana-operator may not follow recommendations (i.e. kubernetes prefers using camel-case for yaml properties), but it still is valid yaml nonetheless.

I'd like to generalize the problem. crd2pulumi should ensure that properties and types generated from a CRD definiton
are valid property and type names in the target language.

@cleverguy25
Copy link

Added to epic https://github.com/pulumi/home/issues/3431

@rquitales
Copy link
Member

Dupe of #15

@rquitales rquitales assigned rquitales and unassigned mattolenik Sep 13, 2024
@rquitales rquitales added the resolution/duplicate This issue is a duplicate of another issue label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

6 participants