-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add documentation part about custom serializers #39
Conversation
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.
I appreciate the quick reaction! Apologies for being so late on the review.
Recently implemented a fix for #37, we merge after.
README.md
Outdated
If you're not happy with default `NumpyDataDict` serialization, as defined in [typing.py](./pydantic_numpy/helper/typing.py), you could define your own type with custom serializer using `NpArrayPydanticAnnotation.factory` | ||
and its `serialize_numpy_array_to_json` argument taking `Callable[[npt.ArrayLike], Iterable]`. |
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.
Maybe something like this?
If you're not happy with default `NumpyDataDict` serialization, as defined in [typing.py](./pydantic_numpy/helper/typing.py), you could define your own type with custom serializer using `NpArrayPydanticAnnotation.factory` | |
and its `serialize_numpy_array_to_json` argument taking `Callable[[npt.ArrayLike], Iterable]`. | |
If the default serialization of NumpyDataDict, as outlined in [typing.py](https://chat.openai.com/c/pydantic_numpy/helper/typing.py), doesn't meet your requirements, you have the option to define a custom type with its own serializer. This can be achieved using the NpArrayPydanticAnnotation.factory method, which accepts a custom serialization function through its serialize_numpy_array_to_json parameter. This parameter expects a function of the form Callable[[npt.ArrayLike], Iterable], allowing you to tailor the serialization process to your specific needs. |
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.
Yes, that's the better wording, fixed it!
P.S. Wondering how did chat.openai.com
ended up in your example url? 1st of April? :)
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.
No comment 😆
Chore(version): bump PATCH
Fixed with #43 |
Doc(README): add documentation part about custom serializers
Chore(version): bump PATCH
Partial of #38