marshmallow-code / marshmallow-code/flask-marshmallow

porting to mongoengine

Open
#63 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
887
Forks
65
Avg merge
7h 25m
Merged PRs (30d)
3

Description

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
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with flask_marshmallow/mongoengine.py at line 95 and reproduce the failure with a default MongoDB container using `docker run -d -p 27017:27017 mongo`. Run `invoke test` and trace the HyperlinkRelated deserialization path. Done means the mongoengine hyperlink-related tests pass without the unexpected `id` keyword error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, mongodb, python
Domain
backend, databases, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.