marshmallow-code / marshmallow-code/marshmallow
Dotted `only` and `exclude` not addressable for nested Tuples
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
Can't address Nested Fields in Tuples:
```
from marshmallow import fields, Schema
class Child(Schema):
name = fields.String()
age = fields.Integer()
class Friend(Schema):
name = fields.String()
height = fields.Integer()
class Family(Schema):
kidsandfriends = fields.Tuple((fields.Nested(Child), fields.Nested(Friend)))
print(
Family(only=['kidsandfriends.name',]).dump({'kidsandfriends':({"name": "steve", "age": 0},{"name": "steve", "height":2})})
)
```
result:
```
{'kidsandfriends': ({'name': 'steve', 'age': 0}, {'height': 2, 'name': 'steve'})}
```
expected:
```
{'kidsandfriends': ({'name': 'steve'}, {'name': 'steve'})}
```
Documentation only gives me:
> Nested fields can be represented with dot delimiters.
No known Notation of dotted adressing a touple (`kidsandfriends.0.name` , `kidsandfriends.().name`, etc) gives any Result
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Family, Child, and Friend schema reproducer and inspect how dotted only/exclude paths are handled for fields.Tuple containing Nested fields. Define and test a supported path notation for tuple members, with done indicated by the expected output excluding age and height.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100