-
-
Notifications
You must be signed in to change notification settings - Fork 5
bug: Validators on an inherited field cause a bug #19
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
Comments
id
field cause an error
Thanks for the report @awgymer 🙂
Yep, seems like the solution! However! During dynamic analysis, mkdocstrings/griffe#347 could alleviate the need to wait for the whole package to be loaded, but this is a consequent effort. |
This allows us to use `all_members` when looking up fields and validators, which fixes an issue with models inherting from base ones. Issue-19: #19
@awgymer I've pushed a fix on main branch, could you try it? I refactor the extension so I want to make sure I didn't break anything. |
Unfortunately I have moved on from the role where I was working on this and as such I don't have access to the codebase to test this on now. The best I could do is create a small MRE and test it locally? |
A MRE would be absolutely great @awgymer 🙇 |
I published v1.1.3, should be fixed 🙂 |
Description of the bug
I believe if you create a validator method on a field calledid
that it will cause an error:Docs were building fine until I added the following validator to my model:
Since thecls.members
is coming from agriffe.Class
object I'm not sure if this is a bug there rather than in this extension, but I suspect that it's much more likely to crop up here as typically you would avoid usingid
as an object attribute.UPDATE: I loaded in my package using
griffe
in my interpreter and I found the real cause of the bug. It seems that the field doesn't exist on theClass
object because I guessgriffe
does not include the inherited attributes from the base class (whereid
is defined)?So I think MRE:
I would guess a fix might be to use
cls.all_members
?The text was updated successfully, but these errors were encountered: