graphql-python / graphql-python/graphene-mongo

Need of validating Mutation input data using a Form (Based on Mongoengine Document)

Open
#168 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
287
Forks
111
PR merge metrics
No merged PRs in 30d

Description

I'm Trying to write a mutation for my model and The problem is how to validate the data that comes from the user.
In Django, which has forms (and modelForms) that you can create dynamically based on a model you have described, this problem is handled beautifully using [DjangoFormMutation](https://github.com/graphql-python/graphene-django/blob/6046a710c887bf45a9480a162e20038ab5c95623/graphene_django/forms/mutation.py#L79), with the help of graphene-django package (You can see an example [here](https://docs.graphene-python.org/projects/django/en/latest/mutations/#djangoformmutation)).
Is there a way for us in this package that help us implement our mongo document mutations this way?
I know we can create an Argument class and handle (and validate) fields there; but using that mechanism, we need to cast each field from graphene data object type to mongoengine document filed _manually_ and that is somehow dirty.
Or more important, is there a way to dynamically generate Argument class Fields from mongoengine document ?

many thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.