timqian / gql-generator

Generate queries from graphql schema, used for writing api test.
MIT License
375 stars 93 forks source link

Syntax Error: Unexpected character: U+FFFD. #55

Open sauravyadav1958 opened 2 years ago

sauravyadav1958 commented 2 years ago

Hello I am trying to generate query using this command

gqlg --schemaFilePath ./schema.graphql --destDirPath ./output --depthLimit 5

it is giving me this error

G:\usr\local\node_modules\gql-generator\node_modules\graphql\language\lexer.js:420
    throw (0, _syntaxError.syntaxError)(
    ^

GraphQLError: Syntax Error: Unexpected character: U+FFFD.
    at syntaxError (G:\usr\local\node_modules\gql-generator\node_modules\graphql\error\syntaxError.js:15:10)
    at readNextToken (G:\usr\local\node_modules\gql-generator\node_modules\graphql\language\lexer.js:420:40)
    at Lexer.lookahead (G:\usr\local\node_modules\gql-generator\node_modules\graphql\language\lexer.js:84:29)
    at Lexer.advance (G:\usr\local\node_modules\gql-generator\node_modules\graphql\language\lexer.js:67:38)
    at Parser.expectToken (G:\usr\local\node_modules\gql-generator\node_modules\graphql\language\parser.js:1408:19)
    at Parser.many (G:\usr\local\node_modules\gql-generator\node_modules\graphql\language\parser.js:1525:10)
    at Parser.parseDocument (G:\usr\local\node_modules\gql-generator\node_modules\graphql\language\parser.js:121:25)
    at parse (G:\usr\local\node_modules\gql-generator\node_modules\graphql\language\parser.js:32:17)
    at buildSchema (G:\usr\local\node_modules\gql-generator\node_modules\graphql\utilities\buildASTSchema.js:101:38)
    at Object.<anonymous> (G:\usr\local\node_modules\gql-generator\index.js:21:19) {
  path: undefined,
  locations: [ { line: 1, column: 1 } ],
  extensions: [Object: null prototype] {}
}
PS G:\gitLocal\nirmaan-web\nirmaan-frontend> 

here is my schema file

schema {
  query: query_root
  mutation: mutation_root
  subscription: subscription_root
}

"""whether this query should be cached (Hasura Cloud only)"""
directive @cached(
  """measured in seconds"""
  ttl: Int! = 60

  """refresh the cache entry"""
  refresh: Boolean! = false
) on QUERY

"""
Boolean expression to compare columns of type "Boolean". All fields are combined with logical 'AND'.
"""
input Boolean_comparison_exp {
  _eq: Boolean
  _gt: Boolean
  _gte: Boolean
  _in: [Boolean!]
  _is_null: Boolean
  _lt: Boolean
  _lte: Boolean
  _neq: Boolean
  _nin: [Boolean!]
}

"""
Boolean expression to compare columns of type "Int". All fields are combined with logical 'AND'.
"""
input Int_comparison_exp {
  _eq: Int
  _gt: Int
  _gte: Int
  _in: [Int!]
  _is_null: Boolean
  _lt: Int
  _lte: Int
  _neq: Int
  _nin: [Int!]
}

"""
Boolean expression to compare columns of type "String". All fields are combined with logical 'AND'.
"""
input String_comparison_exp {
  _eq: String
  _gt: String
  _gte: String

  """does the column match the given case-insensitive pattern"""
  _ilike: String
  _in: [String!]

  """
  does the column match the given POSIX regular expression, case insensitive
  """
  _iregex: String
  _is_null: Boolean

  """does the column match the given pattern"""
  _like: String
  _lt: String
  _lte: String
  _neq: String

  """does the column NOT match the given case-insensitive pattern"""
  _nilike: String
  _nin: [String!]

  """
  does the column NOT match the given POSIX regular expression, case insensitive
  """
  _niregex: String

  """does the column NOT match the given pattern"""
  _nlike: String

  """
  does the column NOT match the given POSIX regular expression, case sensitive
  """
  _nregex: String

  """does the column NOT match the given SQL regular expression"""
  _nsimilar: String

  """
  does the column match the given POSIX regular expression, case sensitive
  """
  _regex: String

  """does the column match the given SQL regular expression"""
  _similar: String
}

"""mutation root"""
type mutation_root {
  """
  delete data from the table: "temp_post"
  """
  delete_temp_post(
    """filter the rows which have to be deleted"""
    where: temp_post_bool_exp!
  ): temp_post_mutation_response

  """
  delete single row from the table: "temp_post"
  """
  delete_temp_post_by_pk(id: Int!): temp_post

  """
  delete data from the table: "user"
  """
  delete_user(
    """filter the rows which have to be deleted"""
    where: user_bool_exp!
  ): user_mutation_response

  """
  delete single row from the table: "user"
  """
  delete_user_by_pk(id: uuid!): user

  """
  insert data into the table: "temp_post"
  """
  insert_temp_post(
    """the rows to be inserted"""
    objects: [temp_post_insert_input!]!

    """upsert condition"""
    on_conflict: temp_post_on_conflict
  ): temp_post_mutation_response

  """
  insert a single row into the table: "temp_post"
  """
  insert_temp_post_one(
    """the row to be inserted"""
    object: temp_post_insert_input!

    """upsert condition"""
    on_conflict: temp_post_on_conflict
  ): temp_post

  """
  insert data into the table: "user"
  """
  insert_user(
    """the rows to be inserted"""
    objects: [user_insert_input!]!

    """upsert condition"""
    on_conflict: user_on_conflict
  ): user_mutation_response

  """
  insert a single row into the table: "user"
  """
  insert_user_one(
    """the row to be inserted"""
    object: user_insert_input!

    """upsert condition"""
    on_conflict: user_on_conflict
  ): user

  """
  update data of the table: "temp_post"
  """
  update_temp_post(
    """increments the numeric columns with given value of the filtered values"""
    _inc: temp_post_inc_input

    """sets the columns of the filtered rows to the given values"""
    _set: temp_post_set_input

    """filter the rows which have to be updated"""
    where: temp_post_bool_exp!
  ): temp_post_mutation_response

  """
  update single row of the table: "temp_post"
  """
  update_temp_post_by_pk(
    """increments the numeric columns with given value of the filtered values"""
    _inc: temp_post_inc_input

    """sets the columns of the filtered rows to the given values"""
    _set: temp_post_set_input
    pk_columns: temp_post_pk_columns_input!
  ): temp_post

  """
  update data of the table: "user"
  """
  update_user(
    """sets the columns of the filtered rows to the given values"""
    _set: user_set_input

    """filter the rows which have to be updated"""
    where: user_bool_exp!
  ): user_mutation_response

  """
  update single row of the table: "user"
  """
  update_user_by_pk(
    """sets the columns of the filtered rows to the given values"""
    _set: user_set_input
    pk_columns: user_pk_columns_input!
  ): user
}

"""column ordering options"""
enum order_by {
  """in ascending order, nulls last"""
  asc

  """in ascending order, nulls first"""
  asc_nulls_first

  """in ascending order, nulls last"""
  asc_nulls_last

  """in descending order, nulls first"""
  desc

  """in descending order, nulls first"""
  desc_nulls_first

  """in descending order, nulls last"""
  desc_nulls_last
}

type query_root {
  """
  fetch data from the table: "temp_post"
  """
  temp_post(
    """distinct select on columns"""
    distinct_on: [temp_post_select_column!]

    """limit the number of rows returned"""
    limit: Int

    """skip the first n rows. Use only with order_by"""
    offset: Int

    """sort the rows by one or more columns"""
    order_by: [temp_post_order_by!]

    """filter the rows returned"""
    where: temp_post_bool_exp
  ): [temp_post!]!

  """
  fetch aggregated fields from the table: "temp_post"
  """
  temp_post_aggregate(
    """distinct select on columns"""
    distinct_on: [temp_post_select_column!]

    """limit the number of rows returned"""
    limit: Int

    """skip the first n rows. Use only with order_by"""
    offset: Int

    """sort the rows by one or more columns"""
    order_by: [temp_post_order_by!]

    """filter the rows returned"""
    where: temp_post_bool_exp
  ): temp_post_aggregate!

  """fetch data from the table: "temp_post" using primary key columns"""
  temp_post_by_pk(id: Int!): temp_post

  """
  fetch data from the table: "user"
  """
  user(
    """distinct select on columns"""
    distinct_on: [user_select_column!]

    """limit the number of rows returned"""
    limit: Int

    """skip the first n rows. Use only with order_by"""
    offset: Int

    """sort the rows by one or more columns"""
    order_by: [user_order_by!]

    """filter the rows returned"""
    where: user_bool_exp
  ): [user!]!

  """
  fetch aggregated fields from the table: "user"
  """
  user_aggregate(
    """distinct select on columns"""
    distinct_on: [user_select_column!]

    """limit the number of rows returned"""
    limit: Int

    """skip the first n rows. Use only with order_by"""
    offset: Int

    """sort the rows by one or more columns"""
    order_by: [user_order_by!]

    """filter the rows returned"""
    where: user_bool_exp
  ): user_aggregate!

  """fetch data from the table: "user" using primary key columns"""
  user_by_pk(id: uuid!): user
}

type subscription_root {
  """
  fetch data from the table: "temp_post"
  """
  temp_post(
    """distinct select on columns"""
    distinct_on: [temp_post_select_column!]

    """limit the number of rows returned"""
    limit: Int

    """skip the first n rows. Use only with order_by"""
    offset: Int

    """sort the rows by one or more columns"""
    order_by: [temp_post_order_by!]

    """filter the rows returned"""
    where: temp_post_bool_exp
  ): [temp_post!]!

  """
  fetch aggregated fields from the table: "temp_post"
  """
  temp_post_aggregate(
    """distinct select on columns"""
    distinct_on: [temp_post_select_column!]

    """limit the number of rows returned"""
    limit: Int

    """skip the first n rows. Use only with order_by"""
    offset: Int

    """sort the rows by one or more columns"""
    order_by: [temp_post_order_by!]

    """filter the rows returned"""
    where: temp_post_bool_exp
  ): temp_post_aggregate!

  """fetch data from the table: "temp_post" using primary key columns"""
  temp_post_by_pk(id: Int!): temp_post

  """
  fetch data from the table: "user"
  """
  user(
    """distinct select on columns"""
    distinct_on: [user_select_column!]

    """limit the number of rows returned"""
    limit: Int

    """skip the first n rows. Use only with order_by"""
    offset: Int

    """sort the rows by one or more columns"""
    order_by: [user_order_by!]

    """filter the rows returned"""
    where: user_bool_exp
  ): [user!]!

  """
  fetch aggregated fields from the table: "user"
  """
  user_aggregate(
    """distinct select on columns"""
    distinct_on: [user_select_column!]

    """limit the number of rows returned"""
    limit: Int

    """skip the first n rows. Use only with order_by"""
    offset: Int

    """sort the rows by one or more columns"""
    order_by: [user_order_by!]

    """filter the rows returned"""
    where: user_bool_exp
  ): user_aggregate!

  """fetch data from the table: "user" using primary key columns"""
  user_by_pk(id: uuid!): user
}

"""
columns and relationships of "temp_post"
"""
type temp_post {
  content: String!
  id: Int!
}

"""
aggregated selection of "temp_post"
"""
type temp_post_aggregate {
  aggregate: temp_post_aggregate_fields
  nodes: [temp_post!]!
}

"""
aggregate fields of "temp_post"
"""
type temp_post_aggregate_fields {
  avg: temp_post_avg_fields
  count(columns: [temp_post_select_column!], distinct: Boolean): Int!
  max: temp_post_max_fields
  min: temp_post_min_fields
  stddev: temp_post_stddev_fields
  stddev_pop: temp_post_stddev_pop_fields
  stddev_samp: temp_post_stddev_samp_fields
  sum: temp_post_sum_fields
  var_pop: temp_post_var_pop_fields
  var_samp: temp_post_var_samp_fields
  variance: temp_post_variance_fields
}

"""aggregate avg on columns"""
type temp_post_avg_fields {
  id: Float
}

"""
Boolean expression to filter rows from the table "temp_post". All fields are combined with a logical 'AND'.
"""
input temp_post_bool_exp {
  _and: [temp_post_bool_exp!]
  _not: temp_post_bool_exp
  _or: [temp_post_bool_exp!]
  content: String_comparison_exp
  id: Int_comparison_exp
}

"""
unique or primary key constraints on table "temp_post"
"""
enum temp_post_constraint {
  """unique or primary key constraint"""
  temp_post_pkey
}

"""
input type for incrementing numeric columns in table "temp_post"
"""
input temp_post_inc_input {
  id: Int
}

"""
input type for inserting data into table "temp_post"
"""
input temp_post_insert_input {
  content: String
  id: Int
}

"""aggregate max on columns"""
type temp_post_max_fields {
  content: String
  id: Int
}

"""aggregate min on columns"""
type temp_post_min_fields {
  content: String
  id: Int
}

"""
response of any mutation on the table "temp_post"
"""
type temp_post_mutation_response {
  """number of rows affected by the mutation"""
  affected_rows: Int!

  """data from the rows affected by the mutation"""
  returning: [temp_post!]!
}

"""
on_conflict condition type for table "temp_post"
"""
input temp_post_on_conflict {
  constraint: temp_post_constraint!
  update_columns: [temp_post_update_column!]! = []
  where: temp_post_bool_exp
}

"""Ordering options when selecting data from "temp_post"."""
input temp_post_order_by {
  content: order_by
  id: order_by
}

"""primary key columns input for table: temp_post"""
input temp_post_pk_columns_input {
  id: Int!
}

"""
select columns of table "temp_post"
"""
enum temp_post_select_column {
  """column name"""
  content

  """column name"""
  id
}

"""
input type for updating data in table "temp_post"
"""
input temp_post_set_input {
  content: String
  id: Int
}

"""aggregate stddev on columns"""
type temp_post_stddev_fields {
  id: Float
}

"""aggregate stddev_pop on columns"""
type temp_post_stddev_pop_fields {
  id: Float
}

"""aggregate stddev_samp on columns"""
type temp_post_stddev_samp_fields {
  id: Float
}

"""aggregate sum on columns"""
type temp_post_sum_fields {
  id: Int
}

"""
update columns of table "temp_post"
"""
enum temp_post_update_column {
  """column name"""
  content

  """column name"""
  id
}

"""aggregate var_pop on columns"""
type temp_post_var_pop_fields {
  id: Float
}

"""aggregate var_samp on columns"""
type temp_post_var_samp_fields {
  id: Float
}

"""aggregate variance on columns"""
type temp_post_variance_fields {
  id: Float
}

"""
columns and relationships of "user"
"""
type user {
  active: Boolean!
  auth_provider_id: String!
  email: String!
  id: uuid!
  name: String
  role: String
}

"""
aggregated selection of "user"
"""
type user_aggregate {
  aggregate: user_aggregate_fields
  nodes: [user!]!
}

"""
aggregate fields of "user"
"""
type user_aggregate_fields {
  count(columns: [user_select_column!], distinct: Boolean): Int!
  max: user_max_fields
  min: user_min_fields
}

"""
Boolean expression to filter rows from the table "user". All fields are combined with a logical 'AND'.
"""
input user_bool_exp {
  _and: [user_bool_exp!]
  _not: user_bool_exp
  _or: [user_bool_exp!]
  active: Boolean_comparison_exp
  auth_provider_id: String_comparison_exp
  email: String_comparison_exp
  id: uuid_comparison_exp
  name: String_comparison_exp
  role: String_comparison_exp
}

"""
unique or primary key constraints on table "user"
"""
enum user_constraint {
  """unique or primary key constraint"""
  user_auth_provider_id_key

  """unique or primary key constraint"""
  user_email_key

  """unique or primary key constraint"""
  user_pkey
}

"""
input type for inserting data into table "user"
"""
input user_insert_input {
  active: Boolean
  auth_provider_id: String
  email: String
  id: uuid
  name: String
  role: String
}

"""aggregate max on columns"""
type user_max_fields {
  auth_provider_id: String
  email: String
  id: uuid
  name: String
  role: String
}

"""aggregate min on columns"""
type user_min_fields {
  auth_provider_id: String
  email: String
  id: uuid
  name: String
  role: String
}

"""
response of any mutation on the table "user"
"""
type user_mutation_response {
  """number of rows affected by the mutation"""
  affected_rows: Int!

  """data from the rows affected by the mutation"""
  returning: [user!]!
}

"""
on_conflict condition type for table "user"
"""
input user_on_conflict {
  constraint: user_constraint!
  update_columns: [user_update_column!]! = []
  where: user_bool_exp
}

"""Ordering options when selecting data from "user"."""
input user_order_by {
  active: order_by
  auth_provider_id: order_by
  email: order_by
  id: order_by
  name: order_by
  role: order_by
}

"""primary key columns input for table: user"""
input user_pk_columns_input {
  id: uuid!
}

"""
select columns of table "user"
"""
enum user_select_column {
  """column name"""
  active

  """column name"""
  auth_provider_id

  """column name"""
  email

  """column name"""
  id

  """column name"""
  name

  """column name"""
  role
}

"""
input type for updating data in table "user"
"""
input user_set_input {
  active: Boolean
  auth_provider_id: String
  email: String
  id: uuid
  name: String
  role: String
}

"""
update columns of table "user"
"""
enum user_update_column {
  """column name"""
  active

  """column name"""
  auth_provider_id

  """column name"""
  email

  """column name"""
  id

  """column name"""
  name

  """column name"""
  role
}

scalar uuid

"""
Boolean expression to compare columns of type "uuid". All fields are combined with logical 'AND'.
"""
input uuid_comparison_exp {
  _eq: uuid
  _gt: uuid
  _gte: uuid
  _in: [uuid!]
  _is_null: Boolean
  _lt: uuid
  _lte: uuid
  _neq: uuid
  _nin: [uuid!]
}