Open eboto opened 7 years ago
Identified and patched a bug in array handling here https://github.com/dfxmachina/vision/pull/103#pullrequestreview-41849394
Gotta incorporate that into this PR
Currently, python bindings don't support required
fields that have a default value.
Adding a required field should be a backward-compatible change, meaning json records with no field set should be parsed into a valid python object.
Right now, bindings will fail to validate such json against the generated AVRO schema.
Validation of unions is broken.
This is because avro deserializes unions into python dicts with a different expected shape than the shape that courier deserializes them into. For example: given union[string]
, avro would successfully validate "1"
, which is not a valid representation of a courier union. Likewise, avro would fail to validate {"string": "1"}
, which is the valid representation of a courier union.
We will have to either not validate unions, or bring legit validation into the python bindings.
Another feature request: would be really great for the objects to have copy
method similar to scala bindings. It would accept **args
and produce a copy of the target instance with fields replaced by the name fields in the arguments.
Bug report: double quotes in the comment result in an invalid schema.
Request.courier
had the comments like:
/** Expected to be in the "file://" format. */
After generating courier bindings Parameters.py
:
# ipython
In [1]: from Request import Request
Exception: Error parsing schema from JSON: '{"type":"record",
....
Error message: JSONDecodeError("Expecting ',' delimiter: line 1 column 3096 (char 3095)",).
No error if"file://"
is replaced with 'file://'
.
@eboto I was looking into python bindings for courier and found this PR thread. I would like to help with this PR to prepare it for master. Are there any tasks which could help this branch?
Thanks.
WORK IN PROGRESS DO NOT MERGE
Discussion here
Python3 Courier Data Binding Generator
Courier bindings for Python 3 (tested against Python 3.6)
Features missing in action
Mainline Courier features that are not yet supported, but will be by the time this thing is ready for submit:
MyRecord.create
are required. These should be easy to add.Fruits.BANANA.property("color")
Additional tasks before merging to courier master:
TODO(py3)
items from the changelist.__init__.py
rather than per-class filesAdditional desirable tasks for later:
courier.py
as a package throughpip
instead of through the generatorPythonic API Questions
cookie.fortune.message = 'Hello World'
will change the json value ofcourier.dumps(cookie)
?courier.loads(MyRecordType, json_string
)courier.validate(my_record)
of courseNotes from interviews with a real python dev:
create
. Instead, just enforce the contract in the init function itself, throwing a courier.ValidationErrorAttributeError
or whatever the right one is