Skip to content

Inconsistance of code when doing sorting of routes and tags #416

@azdolinski

Description

@azdolinski

In case when you have all router with lowercase letters.... and we add some router called "urlscraper", + uppercase tag like "URLScraper", this will cause inconsistrance between routers and tags arrays which cause mismatch between route and file name (generated based on tags names).
Python sorted tags in lexicographical (alphabetical) order, 'U', will comes before the lowercase letters and become on first element in the array.
In case of routes you using lower() function for tags and that cause inconsistence.

    routers = sorted(
        [re.sub(TITLE_PATTERN, '_', tag.strip()).lower() for tag in sorted_tags]
    )

fix:

    sorted_tags = sorted(set(all_tags), key=lambda x: x.lower())

then both arrays (routers and sorted_tags) will be sorted in sam way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions