mirumee / ariadne-website Goto Github PK
View Code? Open in Web Editor NEWThe code that powers Ariadne website
Home Page: https://ariadnegraphql.org
License: BSD 3-Clause "New" or "Revised" License
The code that powers Ariadne website
Home Page: https://ariadnegraphql.org
License: BSD 3-Clause "New" or "Revised" License
Continues mirumee/ariadne#488
We have basic subscriptions example, but it would be nice to expand it to provide complete usecase, like:
on_connect
to do authThe docs for apollo-federation is outdated.
You may have heard about schema stitching when searching for GraphQL solutions for merging multiple GraphQL servers into a single one. This approach was originally proposed back in 2018 and implemented by the Apollo Server, but it had considerable downsides which resulted in it being scrapped and federations being proposed as the new, better solution.
Schema stitching has not been scrapped and is supported by the guild. They released GraphqQL Tools v7 last year.
GraphQL Tools v7, stitching is fairly comparable to Apollo Federation with automated query planning, merged types, and declarative schema directives. -> graphql-tools
Our docs are missing Twitter card image, so they don't look all too great when linked to in Tweets.
Ariadne is compatible with PEP 484 and PEP 561, let's document that!
I found this line in the docs really confusing and I'm pretty sure they are wrong based on my brief dive into the code.
https://github.com/mirumee/ariadne-website/blame/master/docs/error-messaging.md#L46
When you return none from a query resolover, you don't get any message like ""Requested item doesn't exist or you don't have permission to see it" instead you get the message "Cannot return null for non-nullable field" which can be found here: https://github.com/graphql-python/graphql-core/blob/2c2cae7cd90ffaa7286b3a48909d9b453eebec04/src/graphql/execution/execute.py#L703
For now I'm raising an error with the message I want, but this sent me down a rabbit hole trying to figure out why I wasn't getting a better message. Am I wrong about this? Am I missing something? I would love for it to be this easy to handle missing/unauthorized access.
It's probably going to be the most sought-after integration until Django gets a proper ASGI interface.
from ariadne.asgi import GraphQL
from channels.http import AsgiHandler
from channels.routing import URLRouter
from django.urls import path
schema = ...
application = URLRouter([
path("graphql/", GraphQL(schema, debug=True)),
path("", AsgiHandler),
])
By default, when you change the graphql files, *.graphql
, the django server isn't reloaded. To register the change to a schema file, you will have to trigger a reload using another file (mostly this can be done by opening any watched file by django and then saving it). However this gets quickly exhausting when you are making a lot of active changes to your schema definition.
I have found a way to fix this very easily and want to add relevant documentation for the same.
Regards
Diptesh
Hi, before I will start I need to say thank you for the very nice and easy-to-learn package.
I am coming from the Node ecosystem, but the team decided to use Python, so we choose Ariadne to run our project :)
And I need to say was very easy to start with ( even for Python newbie )
What do you think if we can add some nice testing examples to the docs, so the new Ariadne users will able to start to write production and testable code much faster?
Ariadne works great with https://github.com/syrusakbary/aiodataloader, we should document that as a best practice of avoiding the n+1 query problem.
In the last quoted text under this section, the docs state:
Recall that resolvers need to be bound to their respective resolvers via the make_executable_schema call. If you're following along from the introduction that call will look similar to the following:
Is it supposed to be Recall that resolvers need to be bound to their respective schemas
?
Hey! In docs/modularization.md
, you use the following layout:
graphql/
types/
__init__.py
book.py
query.py
user.py
__init__.py
scalars.py
schema.py
If I use that, I get the following exception:
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/local/lib/python3.8/site-packages/ariadne/__init__.py", line 1, in <module>
from .enums import EnumType
File "/usr/local/lib/python3.8/site-packages/ariadne/enums.py", line 5, in <module>
from graphql.type import GraphQLEnumType, GraphQLNamedType, GraphQLSchema
ModuleNotFoundError: No module named 'graphql.type'
Renaming graphql
in my project root to e.g. my_graphql
fixes it. Maybe it should be changed in the documentation, as graphql-core-next
uses the name graphql
.
The ASGI docs should include a Customizing JSON serialization
section that shows how to create a HTTP handler with customized JSON response creation.
From the current website (including docs) it's not clear that Ariadne is asynchronous and based on async
/await
.
The issue was open in ariadne project first by mistake mirumee/ariadne#745
Please look there for details.
We should move existing docs to Docusaurus v2, and setup new site to have separate docs for:
New design for Ariadne's website is in the making, but was delayed by other priorities at Mirumee, so in the meantime we could use current design.
This is because in current release of Broadcaster memory://
is broken.
For Django there's https://github.com/ottoyiu/django-cors-headers
For Flask there's https://github.com/corydolphin/flask-cors
For ASGI we have https://www.starlette.io/middleware/#corsmiddleware
Not sure if we need a generic WSGI one. People who need a barebones WSGI app are probably capable of handling this.
We should upgrade Django Channels to have its own section and mention channels.db.database_sync_to_async
as a way to offload Django queries to an executor pool.
Ariadne documentation should have two sections:
The page https://ariadnegraphql.org/docs/error-messaging has this GraphQL schema example:
type Mutation {
login(username: String!, password: String!) {
error: String
user: User
}
}
Defining some kind of anonymous sub-object doesn't seem to be valid GraphQL schema, either with or without a :
between the )
and the {
.
It should be something like this:
type Mutation {
login(username: String!, password: String!): LoginResult
}
type LoginResult {
error: String
user: User
}
We should recommend a way to cache resolver responses, https://github.com/argaen/aiocache seems like a good match.
This part two to mirumee/ariadne#387
Docs should be updated to reflect two things:
literal_parser
is only required if logic converting GraphQL's AST to python type is needed.literal_parser
will be called twice when query is executed: first to verify that AST is valid, and next time to convert AST to python type. On second call literal_parser
will be called with extra argument: dict of python variables.Per documentation, this should work:
type_def = """
type User {
username: String!
likes: Int!
initials(length: Int!): String
}
"""
class UserObj:
username = "admin"
def likes(self):
return count_user_likes(self)
def initials(self, length):
return self.username[:length]
However, when I ran this example and tried making a query like this:
{
user {
likes
}
}
I got an error:
likes() takes 1 positional argument but 2 were given
When I changed likes method to be:
def likes(self, info)
it seemed to work.
Suggested fix:
callable fields don't require an extra argument
Originally posted by @heikkiket in mirumee/ariadne#691
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.