Skip to content

[Bug]: Graphql giving parsing error for not even given field #3200

@gamemasterprogrammer

Description

@gamemasterprogrammer

What happened?

Hello there!

While trying to modify my "CRUD"-Operations to make the creation of a new item more versatile, i encountered a (for myself currently) unexplainable bug. I wanted to change the query from this (modified the names a bit because of privacy concerns):

export const addQuery = (
entityName: string,
fieldAddString: string,
fieldString: string
) => mutation ${entityEditName} { ${entityEditName} (item: { ${fieldAddString} }) { ${fieldString} } }

fieldAddString here is the input string, kinda formed like this: 'name: "newName"\nsomeOtherColumnName: "example"', while fieldString is just a string formed like this: 'name\nsomeOtherColumnName' to return the values. It was my first iteration to create an object in the table. Now that I'm a bit more knowledgable about the subject i wanted to improve it, so actual strings with \n inbetween could be input.

which lead to this:

export const addQuery = (entityEditName: string, fieldString: string) => mutation create${entityEditName} ($item: Create${entityEditName}Input!) { create${entityEditName} (item: $item) { ${fieldString} } }

where i can then add the data as (a) query variable(s). But when i tried this, the same data just gave me an error. Upon further inspection in ChiliCream i got this error:
{
"errors": [
{
"message": "Int cannot parse the given literal of type StringValueNode.",
"path": [
"item",
"CENSORED"
],
"extensions": {
"fieldCoordinate": "CreateCENSOREDInput.CENSORED",
"fieldType": "Int"
}
}
]
}

The thing is, i never input the variable that it says it can't parse. After inputting it with an int value, it just gave me another variable that threw this error. The table itself is pretty big, but a lot of it can be left out (also seeing as the previous query worked). Am i overlooking something or is this a genuine bug?

Thanks in advance!

Version

Microsoft.DataApiBuilder 1.6.87+5725d34c92b5cce1ad8f2e36e0ca16c552ac12ef

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

GraphQL

Relevant log output

{
  "errors": [
    {
      "message": "Int cannot parse the given literal of type `StringValueNode`.",
      "path": [
        "item",
        "CENSORED"
      ],
      "extensions": {
        "fieldCoordinate": "CreateCENSOREDInput.CENSORED",
        "fieldType": "Int"
      }
    }
  ]
}

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageissues to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions