porting to mongoengine
I'm trying to port this package to mongoengine and marshmallow-mongoengine
https://github.com/jacobeverist/flask-marshmallow
I've commented out the sqla stuff for the time being until I can verify that the mongo tests work.
I can get the first test to pass, but I am having trouble with hyperlinkrelated tests to pass. I have done my best to replace sql backrefs with ReferenceFields. I've had to add an ObjectId converter for the serialization and stop passing the db session around since that's an sqla thing.
I can serialize just fine, but i'm having trouble with the deserialization part. Can I get an expert pair of eyes on this? Please start up a default MongoDB server on the default port using docker run -d -p 27017:27017 mongo or something similar when running the tests.
Run invoke test
def _deserialize(self, value, *args, **kwargs):
if self.external:
parsed = parse.urlparse(value)
value = parsed.path
endpoint, kwargs = self.adapter.match(value)
if endpoint != self.endpoint:
raise ValidationError(
(
'Parsed endpoint "{endpoint}" from URL "{value}"; expected '
'"{self.endpoint}"'
).format(**locals())
)
if self.url_key not in kwargs:
raise ValidationError(
'URL pattern "{self.url_key}" not found in {kwargs!r}'.format(**locals())
)
print("input:", self.url_key, args, kwargs)
> return super(HyperlinkRelated, self)._deserialize(kwargs[self.url_key], *args, **kwargs)
E TypeError: _deserialize() got an unexpected keyword argument 'id'
flask_marshmallow/mongoengine.py:95: TypeError