Hello,
I've just started to work on 'jmapd', a jmap server written in Python.
It's currently just a learning exercise but just might get serious if
there is community help.
Here's a totally useless 0.1 version that returns an arbitrary
capabilities object:
https://pypi.org/project/jmapd/
I also have a question: Does the order of specification of fields in the
standard document have any meaning?
Why it matters: When using json, I always prefer to serialize well-known
complex objects to lists instead of dicts. Of course for that to work,
we need a well-defined order of fields.
Let's look at the EmailAddress object.
>>> from spyne import *
>>> from spyne.util.dictdoc import get_object_as_json
>>>
>>> class EmailAddress(ComplexModel):
... _type_info = [
... ('name', Unicode),
... ('email', Unicode),
... ]
...
>>> get_object_as_json(EmailAddress(name='John Smith',
email='
jo...@example.com'))
'["John Smith", "
jo...@example.com"]'
>>> get_object_as_json(EmailAddress(email='
jo...@example.com'))
'[null, "
jo...@example.com"]'
(I hope this looks right on your side)
So, as you see, because an optional field is first, I have to have null
as first element. It's annoying but I guess I can live with that.
The question is: can I rely on the order of elements staying the same?
Keep up the good work.
Best regards,
Burak ARSLAN