Skip to content

GenericReferenceField support #70

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

Closed
tambeta opened this issue Feb 6, 2019 · 5 comments · Fixed by #80
Closed

GenericReferenceField support #70

tambeta opened this issue Feb 6, 2019 · 5 comments · Fixed by #80
Labels
help wanted Extra attention is needed

Comments

@tambeta
Copy link

tambeta commented Feb 6, 2019

Hi, currently the field converter throws an exception on MongoEngine's GenericReferenceField:

Exception: Don't know how to convert the MongoEngine field <mongoengine.fields.GenericReferenceField object at 0x7f24dc4d03c8> (<class 'mongoengine.fields.GenericReferenceField'>)

It would be great to have support for this field type.

@abawchen abawchen added work in progress help wanted Extra attention is needed and removed work in progress labels Feb 11, 2019
@abawchen
Copy link
Collaborator

abawchen commented Feb 12, 2019

@tambeta : Thanks for addressing this.

It seems impossible to support GenericReferenceField after investigation ... Orz -- it's too dynamic that I don't know how to convert it to fit graphql's model,

And even there is a way to do it, could you image how to write graphql query?

Any thought? @zrlay

@tambeta
Copy link
Author

tambeta commented Feb 13, 2019

It seems to me like GenericReferenceField with choices naturally maps to graphene.Union and would be queried via GraphQL using inline fragments. I'm not sure if a Union subclass could be constructed automatically by graphene-mongo or should be passed in - possibly both options might be supported.

A GRF without choices is a schemaless structure and thus clashes with GraphQL philosophy of a full static schema. Indeed I cannot see this case being supported.

@zrlay
Copy link
Contributor

zrlay commented Feb 13, 2019

This was my thought as well; as long as the set of choices is provided in the GenericReferenceField, and those choices each are found in the same registry, we should be able construct a Union that has Dynamic types.

Eventually I'd like to see generated interfaces from MongoEngine classes that are parents of multiple children found in the registry, too.

@arunsureshkumar
Copy link
Collaborator

Hi @abawchen,
Thanks for helping with the support of GenericReferenceField, it is working fine with the code from the branch feat-generic-reference-field.

It would be great to have support for the field type ListField(GenericReferenceField()), looking forward to hear the possibilities from you.

@abawchen
Copy link
Collaborator

@tambeta @zrlay : Thanks for you input, and it supports GenericReferenceField on updated master or 0.2.3. Please give it a try and feedback if any issues.

@arunsureshkumar : Will take care it later :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy