def merge_endpoints(comment_tree):
    """
    All of our comments are grouped together into one big list of dictionary
    objects so we're about ready to start generating our Swagger/OAS
    definition.

    In order to begin, we need to restructure our endpoints so that they match
    the OAS 3.0 paths definition which is roughly as follows:

    paths:
        /path/:
            method:
                description: blah
                responses: blah

    Once that's all done, we also need to do a quick sort so that the
    resulting endpoints are all alphabetically ordered for sanity.

    :param comment_tree: list
    :return: dictionary
    """
    endpoints = dict()
    for item in comment_tree:
        path = item['meta']['path']
        method = item['meta']['method']
        body = item['body']
        if path not in endpoints:
            endpoints[path] = dict()
        endpoints[path][method] = body
    paths = sorted(endpoints.keys())
    sorted_endpoints = dict()
    for path in paths:
        sorted_endpoints[path] = endpoints[path]
    return sorted_endpoints
