Fueled / django-init

Project template used at Fueled for scaffolding new Django based projects. :dizzy:
Other
189 stars 46 forks source link

feat: add GraphQL API implementation using django-graphene #449

Closed sun337 closed 1 year ago

sun337 commented 2 years ago

Are there any side effects?

None

sahithchandan commented 2 years ago

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
theskumar commented 2 years ago

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

theskumar commented 2 years ago

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

CuriousLearner commented 2 years ago

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 commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

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

theskumar commented 1 year ago

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.

CuriousLearner commented 1 year ago

Hello @theskumar / @sahithchandan

Can you please take a look here?

theskumar commented 1 year ago

@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?
CuriousLearner commented 1 year ago

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.