Skip to content

Commit d646f97

Browse files
authored
Merge pull request #7 from golang-cz/For-now-make-all-struct-args-optional
For now, make all struct args optional
2 parents 610a74e + 5fd8676 commit d646f97

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/parser/interface.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,17 @@ func (p *Parser) getMethodArguments(params *types.Tuple, isInput bool) ([]*schem
111111
return nil, fmt.Errorf("failed to parse argument %v %v: %w", name, typ, err)
112112
}
113113

114+
optional := false
115+
if varType.Struct != nil && varType.Struct.Type != nil {
116+
optional = true // TODO: SHould we use varType.Struct.Type.Optional instead?
117+
}
118+
114119
arg := &schema.MethodArgument{
115120
Name: name,
116121
Type: varType,
117122
InputArg: isInput, // denormalize/back-reference
118123
OutputArg: !isInput, // denormalize/back-reference
124+
Optional: optional,
119125
}
120126

121127
args = append(args, arg)

0 commit comments

Comments
 (0)