Bug report
Steps to reproduce
- Generate a typed API client from the OpenAPI spec (GET /api/v1/docs)
- Try to call POST /{entity}/locks (acquire lock) with the generated client
- The generated Lock model requires
id, lock_expiration (ISO datetime), owned - fields that only exist in the response, not the request
Expected behavior
Request and response schemas should be separate when they differ. The acquire lock endpoint should have a dedicated request schema matching what the handler actually accepts.
Actual behavior
Three endpoints use incorrect schemas for request bodies:
1. POST /{entity}/locks (acquire lock)
- OpenAPI spec uses
Lock schema for request body
Lock requires: id (string), lock_expiration (ISO 8601 datetime), owned (boolean)
- Gateway handler (
lock_handlers.cpp:150-156) actually expects: {"lock_expiration": <integer_seconds>, "scopes": [...]}
- Generated clients fail with
KeyError: 'id' when constructing the request
2. PUT /{entity}/locks/{id} (extend lock)
- Same issue - uses
Lock schema for request body
- Should use
AcquireLockRequest or a dedicated ExtendLockRequest
3. POST /{entity}/triggers (create trigger)
TriggerCreateRequest.trigger_condition requires condition_type field
- Need to verify this matches what
trigger_handlers.cpp actually parses
Suggested fix
In schema_builder.cpp:
- Add
AcquireLockRequest schema with lock_expiration (integer, seconds) and scopes (optional array of strings)
- Use
AcquireLockRequest for POST /locks request body (keep Lock for response)
- Use
AcquireLockRequest (or dedicated schema) for PUT /locks/{id} request body
- Verify
TriggerCreateRequest.trigger_condition fields match handler expectations
Environment
- ros2_medkit version: 0.4.0
- Spec version: 0.4.0
Bug report
Steps to reproduce
id,lock_expiration(ISO datetime),owned- fields that only exist in the response, not the requestExpected behavior
Request and response schemas should be separate when they differ. The acquire lock endpoint should have a dedicated request schema matching what the handler actually accepts.
Actual behavior
Three endpoints use incorrect schemas for request bodies:
1. POST /{entity}/locks (acquire lock)
Lockschema for request bodyLockrequires:id(string),lock_expiration(ISO 8601 datetime),owned(boolean)lock_handlers.cpp:150-156) actually expects:{"lock_expiration": <integer_seconds>, "scopes": [...]}KeyError: 'id'when constructing the request2. PUT /{entity}/locks/{id} (extend lock)
Lockschema for request bodyAcquireLockRequestor a dedicatedExtendLockRequest3. POST /{entity}/triggers (create trigger)
TriggerCreateRequest.trigger_conditionrequirescondition_typefieldtrigger_handlers.cppactually parsesSuggested fix
In
schema_builder.cpp:AcquireLockRequestschema withlock_expiration(integer, seconds) andscopes(optional array of strings)AcquireLockRequestfor POST /locks request body (keepLockfor response)AcquireLockRequest(or dedicated schema) for PUT /locks/{id} request bodyTriggerCreateRequest.trigger_conditionfields match handler expectationsEnvironment