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

ConstantField produces error when converting to marshmallow schema #377

Open
GoriilaGrodd opened this issue Jun 29, 2022 · 0 comments
Open

Comments

@GoriilaGrodd
Copy link

GoriilaGrodd commented Jun 29, 2022

as_marshmallow_schema returned the following message for the ConstantField attribute:

@instance.register
class Dog(Document):
    breed = fields.ConstantField("Mongrel")

DogMaSchema = Dog.schema.as_marshmallow_schema()

Traceback (most recent call last):
  File "...\AppData\Local\Programs\Python\Python38\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 5, in <module>
  File "...\.venv\lib\site-packages\umongo\abstract.py", line 66, in as_marshmallow_schema
    nmspc = {
  File "...\.venv\lib\site-packages\umongo\abstract.py", line 67, in <dictcomp>
    name: field.as_marshmallow_field()
  File "...\.venv\lib\site-packages\umongo\abstract.py", line 209, in as_marshmallow_field
    m_field = m_class(**field_kwargs, metadata=self.metadata)
TypeError: __init__() missing 1 required positional argument: 'constant'

@GoriilaGrodd GoriilaGrodd changed the title How do I create a JSON serialization of my umongo classes? ConstantField produces error when converting to marshmallow schema Jun 30, 2022
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

1 participant