django-init icon indicating copy to clipboard operation
django-init copied to clipboard

feat: add GraphQL API implementation using django-graphene

Open sun337 opened this issue 2 years ago • 5 comments

Are there any side effects?

We won't be able to upgrade to Django > 4.0, as currently graphene and drf_yasg both break with newer versions of Django

sun337 avatar Aug 25 '22 16:08 sun337

Can you modify hooks/post_gen_project.sh file to delete all GraphQL related files if the user chooses not to have it?

Eg:

if echo "{{ cookiecutter.add_graphql }}" | grep -iq "^n"; then
    rm -rf {{ cookiecutter.main_module }}/base/graphql
fi

sahithchandan avatar Sep 14 '22 09:09 sahithchandan

I'm making some changes and send it as a patch

theskumar avatar Sep 15 '22 16:09 theskumar

https://github.com/Fueled/django-init/pull/452

theskumar avatar Sep 15 '22 16:09 theskumar

The new code would also require to pass black guidelines. It currently does not and when a project will be created, the base commit's Github Action flow would fail while linting.

Refer here

CuriousLearner avatar Sep 16 '22 06:09 CuriousLearner

Hey @sun337

This PR would also require test for the added queries through the /graphql endpoint.

Make sure to delete the test file in the hooks, if user chose to not add graphql :)

CuriousLearner avatar Sep 16 '22 14:09 CuriousLearner

Now that we have the relay implementation in this branch. I think we can test the integration and also run black on the code. I noticed there is some divergence on that in the PR.

CuriousLearner avatar Dec 07 '22 10:12 CuriousLearner

@sun337 The CI is failing for importing relay in utils.py file.

CuriousLearner avatar Dec 12 '22 13:12 CuriousLearner

Discussed with @sun337, and I feel the django-graphql-jwt is not needed for this project and should re-use the core auth services provided and provides its own auth backend and permission checks views for login, register, etc similar to how we have don't it for the REST APIs.

GraphQL and REST APIs both should be using the same underlying core abstractions around auth.

theskumar avatar Dec 15 '22 06:12 theskumar

Hello @theskumar / @sahithchandan

Can you please take a look here?

CuriousLearner avatar Jan 02 '23 13:01 CuriousLearner

@sun337

  1. New documentation pages are not added to the mkdocs.yml, so that they won't be rendered, can you fix it.
  2. Is django-filter a strict dependency due to graphql support, if so can we have it installed only when graphql is enabled?

theskumar avatar Jan 03 '23 10:01 theskumar

Hey @sun337

Are there any side effects?

We won't be able to upgrade to Django > 4.0, as currently graphene and drf_yasg both break with newer versions of Django

Graphene-django 3.0.0 now supports Django 4.0 The drf-yasg doesn't state it's support for Django 4.x but the latest release was on Sep 26, 2022. So, if it supports Django 4.x now, we can upgrade.

CuriousLearner avatar Jan 03 '23 10:01 CuriousLearner