Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2023-03-05 15:03:48 +03:00
parent c514f9891e
commit 23113d8c9f
38 changed files with 246 additions and 31 deletions

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.1
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// source: test.proto

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.1
// protoc-gen-go-micro version: v3.10.2
// source: test.proto
package pb

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.1
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// source: test.proto

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.1
// protoc-gen-go-micro version: v3.10.2
// source: test.proto
package helloworld

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.21.12
// source: test.proto
@ -18,6 +18,11 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Test_Call_FullMethodName = "/helloworld.Test/Call"
Test_Stream_FullMethodName = "/helloworld.Test/Stream"
)
// TestClient is the client API for Test service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
@ -36,7 +41,7 @@ func NewTestClient(cc grpc.ClientConnInterface) TestClient {
func (c *testClient) Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
out := new(Response)
err := c.cc.Invoke(ctx, "/helloworld.Test/Call", in, out, opts...)
err := c.cc.Invoke(ctx, Test_Call_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -44,7 +49,7 @@ func (c *testClient) Call(ctx context.Context, in *Request, opts ...grpc.CallOpt
}
func (c *testClient) Stream(ctx context.Context, opts ...grpc.CallOption) (Test_StreamClient, error) {
stream, err := c.cc.NewStream(ctx, &Test_ServiceDesc.Streams[0], "/helloworld.Test/Stream", opts...)
stream, err := c.cc.NewStream(ctx, &Test_ServiceDesc.Streams[0], Test_Stream_FullMethodName, opts...)
if err != nil {
return nil, err
}
@ -116,7 +121,7 @@ func _Test_Call_Handler(srv interface{}, ctx context.Context, dec func(interface
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/helloworld.Test/Call",
FullMethod: Test_Call_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TestServer).Call(ctx, req.(*Request))

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.1
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// source: github.proto

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.1
// protoc-gen-go-micro version: v3.10.2
// source: github.proto
package pb

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.1
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// source: test.proto

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.1
// protoc-gen-go-micro version: v3.10.2
// source: test.proto
package pb

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.1
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// source: test.proto

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.1
// protoc-gen-go-micro version: v3.10.2
// source: test.proto
package pb

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.1
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// source: test.proto

View File

@ -1,11 +1,10 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.1
// protoc-gen-go-micro version: v3.10.2
// source: test.proto
package pb
import (
"fmt"
context "context"
v3 "go.unistack.org/micro-client-http/v3"
v31 "go.unistack.org/micro-server-http/v3"
@ -39,7 +38,6 @@ func (c *testServiceClient) LookupUser(ctx context.Context, req *LookupUserReq,
rsp := &LookupUserRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.LookupUser", req), rsp, opts...)
if err != nil {
fmt.Printf("AAA1 %v\n", err)
return nil, err
}
return rsp, nil
@ -61,7 +59,6 @@ func (c *testServiceClient) UpdateUser(ctx context.Context, req *UpdateUserReq,
rsp := &UpdateUserRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.UpdateUser", req), rsp, opts...)
if err != nil {
fmt.Printf("AAA2 %v\n", err)
return nil, err
}
return rsp, nil
@ -82,7 +79,6 @@ func (c *testServiceClient) DeleteUser(ctx context.Context, req *DeleteUserReq,
rsp := &DeleteUserRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.DeleteUser", req), rsp, opts...)
if err != nil {
fmt.Printf("AAA3 %v\n", err)
return nil, err
}
return rsp, nil
@ -104,7 +100,6 @@ func (c *testServiceClient) MailUser(ctx context.Context, req *MailUserReq, opts
rsp := &MailUserRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.MailUser", req), rsp, opts...)
if err != nil {
fmt.Printf("AAA4 %v\n", err)
return nil, err
}
return rsp, nil

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.1
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// source: test.proto

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.1
// protoc-gen-go-micro version: v3.10.2
// source: test.proto
package pb

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.21.12
// source: ngpb.proto
@ -18,6 +18,10 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Test_Call_FullMethodName = "/test.v1.ngpb.Test/Call"
)
// TestClient is the client API for Test service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
@ -36,7 +40,7 @@ func NewTestClient(cc grpc.ClientConnInterface) TestClient {
func (c *testClient) Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*CallRsp, error) {
out := new(CallRsp)
err := c.cc.Invoke(ctx, "/test.v1.ngpb.Test/Call", in, out, opts...)
err := c.cc.Invoke(ctx, Test_Call_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -82,7 +86,7 @@ func _Test_Call_Handler(srv interface{}, ctx context.Context, dec func(interface
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/test.v1.ngpb.Test/Call",
FullMethod: Test_Call_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TestServer).Call(ctx, req.(*CallReq))

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

View File

@ -0,0 +1,16 @@
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
margin: 0;
background: #fafafa;
}

View File

@ -0,0 +1,19 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="index.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
</body>
</html>

View File

@ -0,0 +1,79 @@
<!doctype html>
<html lang="en-US">
<head>
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1).replace('?', '&');
} else {
qp = location.search.substring(1);
}
arr = qp.split("&");
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value);
}
) : {};
isValid = qp.state === sentState;
if ((
oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
});
}
if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}
if (document.readyState !== 'loading') {
run();
} else {
document.addEventListener('DOMContentLoaded', function () {
run();
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,20 @@
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
window.ui = SwaggerUIBundle({
url: "./swagger.yaml",
dom_id: '#swagger-ui',
deepLinking: true, displayOperationId: true, tryItOutEnabled: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
//</editor-fold>
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,50 @@
# Generated with protoc-gen-go-micro
openapi: 3.0.3
info:
title: Test API
version: 0.0.1
paths:
/Call:
post:
tags:
- Test
operationId: Call
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CallReq'
required: true
responses:
default:
description: Default
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/CallRsp'
components:
schemas:
CallReq:
type: object
properties:
req:
type: string
CallRsp:
type: object
properties:
rsp:
type: string
Error:
type: object
properties:
err:
type: string
tags:
- name: Test

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.1
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// source: test.proto

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.1
// protoc-gen-go-micro version: v3.10.2
// source: test.proto
package helloworld

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.21.12
// source: test.proto
@ -18,6 +18,10 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Test_Call_FullMethodName = "/helloworld.Test/Call"
)
// TestClient is the client API for Test service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
@ -35,7 +39,7 @@ func NewTestClient(cc grpc.ClientConnInterface) TestClient {
func (c *testClient) Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
out := new(Response)
err := c.cc.Invoke(ctx, "/helloworld.Test/Call", in, out, opts...)
err := c.cc.Invoke(ctx, Test_Call_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -80,7 +84,7 @@ func _Test_Call_Handler(srv interface{}, ctx context.Context, dec func(interface
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/helloworld.Test/Call",
FullMethod: Test_Call_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TestServer).Call(ctx, req.(*Request))