Maintain consistent patterns across all API endpoints, including naming conventions, response structures, HTTP status codes, and interface design. This ensures a predictable and professional API surface that follows established conventions.
Key consistency requirements:
/end-users
not /end_users
, /context-variables
not /context_variables
ReadEvaluationResponse
instead of returning internal DTOs directlyresponse_model
everywhere or nowhere within the same moduleExample of consistent endpoint design:
@router.patch("/{customer_id}", response_model=CustomerDTO)
async def update_customer(params: CustomerUpdateParamsDTO) -> CustomerDTO:
# Returns 200 OK with updated entity
@router.get("/{evaluation_id}")
async def get_evaluation(evaluation_id: EvaluationId) -> ReadEvaluationResponse:
# Dedicated response DTO, not direct internal model
This prevents API fragmentation and reduces cognitive load for API consumers by establishing predictable patterns they can rely on across all endpoints.
Enter the URL of a public GitHub repository