-
Notifications
You must be signed in to change notification settings - Fork 3
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
Adds extended JSONEncoder that can serialize pydantic models. #8
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8 +/- ##
==========================================
- Coverage 89.68% 86.37% -3.32%
==========================================
Files 30 30
Lines 931 925 -6
==========================================
- Hits 835 799 -36
- Misses 96 126 +30
Continue to review full report at Codecov.
|
Thanks Sean! |
I think this also works as a dedicated link. I'm not sure whether it should be a DictingLink as we probably want this link to handle other conversions from complex types to objects that are json serialisable (Such as datetime -> str). It looks like ParsingLink covers this though. One thing that a custom JSONEncoder does bring is that it handles recursion nicely. I think that the current implementation of DictingLink will only handle top level BaseModels, but will skip over nested types such as List[BaseModel]. (It looks like it also throws away any variables that aren't a BaseModel) If this conversion is intended to be handled by a ParsingLink this should probably be included in the rath/turms documentation here as it is likely that people will have pydantic models in their turms generated code. It should also be documented that the TerminatingLink expects all variables to be in a specific format. I think your suggestion of validating Do you think the AIOHttpLink should expose a way to modify the default values of the ClientSession? Even if the conversion of variables is handled in a ContinuationLink, people may want to use a different json serializer such as ujson. |
Fixes the issue described in #7