Generate http files from design schema inspired by goa
Project description
nameko-design
Generate Nameko http files from design schema inspired by goa
Dependencies
- Python3.6
- Poetry
Installation
cd nameko-design
poetry install
Usage
cd nameko-design
poetry run nameko-design nameko_design/sample.py
Design
This API design schema
with Service('http_service'):
Title('This is a http service')
with Method('liveness'):
Description('liveness probe')
Result(str)
HTTP(GET, '/liveness')
with Method('readiness'):
Description('readiness probe')
Result(str)
HTTP(GET, '/readiness')
will generate the below nameko file
from nameko.web.handlers import http
class HttpService:
name = 'http service'
@http('GET', '/liveness')
def liveness(self, request) -> str:
pass
@http('GET', '/readiness')
def readiness(self, request) -> str:
pass
TODO
- Configure http url and port
- Add URL parameter and type
- Add payload (name, type, description, position etc)
- Add validation
- Add gRPC server
- Generate proto files
- Generate swagger json
What I want:
with Service('example_service'):
Title('This is an example service')
with Method('liveness'):
Description('liveness probe')
Result(str)
HTTP(GET, '/liveness')
with Method('add'):
Description('a + b')
with Payload(): # Not yet implemented
Field(1, "a", int, "left operand") # Not yet implemented
Field(2, "b", int, "right operand") # Not yet implemented
Required("a", "b") # Not yet implemented
Result(int)
HTTP(GET, '/add/{a}/{b}') # Not yet implemented
GRPC() # Not yet implemented
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nameko-design-0.1.dev1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for nameko_design-0.1.dev1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f50bf0b7640a9d37a2393aa69809a1786b91cb8da86814b8d3d3b9c67dd8ab9a |
|
MD5 | 31b47ae5ee8b52ecd62d05f517828ae4 |
|
BLAKE2b-256 | 7143a3745a4a90bb7cb7f8d3a38cb9a3045cbcc1c98723219a7821e6451005ad |