Fix duplicate operationId for routes with multiple HTTP methods by fitratgulmamadov · Pull Request #15215 · fastapi/fastapi
When a route is registered with multiple HTTP methods via add_api_route(..., methods=["POST", "DELETE"]), generate_unique_id() only uses the first method from the set, causing all methods to share the same unique_id and producing duplicate operationIds in the OpenAPI schema along with a UserWarning. Fix by detecting multi-method routes in get_openapi_operation_metadata and building a per-method operationId using the current method parameter (already available in the function), following the same pattern as generate_unique_id. Fixes fastapi#13175