daizutabi/mkapi

Support for `LIteral`

Closed this issue · 0 comments

First of, thanks for this library. Of all the mkdocs API documentation libraries this one has worked the best so far. God knows we need something besides sphinx for making library documentation!

I ran into an issue with a function that uses a Literal type. EG

from typing import Literal  # or from typing_extensions import Literal

def some_func(method: Literal['one', 'two']) -> str:
    ...

will raise something like:

line 305, in to_string_args
    name = annotation.__origin__.__name__.lower()
AttributeError: '_LiteralSpecialForm' object has no attribute '__name__'

I don't think it will be a hard fix and I am happy to submit a PR if it is just a simple issue of getting a str rep for Literal.