Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Problem when rendering ENUM value #124

Closed
gadsc opened this issue Jan 16, 2024 · 1 comment
Closed

bug: Problem when rendering ENUM value #124

gadsc opened this issue Jan 16, 2024 · 1 comment
Assignees
Labels
extractor: griffe Related to griffe feature New feature or request templates Jinja templates

Comments

@gadsc
Copy link

gadsc commented Jan 16, 2024

Description of the bug

The ENUM render isn't rendering the ENUM name in the value.

To Reproduce

  1. Create an enum:
class MyEnum(Enum):
    """Just a ENUM example"""
    MY_VALUE_1 = 1
    MY_VALUE_2 = 2
  1. Reference the ENUM value in a field:
MY_FIELD = MyEnum.MY_VALUE_1.value

MY_FIELD_ARRAY = [ MyEnum.MY_VALUE_1.value, MyEnum.MY_VALUE_2.value ]
  1. Generate the doc.

Generated doc:
image

Expected behavior

For ENUM values the ENUM name/full qualified name helps to gather context, it should render at least the ENUM name in the value, like MyEnum.MY_VALUE_1.value, the constant MY_VALUE_1.value or the full qualified name my_module.MyEnum.MY_VALUE_1.value.

@pawamoy pawamoy added feature New feature or request extractor: griffe Related to griffe templates Jinja templates labels Apr 13, 2024
pawamoy added a commit to mkdocstrings/griffe that referenced this issue Apr 18, 2024
…n enumeration class, instance or value

Issue-mkdocstrings/python#124: mkdocstrings/python#124
pawamoy added a commit to mkdocstrings/griffe that referenced this issue Apr 18, 2024
…n enumeration class, instance or value

Issue-mkdocstrings/python#124: mkdocstrings/python#124
pawamoy added a commit that referenced this issue Apr 19, 2024
@pawamoy pawamoy closed this as completed Apr 19, 2024
@pawamoy
Copy link
Member

pawamoy commented Apr 19, 2024

Enum values should now always render the enum instance name too.

clrpackages pushed a commit to clearlinux-pkgs/pypi-griffe that referenced this issue Apr 22, 2024
…ion 0.43.0

commit 505d73896b4849eb25316544a7b0344c1710efcc
Author: Timothée Mazzucotelli <[email protected]>
Date:   Thu Apr 18 15:15:30 2024 +0200

    chore: Prepare release 0.43.0

commit fdb21d943f72fb10a4406930bf3e3bf7aceff6b0
Author: Timothée Mazzucotelli <[email protected]>
Date:   Mon Apr 15 18:56:11 2024 +0200

    feat: Add properties telling whether an expression name resolves to an enumeration class, instance or value

    Issue-mkdocstrings/python#124: mkdocstrings/python#124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extractor: griffe Related to griffe feature New feature or request templates Jinja templates
Projects
None yet
Development

No branches or pull requests

2 participants