Exzorcist / graphiql-app

0 stars 2 forks source link

[ GraphQL Editor ]: Work on "prettifying" #49

Closed Exzorcist closed 11 months ago

Exzorcist commented 11 months ago

Answer from docs:

  1. split the query into lines
  2. Iterate through each line a. remove leading and trailing whitespaces b. ignore empty lines c. decrease the indentation level for closing braces d. add the indented line to the prettified query e. increase the indentation level for opening braces
PolinaPolina94 commented 11 months ago

https://streamable.com/zl8tvd <- link for video

code 👇

query{
  characters{
    info{
      count
    }
  }
}
nowaylifer commented 11 months ago

prettifying this:

query{capsules{status}}

results in this:

query{
  capsules{
  status}
}
nowaylifer commented 11 months ago
subscription Sub {
  users {id}
}
mutation Mut {
  delete_users(where:{id: {_eq:"df"}
  }) {...someFragmant}}
fragment someFragmant on users_mutation_response {affected_rows returning {id}}

results in:

subscription Sub {
  users {
  id}
}
mutation Mut {
  delete_users(where: {
    id: {
      _eq:
    "df"}
  }
  ) {
  ...someFragmant}
}
fragment someFragmant on users_mutation_response {
  affected_rows returning {
  id}
}

I think there should be no new line after "_eq:", new line after "affected_rows", and curly braces after "id" and ""df"" should be on a new line