This repo contains the Go templates used by the webrpc-gen
cli to code-generate
webrpc Python server and client code.
webrpc-gen -schema=example.ridl -target=python -out=./example.gen.py -server -client
# or
webrpc-gen -schema=example.ridl -target=github.com/webrpc/gen-python@v0.12.0 -out=./example.gen.py -server -client
# or
webrpc-gen -schema=example.ridl -target=./local-go-templates-on-disk -out=./example.gen.py -server -client
As you can see, the -target
supports default python
, any git URI, or a local folder :)
Change any of the following values by passing -option="Value"
CLI flag to webrpc-gen
.
webrpc-gen -option | Description | Default value | Added in |
---|---|---|---|
-client |
generate client code | unset (false ) |
|
-server |
generate server code | unset (false ) |
Example:
webrpc-gen -schema=./proto.json -target=python -out server.gen.py -server
CLI option flag | Description |
---|---|
+ python.field.name = ID |
Set custom field name |
+ python.field.type = int64 |
Set custom field type (must be able to JSON unmarshal the value) |
Example:
message User
- id: uint64
+ python.field.name = ID
will result in
TODO
See _examples