#2 - change to micro-proto/openapi

This commit is contained in:
Gorbunov Kirill Andreevich
2024-12-04 15:36:55 +03:00
parent e207117ba4
commit 8b6c5049b1
6 changed files with 126 additions and 69 deletions

View File

@@ -17,21 +17,17 @@ func TestSwaggerSet_1(t *testing.T) {
err = s.AddSwaggerset("localhost:8080", "service", data)
assert.Nil(t, err)
msgs, err := s.GetMessage(
msg, err := s.GetMessage(
"localhost:8080",
"service",
"/domain-service/v1/push_mail/enabled",
[]string{"POST", "GET"})
"GET")
assert.Nil(t, err)
assert.NotNil(t, msgs.Msgs)
for _, msg := range msgs.Msgs {
reqParam, err := json.Marshal(msg.RequestParam)
assert.Nil(t, err)
reqBody, err := json.Marshal(msg.RequestBody)
assert.Nil(t, err)
rsp, err := json.Marshal(msg.Response)
assert.Nil(t, err)
fmt.Printf("JSON: type: %s, reqParam: %s, reqBody: %s, rsp: %s \n", msg.Type, reqParam, reqBody, rsp)
fmt.Printf("Struct: type: %s, reqParam: %+v, reqBody: %+v, rsp: %+v \n", msg.Type, msg.RequestParam, msg.RequestBody, msg.Response)
}
assert.NotNil(t, msg)
req, err := json.Marshal(msg.Request)
assert.Nil(t, err)
rsp, err := json.Marshal(msg.Response)
assert.Nil(t, err)
fmt.Printf("JSON: type: %s, req: %s, rsp: %s \n", msg.Type, req, rsp)
fmt.Printf("Struct: type: %s, req: %+v, rsp: %+v \n", msg.Type, msg.Request, msg.Response)
}