From ab8f8ac785dac47e3fad49eb7354624a5ee3afd8 Mon Sep 17 00:00:00 2001 From: guineveresaenger Date: Thu, 12 Dec 2024 11:26:02 -0800 Subject: [PATCH 1/2] Re-set version in schema post processor --- dynamic/main.go | 1 + dynamic/testdata/TestSchemaGeneration/unparameterized.golden | 1 + 2 files changed, 2 insertions(+) diff --git a/dynamic/main.go b/dynamic/main.go index 0a97b970f..ce8e387b5 100644 --- a/dynamic/main.go +++ b/dynamic/main.go @@ -62,6 +62,7 @@ func initialSetup() (info.Provider, pfbridge.ProviderMetadata, func() error) { spec.Attribution = "" spec.Provider = schema.ResourceSpec{} spec.Language = nil + spec.Version = version.Version() }, } diff --git a/dynamic/testdata/TestSchemaGeneration/unparameterized.golden b/dynamic/testdata/TestSchemaGeneration/unparameterized.golden index 45c104ce0..8809cef0f 100644 --- a/dynamic/testdata/TestSchemaGeneration/unparameterized.golden +++ b/dynamic/testdata/TestSchemaGeneration/unparameterized.golden @@ -1,6 +1,7 @@ { "name": "terraform-provider", "displayName": "Any Terraform Provider", + "version": "v0.0.0-dev", "description": "Use any Terraform provider with Pulumi", "keywords": [ "category/utility" From c808b54776cd768f383536cff68024531e496f69 Mon Sep 17 00:00:00 2001 From: guineveresaenger Date: Thu, 12 Dec 2024 11:55:22 -0800 Subject: [PATCH 2/2] Use info.Version in initialSetup to set the version field on the generated schema --- dynamic/main.go | 3 +-- .../testdata/TestSchemaGeneration/Backblaze/b2-0.8.9.golden | 1 + .../TestSchemaGeneration/databricks/databricks-1.50.0.golden | 1 + .../TestSchemaGeneration/hashicorp/random-3.3.0.golden | 1 + .../TestSchemaGenerationFullDocs/hashicorp/random-3.6.3.golden | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dynamic/main.go b/dynamic/main.go index ce8e387b5..e7c108a64 100644 --- a/dynamic/main.go +++ b/dynamic/main.go @@ -62,7 +62,6 @@ func initialSetup() (info.Provider, pfbridge.ProviderMetadata, func() error) { spec.Attribution = "" spec.Provider = schema.ResourceSpec{} spec.Language = nil - spec.Version = version.Version() }, } @@ -90,6 +89,7 @@ func initialSetup() (info.Provider, pfbridge.ProviderMetadata, func() error) { if err != nil { return nil, err } + packageSchema.PackageSpec.Version = info.Version if info.SchemaPostProcessor != nil { info.SchemaPostProcessor(&packageSchema.PackageSpec) @@ -132,7 +132,6 @@ func initialSetup() (info.Provider, pfbridge.ProviderMetadata, func() error) { if err != nil { return plugin.ParameterizeResponse{}, err } - v, err := semver.Parse(p.Version()) if err != nil { return plugin.ParameterizeResponse{}, err diff --git a/dynamic/testdata/TestSchemaGeneration/Backblaze/b2-0.8.9.golden b/dynamic/testdata/TestSchemaGeneration/Backblaze/b2-0.8.9.golden index 59a37ed4e..61b66184c 100644 --- a/dynamic/testdata/TestSchemaGeneration/Backblaze/b2-0.8.9.golden +++ b/dynamic/testdata/TestSchemaGeneration/Backblaze/b2-0.8.9.golden @@ -1,5 +1,6 @@ { "name": "b2", + "version": "0.8.9", "description": "A Pulumi provider dynamically bridged from b2.", "attribution": "This Pulumi package is based on the [`b2` Terraform Provider](https://github.com/backblaze/terraform-provider-b2).", "repository": "https://github.com/backblaze/terraform-provider-b2", diff --git a/dynamic/testdata/TestSchemaGeneration/databricks/databricks-1.50.0.golden b/dynamic/testdata/TestSchemaGeneration/databricks/databricks-1.50.0.golden index ff3847eeb..082d3ed97 100644 --- a/dynamic/testdata/TestSchemaGeneration/databricks/databricks-1.50.0.golden +++ b/dynamic/testdata/TestSchemaGeneration/databricks/databricks-1.50.0.golden @@ -1,5 +1,6 @@ { "name": "databricks", + "version": "1.50.0", "description": "A Pulumi provider dynamically bridged from databricks.", "attribution": "This Pulumi package is based on the [`databricks` Terraform Provider](https://github.com/databricks/terraform-provider-databricks).", "repository": "https://github.com/databricks/terraform-provider-databricks", diff --git a/dynamic/testdata/TestSchemaGeneration/hashicorp/random-3.3.0.golden b/dynamic/testdata/TestSchemaGeneration/hashicorp/random-3.3.0.golden index 584322726..381e8a1a1 100644 --- a/dynamic/testdata/TestSchemaGeneration/hashicorp/random-3.3.0.golden +++ b/dynamic/testdata/TestSchemaGeneration/hashicorp/random-3.3.0.golden @@ -1,5 +1,6 @@ { "name": "random", + "version": "3.3.0", "description": "A Pulumi provider dynamically bridged from random.", "attribution": "This Pulumi package is based on the [`random` Terraform Provider](https://github.com/hashicorp/terraform-provider-random).", "repository": "https://github.com/hashicorp/terraform-provider-random", diff --git a/dynamic/testdata/TestSchemaGenerationFullDocs/hashicorp/random-3.6.3.golden b/dynamic/testdata/TestSchemaGenerationFullDocs/hashicorp/random-3.6.3.golden index abaf942eb..4bcd14a79 100644 --- a/dynamic/testdata/TestSchemaGenerationFullDocs/hashicorp/random-3.6.3.golden +++ b/dynamic/testdata/TestSchemaGenerationFullDocs/hashicorp/random-3.6.3.golden @@ -1,5 +1,6 @@ { "name": "random", + "version": "3.6.3", "description": "A Pulumi provider dynamically bridged from random.", "attribution": "This Pulumi package is based on the [`random` Terraform Provider](https://github.com/hashicorp/terraform-provider-random).", "repository": "https://github.com/hashicorp/terraform-provider-random",