pdoc3 / pdoc

:snake: :arrow_right: :scroll: Auto-generate API documentation for Python projects
https://pdoc3.github.io/pdoc/
GNU Affero General Public License v3.0
1.11k stars 143 forks source link

"x | y" does not work but "Union[x, y]" does #441

Closed AnthonyZJiang closed 3 weeks ago

AnthonyZJiang commented 3 weeks ago

e.g. for a method:

def get_val() -> int | str:
    """Get value.

    Returns:
        int | str: the value.
    """
    pass

Expected Behavior

def get_val() ‑> int | str Get value.

Returns int | str The value.

Actual Behavior

def get_val() ‑> int | str Get value.

Returns int | None The value.

See more details in the attached picture

Steps to Reproduce

Additional info

Example 1

Here is the example in action, comparing | and Union: image

Example 2

Here's another example of using | instead of Union: image

ERosendo commented 3 weeks ago

@kernc is Anyone working on a fix for this yet? I'd be happy to take a look and see if I can help fix it.

ERosendo commented 3 weeks ago

@AnthonyZJiang, can you rerun the command and let us know if the problem you encountered earlier is fixed? Any additional details you can give would be helpful if it's still happening.

AnthonyZJiang commented 3 weeks ago

The issue is solved. The doc was generated correctly. I appreciate your dedication and fast response.

kernc commented 2 weeks ago

v0.11.1 released! 🙌