marshmallow-code / marshmallow-code/marshmallow-oneofschema

None type object in OneOfSchema

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

Nobody has claimed this yet.

Dominant language
Python
Stars
142
Forks
44
Avg merge
7h 7m
Merged PRs (30d)
3

Description

Hello,

I use Marshmallow-oneofschema with flask_restx, sqlalchemy and flask_accepts. When I query a nonexistent object with the normal schemas, the result is {}. With OneOfSchema, unfortunately, it's not working because the NoneType value doens't match any schema :

> [
> null,
> {
> "_schema": "Unsupported object type: "
> }
> ]

Do you think it's possible to add something like this :+1:

> if obj_type is NoneType:
> return {}

Thank you,
Rom

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 by locating the OneOfSchema object-type dispatch and reproduce the reported serialization of a nonexistent object. The issue is done when a None value is handled as the expected empty result rather than producing an unsupported NoneType error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.