graphql-python / graphql-python/graphene-mongo
Private fields and `db_field` arg’
- Lingua principale
- Python
- Stelle
- 287
- Fork
- 111
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hello,
I’m playing with private fields with MongoEngine and Graphene-Mongo like this:
```python
class MyDocument(Document):
# define a “private” field (with underscore)
# but set the database field without the underscore:
_private = StringField(db_field="private")
class MyType(MongoengineObjectType):
class Meta:
model = MyDocument
```
And… the generated `MyType` has a field named `Private` (not `private`).
That make me ask 2 questions:
* It seems the conversion snake_case to camelCase does not make any special case for leading underscore: is it normal?
* Why not consider the database field?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Start at the MongoengineObjectType field-generation and snake_case-to-camelCase conversion entry points, then trace how the leading-underscore field and its db_field value become the GraphQL name. Done means the intended naming behavior is established and covered by a regression test for the shown MyDocument and MyType example.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- mongodb, python
- Ambito
- api
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100