What is the difference between useQuery and useLazyQuery in Apollo graphQL?

When useQuery is called by the component, it triggers the query subsequently. But when useLazyQuery is called, it does not trigger the query subsequently, and instead return a function that can be used to trigger the query manually. It is explained on this page: https://www.apollographql.com/docs/react/data/queries/#manual-execution-with-uselazyquery When React mounts and renders a component that calls the … Read more

What is the difference between OData, JsonAPI, GraphQL?

OData is a similar specification to JSON API. Both of them describe a standard protocol for creation and consumption of RESTful APIs. GraphQL is a totally different approach to API design and specifies a different way of querying API resources. OData: Designed and developed at Microsoft since 2007, standardized by the OASIS consortium. The latest … Read more

Github graphQL OrderBy

You’ve got an error Argument ‘orderBy’ on Field ‘repositories’ has an invalid value. Expected type ‘RepositoryOrder’. You forget to specify direction which is marked as mandatory. This will work: { repositoryOwner(login: “Naramsim”) { login repositories(first: 3, isFork: true, orderBy: {field: CREATED_AT, direction: ASC}) { edges { node { description } } } } }

How to use curl to access the github graphql API

You just need to escape the double quotes that are inside the JSON as the query $ curl -i -H ‘Content-Type: application/json’ -H “Authorization: bearer myGithubAccessToken” -X POST -d ‘{“query”: “query {repository(owner: \”wso2\”, name: \”product-is\”) {description}}”}’ https://api.github.com/graphql

How to document GraphQL with Swagger \ OpenAPI?

GraphQL APIs are usually documented through the documentation facilities provided by the GraphQL server itself: The type system and the descriptions on the types and fields. A tool like GraphQL playground lets you explore the API documentation through clicking/searching in a visual document tree or through IDE like features (autocomplete + tooltips). This is mostly … Read more

import error ‘force_text’ from ‘django.utils.encoding’

in django 4.0 we dont have force_text https://docs.djangoproject.com/en/4.0/ref/utils/#module-django.utils.encoding instead change force_text to force_str linux: YOUR_VENV/lib/PYTHON_VERSION/site-packages/graphene_django/utils/utils.py windows: YOUR_VENV/lib/site-packages/graphene_django/utils/utils.py from django.utils.encoding import force_text to from django.utils.encoding import force_str and def _camelize_django_str(s): if isinstance(s, Promise): s = force_text(s) return to_camel_case(s) if isinstance(s, six.string_types) else s to def _camelize_django_str(s): if isinstance(s, Promise): s = force_str(s) return to_camel_case(s) if isinstance(s, … Read more