dapalex / py-graphql-mapper

A python library for generating GraphQL queries and mutations using plain python objects, no hardcoded strings.Any questions or issues, please report here https://github.com/dapalex/py-graphql-mapper/issues
MIT License
19 stars 1 forks source link

mapping from schema? #1

Closed gplazashell closed 1 year ago

gplazashell commented 1 year ago

Hey!

First of all, nice work, very useful library. Second, I would like to ask if there is any way of mapping a GraphQL schema into a python object in your library, if not, could be possible?

Thanks!

dapalex commented 1 year ago

Hi,

thanks for your feedback and for opening an issue (I enabled the Discussions section for any further idea to evaluate).

Currently there is no management of schemas nor types, I am creating a builder for that and I will upload it as soon as it seems stable.

In the meanwhile if you have any further detail you would like to share on this matter please do not hesitate.

Thanks

dapalex commented 1 year ago

Hi,

I am almost done with the basic schema mapping implementation. Please, let me know for what purposes you will use the mapped python object so I can adapt the implementation to your needs as much as possible.

Thanks

gplazashell commented 1 year ago

Hi @dapalex ,

My idea was to create a kind of GraphQL client that allows you to query/mutate against APIs without having to write GraphQL language at all, or at least making easy for the user to work with it. So if you map a GraphQL schema into a Python Object you can later write some generic methods to insert and query data easily in a pythonic way.

Again, good work and congratz for the repo! Looking forward to use it.

dapalex commented 1 year ago

Hi @gplazashell ,

Next release the code generator will be available, thanks for your advice.

Cheers

dapalex commented 1 year ago

Hi @gplazashell,

I recently developed a code generator which takes a schema in json and creates the python classes corresponding to the GraphQL Object Types. The updated version is available in the 'code-generator-draft' branch so far since it is in progress: right now it works only for queries involving arguments as Literal Values. I am working closely on it so there will be updates soon.

Thanks again

gplazashell commented 1 year ago

Hello again @dapalex , I'll review it as soon as I can. Nice work!