MCPcopy Create free account
hub / github.com/apache/dubbo-go / operationToMap

Method operationToMap

protocol/triple/openapi/encoder.go:138–159  ·  view source on GitHub ↗
(op *model.Operation)

Source from the content-addressed store, hash-verified

136}
137
138func (e *Encoder) operationToMap(op *model.Operation) map[string]any {
139 m := make(map[string]any)
140
141 if len(op.Tags) > 0 {
142 m["tags"] = op.Tags
143 }
144 if op.OperationId != "" {
145 m["operationId"] = op.OperationId
146 }
147 if op.RequestBody != nil {
148 m["requestBody"] = e.requestBodyToMap(op.RequestBody)
149 }
150 if len(op.Responses) > 0 {
151 resps := make(map[string]any)
152 for code, resp := range op.Responses {
153 resps[code] = e.responseToMap(resp)
154 }
155 m["responses"] = resps
156 }
157
158 return m
159}
160
161func (e *Encoder) requestBodyToMap(r *model.RequestBody) map[string]any {
162 m := make(map[string]any)

Callers 2

pathItemToMapMethod · 0.95

Calls 2

requestBodyToMapMethod · 0.95
responseToMapMethod · 0.95

Tested by 1