You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.
Actually, I'm not sure the overriding @property is the best approach to implement this. This could potentially cause issues with code inspection tools.
Instead, a class argument could be added to enable this:
# Serialise all properties defined in the class@dataclassclassRectangle(JsonSchemaMixin, serialise_properties=True):
width: intheight: int@propertydefarea(self) ->int:
returnwidth*height# Serialise only the named properties@dataclassclassRectangle(JsonSchemaMixin, serialise_properties=("area",)):
width: intheight: int@propertydefarea(self) ->int:
returnwidth*height
The following will iterate through the property type annotations:
It would be useful to be able to serialise dataclass properties as read-only properties in the json schema.
I propose to create a
serialised_property
subclass ofproperty
to do this, for example:This would generate the following json schema:
The text was updated successfully, but these errors were encountered: