Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Servicegen Example

Self-contained Python/asyncio implementation of the generated order-processing example. The repository contains two independent services and their model, OpenAPI, and protobuf contract packages.

Services

  • inventoryservice — gRPC inventory reservation service.
  • orderservice — HTTP order-processing service.

Contract packages

  • inventory_service_api
  • order_service_api
  • model

Run with Docker

make docker-up

Submit an order that can be reserved from the initial inventory:

curl --fail-with-body \
  -X POST http://localhost:9091/v1/processorder \
  -H 'Content-Type: application/json' \
  -d '{
    "customer_id": "customer-1",
    "items": [
      {
        "item_id": "item-1",
        "sku": "SKU-001",
        "quantity": 2,
        "unit_price": 799.0
      }
    ]
  }'

The response has order status CONFIRMED; its item has reserved: true and status CONFIRMED. Initial inventory is SKU-001: 100, SKU-002: 50, and SKU-003: 25. Successful requests reduce that inventory until the Inventory Service is restarted.

Run the integration scenario:

make integration-test

Stop the services:

make docker-down

Use make help to see all generated build, test, type-checking, formatting, and observability commands.

The source architecture used to generate the project is available in graph/example.generated.yaml.

About

Self-contained Python/asyncio example generated by Open Service Architect

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages