appwrite / sdk-for-flutter

[READ-ONLY] Official Appwrite Flutter SDK 💙
https://appwrite.io
BSD 3-Clause "New" or "Revised" License
364 stars 109 forks source link

🐛 Bug Report: problem with graphQL queries in Dart #210

Open TechComet opened 3 months ago

TechComet commented 3 months ago

👟 Reproduction steps

final tryGraphQL = await ApiClient.graphQL.query(query: {'query':
    """

  query {
    databasesListDocuments(
        databaseId: "$appwriteDatabaseId",
        collectionId: "$collectionId",
         queries: ["equal("name", "myname")"]
             ) {
                 total
                 documents {
                  _id
                  data
                  }
                }
}
  """
    });

it's work if I remove queries: ["equal("name", "myname")"]

👍 Expected behavior

get data from database

👎 Actual Behavior

{errors: [{message: Field "databasesListDocuments" argument "queries" requires type String, found name., extensions: {category: graphql}, locations: [{line: 6, column: 51}]}, {message: Field "databasesListDocuments" argument "queries" requires type String, found myname., extensions: {category: graphql}, locations: [{line: 6, column: 59}]}]}

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

Linux

🧱 Your Environment

appwrite: ^12.0.4 appwrite server: self-hosting 1.5.7

👀 Have you spent some time to check if this issue has been raised before?

🏢 Have you read the Code of Conduct?

stnguyen90 commented 2 months ago

@TechComet, thanks for raising this issue! 🙏🏼 Where did you see that syntax for the queries? That's the old syntax which would result in an error. The new queries syntax can be found here. Also, the nested double quotes you have would probably lead to problems too.