[codegen/nodejs] - Don't import types for functions if they don't exist (#8038)

* Add failing test

* Fix

* Update changelog

* Existing tests are sufficient
This commit is contained in:
Komal 2021-09-23 10:12:27 -07:00 committed by GitHub
parent c9b719c6c0
commit 41b8882fe8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 7 deletions

View file

@ -7,3 +7,6 @@
- [codegen/schema] Revert #7938
[#8035](https://github.com/pulumi/pulumi/pull/8035)
- [codegen/nodejs] Correctly determine imports for functions.
[#8038](https://github.com/pulumi/pulumi/pull/8038)

View file

@ -143,7 +143,7 @@ type SDKCodegenOptions struct {
Language string
// Language-aware code generator; such as `GeneratePackage`.
// from `codgen/dotnet`.
// from `codegen/dotnet`.
GenPackage GenPkgSignature
// Extra checks for all the tests. They keys of this map are

View file

@ -2,7 +2,6 @@
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs } from "./types";
import * as utilities from "./utilities";
import * as pulumiRandom from "@pulumi/random";

View file

@ -2,7 +2,6 @@
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs } from "./types";
import * as utilities from "./utilities";
import {Resource} from "./index";

View file

@ -2,7 +2,6 @@
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs } from "./types";
import * as utilities from "./utilities";
import {Resource} from "./index";

View file

@ -2,7 +2,6 @@
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs, enums } from "./types";
import * as utilities from "./utilities";
import {Resource} from "./index";

View file

@ -1162,10 +1162,14 @@ func (mod *modContext) getImportsForResource(member interface{}, externalImports
case *schema.Function:
needsTypes := false
if member.Inputs != nil {
needsTypes = mod.getTypeImports(member.Inputs, false, externalImports, imports, seen) || needsTypes
for _, p := range member.Inputs.Properties {
needsTypes = mod.getTypeImports(p.Type, false, externalImports, imports, seen) || needsTypes
}
}
if member.Outputs != nil {
needsTypes = mod.getTypeImports(member.Outputs, false, externalImports, imports, seen) || needsTypes
for _, p := range member.Outputs.Properties {
needsTypes = mod.getTypeImports(p.Type, false, externalImports, imports, seen) || needsTypes
}
}
return needsTypes
case []*schema.Property: