(
*, route: routing._APIRouteLike, method: str, operation_ids: set[str]
)
| 234 | |
| 235 | |
| 236 | def get_openapi_operation_metadata( |
| 237 | *, route: routing._APIRouteLike, method: str, operation_ids: set[str] |
| 238 | ) -> dict[str, Any]: |
| 239 | operation: dict[str, Any] = {} |
| 240 | if route.tags: |
| 241 | operation["tags"] = route.tags |
| 242 | operation["summary"] = generate_operation_summary(route=route, method=method) |
| 243 | if route.description: |
| 244 | operation["description"] = route.description |
| 245 | operation_id = route.operation_id or route.unique_id |
| 246 | if operation_id in operation_ids: |
| 247 | endpoint_name = getattr(route.endpoint, "__name__", "<unnamed_endpoint>") |
| 248 | message = f"Duplicate Operation ID {operation_id} for function {endpoint_name}" |
| 249 | file_name = getattr(route.endpoint, "__globals__", {}).get("__file__") |
| 250 | if file_name: |
| 251 | message += f" at {file_name}" |
| 252 | warnings.warn(message, stacklevel=1) |
| 253 | operation_ids.add(operation_id) |
| 254 | operation["operationId"] = operation_id |
| 255 | if route.deprecated: |
| 256 | operation["deprecated"] = route.deprecated |
| 257 | return operation |
| 258 | |
| 259 | |
| 260 | def get_openapi_path( |
no test coverage detected
searching dependent graphs…