Skip to content

Commit

Permalink
Fix pulumi schema outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaid-Ajaj committed Jan 10, 2023
1 parent ce4409f commit 13280a4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/codegen/schema/bind.go
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/codegen/schema/pulumi.json
Expand Up @@ -530,7 +530,7 @@
},
"outputs": {
"description": "Specifies the return type of the function definition.",
"oneOf": [
"anyOf": [
{ "$ref": "#/$defs/typeSpec" },
{ "$ref": "#/$defs/objectTypeSpec" }
]
Expand Down
5 changes: 0 additions & 5 deletions pkg/codegen/schema/schema.go
Expand Up @@ -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
}
Expand Down

0 comments on commit 13280a4

Please sign in to comment.