Skip to content

Commit cc1ba33

Browse files
committed
Generate server bool
1 parent 1857c60 commit cc1ba33

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

dataplane/apigen/ccgen/ccgen.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func GenClient(doc *docparser.SAIInfo, sai *saiast.SAIAPI, protoOutDir, ccOutDir
3636
ProtoOutDir: protoOutDir,
3737
CCOutDir: ccOutDir,
3838
}
39-
d, err := typeinfo.Data(doc, sai, "", "", ccOutDir, protoOutDir)
39+
d, err := typeinfo.Data(doc, sai, "", "", ccOutDir, protoOutDir, false)
4040
if err != nil {
4141
return nil, err
4242
}

dataplane/apigen/ccgen/servergen.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func GenServer(doc *docparser.SAIInfo, sai *saiast.SAIAPI, protoOutDir, ccOutDir
3030
ProtoOutDir: protoOutDir,
3131
CCOutDir: ccOutDir,
3232
}
33-
d, err := typeinfo.Data(doc, sai, "", "", ccOutDir, protoOutDir)
33+
d, err := typeinfo.Data(doc, sai, "", "", ccOutDir, protoOutDir, false)
3434
if err != nil {
3535
return nil, err
3636
}

dataplane/apigen/typeinfo/typeinfo.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type APITemplate struct {
8282
CCOutDir string
8383
}
8484

85-
func Data(doc *docparser.SAIInfo, sai *saiast.SAIAPI, protoPackage, protoGoPackage, ccOutDir, protoOutDir string) (*TemplateData, error) {
85+
func Data(doc *docparser.SAIInfo, sai *saiast.SAIAPI, protoPackage, protoGoPackage, ccOutDir, protoOutDir string, server bool) (*TemplateData, error) {
8686
data := &TemplateData{
8787
APIs: map[string]*APITemplate{},
8888
}
@@ -123,7 +123,7 @@ func Data(doc *docparser.SAIInfo, sai *saiast.SAIAPI, protoPackage, protoGoPacka
123123
data.APIs[apiName].Types = append(data.APIs[apiName].Types, protoReqType, protoRespType)
124124
}
125125

126-
populateCCInfo(meta, apiName, sai, doc, fn, gFunc)
126+
populateCCInfo(meta, apiName, sai, doc, fn, gFunc, server)
127127

128128
if gFunc.Operation == getAttrOp {
129129
enum := genProtoEnum(doc, apiName, meta)
@@ -135,7 +135,7 @@ func Data(doc *docparser.SAIInfo, sai *saiast.SAIAPI, protoPackage, protoGoPacka
135135
data.APIs[apiName].Types = append(data.APIs[apiName].Types, msgs...)
136136
}
137137
if gFunc.Operation == createOp {
138-
convertFn := genConvertFunc(gFunc, meta, doc, sai, fn)
138+
convertFn := genConvertFunc(gFunc, meta, doc, sai, fn, server)
139139
data.APIs[apiName].ConvertFuncs = append(data.APIs[apiName].ConvertFuncs, convertFn)
140140
}
141141
data.APIs[apiName].Funcs = append(data.APIs[apiName].Funcs, gFunc)
@@ -144,7 +144,7 @@ func Data(doc *docparser.SAIInfo, sai *saiast.SAIAPI, protoPackage, protoGoPacka
144144
return data, nil
145145
}
146146

147-
func genConvertFunc(genFunc *GenFunc, meta *saiast.FuncMetadata, info *docparser.SAIInfo, sai *saiast.SAIAPI, fn *saiast.TypeDecl) *GenFunc {
147+
func genConvertFunc(genFunc *GenFunc, meta *saiast.FuncMetadata, info *docparser.SAIInfo, sai *saiast.SAIAPI, fn *saiast.TypeDecl, server bool) *GenFunc {
148148
convertFn := &GenFunc{
149149
Name: "convert_" + meta.Name,
150150
Operation: genFunc.Operation,
@@ -209,7 +209,7 @@ func getParamDefs(params []saiast.TypeDecl) ([]string, []string) {
209209
// populateCCInfo returns a two structs with the template data for the given function.
210210
// The first is the implementation of the API: CreateFoo.
211211
// The second is the a conversion func from attribute list to the proto message. covert_create_foo.
212-
func populateCCInfo(meta *saiast.FuncMetadata, apiName string, sai *saiast.SAIAPI, info *docparser.SAIInfo, fn *saiast.TypeDecl, genFunc *GenFunc) {
212+
func populateCCInfo(meta *saiast.FuncMetadata, apiName string, sai *saiast.SAIAPI, info *docparser.SAIInfo, fn *saiast.TypeDecl, genFunc *GenFunc, server bool) {
213213
if info.Attrs[meta.TypeName] == nil {
214214
fmt.Printf("no doc info for type: %v\n", meta.TypeName)
215215
return

0 commit comments

Comments
 (0)