/// <summary>Gets the client name for a given operation (may be empty).</summary> /// <param name="document">The Swagger document.</param> /// <param name="path">The HTTP path.</param> /// <param name="httpMethod">The HTTP method.</param> /// <param name="operation">The operation.</param> /// <returns>The client name.</returns> public string GetOperationName(SwaggerDocument document, string path, SwaggerOperationMethod httpMethod, SwaggerOperation operation) { var operationName = ConvertPathToName(path); var hasNameConflict = document.Paths .SelectMany(pair => pair.Value.Select(p => new { Path = pair.Key.Trim('/'), HttpMethod = p.Key, Operation = p.Value })) .Where(op => GetClientName(document, op.Path, op.HttpMethod, op.Operation) == GetClientName(document, path, httpMethod, operation) && ConvertPathToName(op.Path) == operationName ) .ToList().Count > 1; if (hasNameConflict) { operationName += CapitalizeFirst(httpMethod.ToString()); } return(operationName); }