crossplane / upjet

A code generation framework and runtime for Crossplane providers
Apache License 2.0
318 stars 89 forks source link

make generate error: json: error calling MarshalJSON for type json.SimpleJSONValue: value is not known #278

Open ranour93 opened 1 year ago

ranour93 commented 1 year ago

I have followed the steps here to create a new provider: https://github.com/upbound/upjet/blob/main/docs/generating-a-provider.md

On step 8, when I run "make generate" I run into this error:

scraper: error: Failed to scrape Terraform provider metadata: cannot scrape Terraform registry: failed to scrape resource metadata from path: ../.work/dmacvicar/libvirt/website/docs/r/coreos_ignition.html.markdown: failed to convert example manifest to JSON: failed to format as JSON: marshal json: json: error calling MarshalJSON for type json.SimpleJSONValue: value is not known

I'm using Ubuntu 22.0 as my environment.

ranour93 commented 1 year ago

Here is the repo that I'm working off of in case your looking to replicate the issue:

https://github.com/ranour93/provider-libvirt

displague commented 3 months ago

I got the same error on https://github.com/equinix/terraform-provider-equinix/blob/d87be0e0de859fc2c222a4c1b1e77b8ac1847584/docs/resources/fabric_routing_protocol.md?plain=1 with v1.4.0 of upjet/cmd/scraper

mergenci commented 3 months ago

Upjet parses Terraform registry documentation to generate example manifests. It seems to me that the error is because both HCL blocks in the documentation are malformed — HCL parsing converts them to JSON, hence JSON errors.

I don't know of an easy workaround, but given that it's a small provider you may want to bypass example generation. Can you try if return nil here would work?