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

Unable to import crossplane provider-gcp in Typescript #2154

Open
alex-dixon opened this issue May 19, 2023 · 4 comments
Open

Unable to import crossplane provider-gcp in Typescript #2154

alex-dixon opened this issue May 19, 2023 · 4 comments
Labels
bug Something isn't working @component/cdk8s-cli Issue related to cdk8s-cli effort/medium 1 week tops priority/p2 Dependent on community feedback. PR's are welcome :)

Comments

@alex-dixon
Copy link

Description of the bug:

Error when importing github:crossplane-contrib/provider-gcp:

Importing resources, this may take a few moments...
cache.gcp.crossplane.io
  cache.gcp.crossplane.io/cloudmemorystoreinstance
compute.gcp.crossplane.io
  compute.gcp.crossplane.io/address
  compute.gcp.crossplane.io/firewall
  compute.gcp.crossplane.io/globaladdress
  compute.gcp.crossplane.io/network
  compute.gcp.crossplane.io/router
Error: only enums with string or number values are supported
    at TypeGenerator.emitTypeInternal (/project/gcp/infra/node_modules/json2jsii/lib/type-generator.js:157:23)
    at TypeGenerator.typeForProperty (/project/gcp/infra/node_modules/json2jsii/lib/type-generator.js:385:21)
    at TypeGenerator.emitProperty (/project/gcp/infra/node_modules/json2jsii/lib/type-generator.js:324:35)
    at /project/gcp/infra/node_modules/json2jsii/lib/type-generator.js:304:22
    at typesToEmit.<computed> (/project/gcp/infra/node_modules/json2jsii/lib/type-generator.js:204:28)
    at TypeGenerator.renderToCode (/project/gcp/infra/node_modules/json2jsii/lib/type-generator.js:238:33)
    at TypeGenerator.render (/project/gcp/infra/node_modules/json2jsii/lib/type-generator.js:226:14)
    at CustomResourceDefinition.generateTypeScript (/project/gcp/infra/node_modules/cdk8s-cli/lib/import/crd.js:87:29)
    at ImportCustomResourceDefinition.generateTypeScript (/project/gcp/infra/node_modules/cdk8s-cli/lib/import/crd.js:130:23)
    at async ImportCustomResourceDefinition.import (/project/gcp/infra/node_modules/cdk8s-cli/lib/import/base.js:71:13)

Object that appears to be causing.the error:

{
  "description": "AdvertisedGroups: User-specified list of prefix groups to advertise in custom mode. This field can only be populated if advertise_mode is CUSTOM and is advertised to all peers of the router. These groups will be advertised in addition to any specified prefixes. Leave this field blank to advertise no custom groups. \n Possible values: \"ALL_SUBNETS\"",
  "enum": [
    "ALL_SUBNETS"
  ],
  "items": {
    "type": "string"
  },
  "type": "array"
}

Reproduction Steps:

npx cdk8s-cli@2.2.37 init typescript-app
cdk8s import github:crossplane-contrib/provider-gcp@0.22.0

Error Log:

see above

Environment:

  • Framework Version:
  • OS:

Other:


This is 🐛 Bug Report

@alex-dixon alex-dixon added bug Something isn't working needs-triage Priority and effort undetermined yet labels May 19, 2023
@iliapolo
Copy link
Member

@alex-dixon Yeah looks like this is the offending property. I haven't seen this schema variation for defining an array of enums, I would expect this:

{
    "type": "array",
    "items": {
        "type": "string",
        "enum": ["ALL_SUBNETS"]
    }
}

How sure are we its valid schema? can't seem to find examples like this.

@iliapolo iliapolo added the response-requested Awaiting response from author label May 21, 2023
@iliapolo iliapolo transferred this issue from cdk8s-team/cdk8s May 21, 2023
@github-actions
Copy link
Contributor

This issue has not received a response in a while and will be closed soon. If you want to keep it open, please leave a comment below @mentioning a maintainer.

@github-actions github-actions bot added the closing-soon Issue/PR will be closing soon if no response is provided label Jun 20, 2023
@alex-dixon
Copy link
Author

Good point...
Maybe the intent was this?

  "type": "array",
  "items": {
    "type": "string",
    "enum": [
     "ALL_SUBNETS"
    ], 
  }

https://www.jsonschemavalidator.net/s/pun2z8DS

The original seems valid yet unsatisfiable?
https://www.jsonschemavalidator.net/s/ugWye2zU

@github-actions github-actions bot removed closing-soon Issue/PR will be closing soon if no response is provided response-requested Awaiting response from author labels Jun 21, 2023
@iliapolo
Copy link
Member

iliapolo commented Jun 1, 2024

Keeping this open and marking p2. We need to investigate if that enum declaration is indeed a valid JSON schema - if so we will fix it. If not - not.

@iliapolo iliapolo added effort/medium 1 week tops priority/p2 Dependent on community feedback. PR's are welcome :) and removed needs-triage Priority and effort undetermined yet labels Jun 1, 2024
@iliapolo iliapolo added the @component/cdk8s-cli Issue related to cdk8s-cli label Sep 20, 2024
@iliapolo iliapolo transferred this issue from cdk8s-team/cdk8s-cli Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working @component/cdk8s-cli Issue related to cdk8s-cli effort/medium 1 week tops priority/p2 Dependent on community feedback. PR's are welcome :)
Projects
None yet
Development

No branches or pull requests

2 participants