yas-grpc
v1.1.6
Published
Support grpc call, grpc document and grpc mock server
Downloads
14
Maintainers
Readme
yas-grpc
Support grpc call, grpc document and grpc mock server
It's an extension for
yaml-scene
Features:
- Create testcases to test gRPC
- Make gRPC call to others
- Create a mock gRPC server
- Serve static gRPC response data
- Build handler for yourself by code
- Generate gRPC document
Sharing
Details document
Prerequisite
- Platform
yaml-scene
Installation
yas add yas-grpc # npm install -g yas-grpc OR yard global add yas-grpc
Example
gRPC call
Make a gGPC call to another
- yas-grpc/Call:
proto: ./proto/server.proto
package: user
service: UserService
method: GetUsers
address: 0.0.0.0:5000
request: {
"name": "thanh"
}
gRPC Server
Create a gRPC server to mock data
Serve static gRPC response data
- yas-grpc/Server:
address: 0.0.0.0:5000
packages:
user:
proto: ./proto/server.proto
services:
UserService:
GetUsers: {
code: 1,
data: [{name: 'thanh', age: 1}]
}
Build handler for yourself by code
- yas-grpc/Server:
address: 0.0.0.0:5000
packages:
user:
proto: ./proto/server.proto
services:
UserService:
GetCustomers: !function |
const merge = require('lodash.merge')
return merge({
name: this.request.name
}, {
age: 10
})
gRPC Document
Document all of yas-grpc/Call which got property doc
is true
or { tags: [] }
- yas-grpc/Doc/MD:
title: User gRPC Service
description: Demo CRUD gRPC to generate to markdown document
signature: "[Doan Thuan Thanh](mailto:[email protected])"
outFile: ${join(__dirname, 'grpc_document_details.md')}
gRPC calls summary
Collect information of gRPC calls
yas-grpc/Summary:
title: Testing result