Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marshmallow Field(Default =) Depriciated After 3.12.2 #103

Open
SoundsSerious opened this issue Mar 6, 2022 · 3 comments
Open

Marshmallow Field(Default =) Depriciated After 3.12.2 #103

SoundsSerious opened this issue Mar 6, 2022 · 3 comments

Comments

@SoundsSerious
Copy link
Contributor

SoundsSerious commented Mar 6, 2022

Marshmallow After 3.13 has changed default to dump_default= and will switch in version 4. Probably not the biggest issue since arango-orm has been considering its own schema as I've seen discussed in other issues.

To solve this issue in my library I've simply specified a version of marshmallow to 3.12.2.

A couple other ideas, fork marshmallow and include a frozen version directly in the code base. Or go through the code updating to dump_default (which I personally think is a dumb name)

(https://marshmallow.readthedocs.io/en/stable/changelog.html#id3)3.13.0 (2021-07-21)
Features:

Replace missing/default field parameters with load_default/dump_default ([#1742](https://github.com/marshmallow-code/marshmallow/pull/1742)). Thanks [@sirosen](https://github.com/sirosen) for the PR.

Deprecations:

The use of missing/default field parameters is deprecated and will be removed in marshmallow 4. load_default/dump_default should be used instead.
@ahmadjubair33
Copy link

Hi @threatify @SoundsSerious Assign me this issue i will update the new changes.

@kashifpk
Copy link
Contributor

kashifpk commented Mar 6, 2022

@ahmadjubair33 - Feel free to open a PR and we can review that.

@SoundsSerious - Yes marshmallow backward incompatible changes are starting to become annoying. Unfortunately marshmallow itself is quite tied to arango-orm at this stage.

Using jsonschema and newer offerings like pydantic could result in a much better implementation but that does require major rework of the library and would need some backward incompatible changes. Also pydantic requires python 3.6+ which is fine for newer projects but projects using older python versions might suffer.

Overall I'm leaning towards using pydantic instead of marshmallow and utilizing arango's support for json schema. This probably would need to be a major release so current projects and still keep using versions utilizing marshmallow (for which we can fix the version in dependencies).

@SoundsSerious
Copy link
Contributor Author

@kashifpk Ah well always more work to do :) I think for now at least there's an easy solution specifying the marshmallow version, and the code doesn't fail either it just warns. A hack might be to just turn the logging off for marshmallow as well.

Have you considered attrs? It doesn't really do validation unless you specify it.

On the topic of the Forking approach, I imagine there's a limited subset of features marshmellow offers, and that the schema validation requirements for arango-orm wont change much, since typing and serialization is more or less a solved science. Other than that I'm kinda ignorant on the inner workings of the library, being more of an attrs guy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants