-
Notifications
You must be signed in to change notification settings - Fork 18
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
🩹 Fix schema generation by making private attributes private #1382
Conversation
This PR is a draft since it depends on #1381 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
📢 Thoughts on this report? Let us know!. |
691d842
to
f6cda8c
Compare
That PR has been merged, so promoting this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Examples ran successfully.
f6cda8c
to
985e691
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, but in the long run we should put these things into a ElementConfig
class.
985e691
to
a5c6fa8
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
…n#1382) * 🩹 Fix schema generation by making private attributes private * 🧹 Rename back and properly type ClassVar fields
With pydantic 2 we had crashes when calling
.model_json_schema()
e.g.The main reason for this was pydatic failure to serialize
data_model_type
to json since the value is a class.This can all be prevented by making internal only fields "private" (leading_
) so they get excluded from the schema since we don't want users to put values for them anyway.As @joernweissenborn noted properly typing the fields with
ClassVar
those variables will also not be considered for the schema.