graphql-python / graphql-python/graphene-mongo

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

Aperta
#168 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
287
Fork
111
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

The issue points to graphene_django/forms/mutation.py and the DjangoFormMutation example; read that reference first to understand the requested model-driven validation behavior. Then inspect this repository’s existing mutation and Argument APIs, since no local paths are named. Done would require a decided scope for MongoEngine-backed validation or generated arguments, with corresponding documentation and tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
mongodb, python
Ambito
api, databases
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.