🐛 Fix duplicate operation IDs for routes with multiple methods (#13175) by r266-tech · Pull Request #15194 · fastapi/fastapi

Skip to content

Navigation Menu

Sign in

Appearance settings

Conversation

When a route is registered with multiple HTTP methods (e.g., methods=['POST', 'DELETE']),
the default generate_unique_id function only uses the first method, causing duplicate
operation IDs in the OpenAPI schema.

This fix ensures that when a route has multiple methods and no explicit operation_id,
each method gets a unique operation ID by appending the current method name.

Fixes fastapi#13175

YuriiMotov