diff --git a/pkg/codegen/schema/bind.go b/pkg/codegen/schema/bind.go index b8e17c2687a0..472bf163a38e 100644 --- a/pkg/codegen/schema/bind.go +++ b/pkg/codegen/schema/bind.go @@ -1551,7 +1551,7 @@ func (t *types) bindFunctionDef(token string) (*Function, hcl.Diagnostics, error // compute the return type from the spec if spec.ReturnType.ObjectTypeSpec != nil { // bind as an object type - outs, outDiags, err := t.bindAnonymousObjectType(path+"/outputs", token+"Result", *spec.Outputs) + outs, outDiags, err := t.bindAnonymousObjectType(path+"/outputs", token+"Result", *spec.ReturnType.ObjectTypeSpec) diags = diags.Extend(outDiags) if err != nil { return nil, diags, fmt.Errorf("error binding outputs for function %v: %w", token, err) diff --git a/pkg/codegen/schema/pulumi.json b/pkg/codegen/schema/pulumi.json index 6d479b058988..ff5d408870c9 100644 --- a/pkg/codegen/schema/pulumi.json +++ b/pkg/codegen/schema/pulumi.json @@ -530,7 +530,7 @@ }, "outputs": { "description": "Specifies the return type of the function definition.", - "oneOf": [ + "anyOf": [ { "$ref": "#/$defs/typeSpec" }, { "$ref": "#/$defs/objectTypeSpec" } ] diff --git a/pkg/codegen/schema/schema.go b/pkg/codegen/schema/schema.go index b1898f693f89..306f1c30c86b 100644 --- a/pkg/codegen/schema/schema.go +++ b/pkg/codegen/schema/schema.go @@ -1659,11 +1659,6 @@ func unmarshalFunctionSpec(funcSpec *FunctionSpec, data map[string]RawMessage) e if err := json.Unmarshal(returnType, &funcSpec.ReturnType); err != nil { return err } - - if funcSpec.ReturnType != nil && funcSpec.ReturnType.ObjectTypeSpec != nil { - // derive outputs from the return type - funcSpec.Outputs = funcSpec.ReturnType.ObjectTypeSpec - } } else { funcSpec.ReturnType = nil }