Skip to main content

Generate http files from design schema inspired by goa

Project description

nameko-design

logo

Generate Nameko http files from design schema inspired by goa

Dependencies

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

  • <input type="checkbox" disabled="" /> Configure http url and port
  • <input type="checkbox" disabled="" /> Add URL parameter and type
  • <input type="checkbox" disabled="" /> Add payload (name, type, description, position etc)
  • <input type="checkbox" disabled="" /> Add validation
  • <input type="checkbox" disabled="" /> Add gRPC server
  • <input type="checkbox" disabled="" /> Generate proto files
  • <input type="checkbox" disabled="" /> 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nameko-design, version 0.1.dev2
Filename, size File type Python version Upload date Hashes
Filename, size nameko_design-0.1.dev2-py3-none-any.whl (4.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size nameko-design-0.1.dev2.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page