Skip to content
Advertisement

Using input parameters for validation with marshmallow

Is it possible to pass parameters to a marshmallow schema to use for validation on load?

I have the following schema:

JavaScript

and I’m wondering whether, instead of typing "a", "b", "c", I could put parameters in there? Something like

JavaScript

except this doesn’t work because the following error comes up on import

JavaScript

Any other ideas?

Advertisement

Answer

No, marshmallow Schema doesn’t do that.

You can use a schema factory.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement