Coder Social home page Coder Social logo

Comments (26)

srbiotik avatar srbiotik commented on June 16, 2024 3

Hey, sorry for being passive about this I've been entangled by some work stuff. I'll push my version of code so far at this repository, you can run a test from the ./tests/cli/test_import_schema.py there are some test gql files in the ./tests/cli/helpers/type which you can change through the SPECIFIC_TYPE and SPECIFIC_SCHEMA constants in the test file. The resulting output should be located in the tests/cli/helpers/output. All the work done in this was some months ago so I need to browse it a bit to remember... I'll be joining the discord chanell tomorrow so we can chat about it there!

P.S.
Be gentle, it's my first contribution :)

from strawberry.

Jatinbalodhi96 avatar Jatinbalodhi96 commented on June 16, 2024

@patrick91 I want to work on this. How to get started on this?

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

@Jatinbalodhi96 I'll assign you to this issue :)

We have a small contribution guide here: https://github.com/strawberry-graphql/strawberry/blob/master/CONTRIBUTING.md#contributing-to-code

We also have a cli setup (which should be refactored I reckon): https://github.com/strawberry-graphql/strawberry/blob/master/strawberry/cli/__init__.py

So maybe you can start from that, what do you think?

from strawberry.

Jatinbalodhi96 avatar Jatinbalodhi96 commented on June 16, 2024

thanks, @patrick91 I followed the guide but while running I faced two errors:

  • - poetry run pytest tests it gives me ModuleNotFoundError: No module named 'termios' error, after searching figure out that this library is for Linux only.
  • While import strawberry I got no Module named 'graphql' even I already ran poetry install which ran.
  • Unable to install graphql by running poetry add graphql getting building 'graphql_ext' extension error: unknown file type '.pyx' (from 'graphql/graphql_ext.pyx') error

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

@Jatinbalodhi96 uh, never seen that error, what os and python version are using?

from strawberry.

Jatinbalodhi96 avatar Jatinbalodhi96 commented on June 16, 2024

I'm using python 3.7 on windows 10, Now I'm able to run

  • I'm able run strawberry now but i installed graphql seperately using pipenv install --pre "graphql-core>=3a"

The error I sent earlier was because I was installing graphql using poetry add graphql, I'm not sure if it works same for all.

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

@Jatinbalodhi96 oh interest, I never tried strawberry or event GraphQL core on windows, I'll see if I can add tests for that, I don't have a windows machine at the moment, so it might take me a while to test this :)

from strawberry.

Jatinbalodhi96 avatar Jatinbalodhi96 commented on June 16, 2024

@patrick91 I've never used poetry before but is this correct way to build the dev version.
image

because I'm unable to run strawberry cli, but able to import strawberry.

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

@Jatinbalodhi96 yes :)

can you try with

poetry run strawberry ?

from strawberry.

Jatinbalodhi96 avatar Jatinbalodhi96 commented on June 16, 2024

@patrick91 thanks this command run cli, but also I'm unable to import strawberry if I'm outside the directory, so like we do with pip for dependency installation pip install -e .

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

@Jatinbalodhi96 yes, poetry works a bit differently than pip, here's the docs on add: https://poetry.eustace.io/docs/cli/#add

do use it like pip install -e . you need another poetry project as far as I understand :)

from strawberry.

srbiotik avatar srbiotik commented on June 16, 2024

Hey, I'm interested in working on this too, this would be my first contribution ever...
Is it possible for two people to be working the same issue?

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

@srbiotik no one is working on this at the moment, feel free to try! Ping me if you need some help 😉

from strawberry.

srbiotik avatar srbiotik commented on June 16, 2024

@patrick91 Thanks a bunch, can't wait to sink my teeth into this!

from strawberry.

srbiotik avatar srbiotik commented on June 16, 2024

@patrick91 Hey, I'm implementing an optional recursive parameter for resolving import statements. This would allow for large schemes to be split up into files and still get parsed without calling the command multiple times. What do you think about this?

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

@srbiotik large graphql schemas? that's interesting!

Personally I'd focus on being able to import a whole schema (even if it is one single file) and then add the support for import statements :)

from strawberry.

srbiotik avatar srbiotik commented on June 16, 2024

@patrick91 I'm working on distinguishing required fields from optional.
I approached the problem by comparing swapi graphql schema and split it into files which are located at tests/cli/helpers folder, since I can compare my output to the your swapi repository. There is one thing that kind of bugs me, why do some optional fields have = None and others not?
When I look at the SDL there is no difference between them, although I see you made the swapi some 10 months ago so it's possible there has been some change in the SDL since then.

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

The swapi repository I've worked on is quite outdated 😊

Anyway, the main reason there's = None in some places is because dataclasses don't set a default value for the field passed as optional:

image

It shouldn't make a difference for the SDL though, regarding SDL to Strawberry types, maybe we can put an option that adds = None to optional fields?

from strawberry.

srbiotik avatar srbiotik commented on June 16, 2024

Sure no problem, already implemented that, I'm wondering though about the description of the optional field. If a field has a description doesn't it need :

= strawberry.field( name="originalFieldName", description="Some clear description.")

Further more, I think i should add a name argument if the snake_case version of the field name differs from the original name.
One more question, in the swapi I never saw an optional field with a custom type object that has None assigned to it, is that a preference or a necessity?
What about the strawberry.ID type is it legal to assign a description to it?

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

One more question, in the swapi I never saw an optional field with a custom type object that has None assigned to it, is that a preference or a necessity?

I think it is not have = None :)

What about the strawberry.ID type is it legal to assign a description to it?

ID is usually self explicatory, but we should be able to do this:

x: strawberry.ID = strawberry.field(description='this is a legacy id')
``

from strawberry.

srbiotik avatar srbiotik commented on June 16, 2024

Hey @patrick91 sorry for not being very active on this for a while, I've been buried at work an life :).
So, I am up to a point where I could use somebody with more xp to look at what I've done so far, so what is the procedure how do present my work so far?

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

@srbiotik can you do a PR? we can also chat on discord if you want :) https://discord.gg/ZkRTEJQ

from strawberry.

Ambro17 avatar Ambro17 commented on June 16, 2024

Hello, I'd be interested in helping with this if you need some peer review

from strawberry.

srbiotik avatar srbiotik commented on June 16, 2024

Hello, I'd be interested in helping with this if you need some peer review

Yeah I need some help with this :). Thanks!

from strawberry.

Ambro17 avatar Ambro17 commented on June 16, 2024

Do you have your code hosted in github so we can review it together?

from strawberry.

patrick91 avatar patrick91 commented on June 16, 2024

@srbiotik any updates on this? I might need to implement it soon for something I'm working on, don't want to waste your time 😊

from strawberry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.