Skip to content

Commit aeb3634

Browse files
committed
Update documentation
1 parent 00b3a7f commit aeb3634

1 file changed

Lines changed: 64 additions & 2 deletions

File tree

functions-python/operations_api/README.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Operations API
2-
The Operations API is a function that exposes the operations API.
3-
The operations API schema is located at ../../docs/OperationsAPI.yml.
2+
The Operations API is a Google Cloud Function exposing internal operations endpoints for the Mobility Database.
3+
The Operations API OpenAPI schema lives at `../../docs/OperationsAPI.yaml`.
4+
5+
> Note: generated server stubs are created from the schema. Do not edit generated code under `src/feeds_gen/`; put implementation under `src/feeds_operations/impl/`.
46
57
# Function configuration
68
The function is configured using the following environment variables:
@@ -18,7 +20,67 @@ The function is configured using the following environment variables:
1820
```
1921
- Start local and test database
2022
```
23+
# from the repository root
2124
docker compose --env-file ./config/.env.local up -d liquibase-test
25+
```
26+
- Update OperationsAPI OpenAPI components with Mobility Database Catalog API components
27+
```
28+
./scripts/api-operations-update-schema.sh
29+
```
30+
31+
32+
## Development process
33+
34+
Follow these steps when working on the Operations API:
35+
36+
1) Prerequisites
37+
- Install OpenAPI Generator (one-time):
38+
```
39+
./scripts/setup-openapi-generator.sh
40+
```
41+
- Ensure yq v4+ is available (required by the schema sync script). On macOS:
42+
```
43+
brew install yq
44+
```
45+
46+
2) Start databases locally (from repo root)
47+
```
48+
docker compose --env-file ./config/.env.local up -d liquibase-test
49+
```
50+
51+
3) Sync Operations schema components from the Catalog API
52+
- When the Catalog API schemas (`docs/DatabaseCatalogAPI.yaml`) change, update Operations to keep shared data models in sync while preserving operation-only ones:
53+
```
54+
./scripts/api-operations-update-schema.sh
55+
```
56+
This replaces `components.schemas` in `docs/OperationsAPI.yaml` with those from the Catalog, but preserves only schemas marked `x-operation: true` in Operations (non-operation dest-only schemas are removed).
57+
58+
4) Regenerate Operations API server stubs
59+
```
60+
./scripts/api-operations-gen.sh
61+
```
62+
Generated code goes to `functions-python/operations_api/src/feeds_gen/`.
63+
64+
5) Implement or update handlers
65+
- Extend the generated base classes under `src/feeds_gen/` in your implementation files under:
66+
- `src/feeds_operations/impl/feeds_operations_impl.py`
67+
- `src/feeds_operations/impl/models/*`
68+
69+
6) Run locally
70+
```
71+
./scripts/function-python-run.sh --function_name operations_api
72+
```
73+
74+
7) Run tests
75+
- Using the repo test runner (recommended):
76+
```bash
77+
./scripts/api-tests.sh --folder functions-python/operations_api
78+
```
79+
80+
8) Build an artifact (zip) for deployment
81+
```
82+
./scripts/function-python-build.sh --function_name operations_api
83+
```
2284

2385

2486
# Local development

0 commit comments

Comments
 (0)