Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List with quotes #4

Closed
eduardostuart opened this issue Mar 21, 2017 · 7 comments
Closed

List with quotes #4

eduardostuart opened this issue Mar 21, 2017 · 7 comments
Labels

Comments

@eduardostuart
Copy link

eduardostuart commented Mar 21, 2017

Hi,

I'm trying to send a list of items into a mutation. But, I'm receiving a

Cannot parse the unexpected character \".\".\n\

The rendered query doesn't contain quotes (I think that's the problem). Do you have any solutions for that?

Query:

fun updateSomething(mylist: ArrayList<String>): Kraph {
    return Kraph {
        mutation {
            func("updateSomething", args = mapOf("mylist" to mylist)) {
                field("mylist")
            }
        }
    }
}

This will render:

{"query": "mutation { \nupdateSomething(input: { mylist: [item1, item2] }) {\nmylist\n}\n}", "variables": null, "operationName": null}
@VerachadW
Copy link
Owner

VerachadW commented Mar 21, 2017

I am not sure what do you mean by the query doesn't contain quotes since the result look fine for me. Could you explain for that? Also, please attach the full error too.

@eduardostuart
Copy link
Author

eduardostuart commented Mar 21, 2017

I mean, the query should be:

{"query": "mutation { \nupdateSomething(input: { mylist: [\"item1\", \"item2\"] }) {\nmylist\n}\n}", "variables": null, "operationName": null}

mylist items with quotes.

mylist: ["item1", "item2"] instead of mylist: [item1, item2]

@VerachadW
Copy link
Owner

I see. It means that you pass the array of string into the parameter and it did not escape correctly. This is definitely a bug. I will try to fix it during this weekend.

@VerachadW
Copy link
Owner

@eduardostuart It fixed on this branch. I will do cleanup a little bit and try to release as a hotfix in this weekends. Would you mind check it for me?

@eduardostuart
Copy link
Author

@VerachadW
Yes, it works. Thanks a lot.

@VerachadW
Copy link
Owner

VerachadW commented Mar 24, 2017 via email

@IHNEL
Copy link

IHNEL commented Feb 23, 2018

@VerachadW
I'm using version 0.5.0. it doesn't work if the data field contains double quotes character inside and throw syntax error. Please help

mutation {
createProduct(title: “my name is "binh" ") {...}
}

VerachadW pushed a commit that referenced this issue Nov 22, 2018
* Fix escaped string array (#6)

* Update Spek version

* Fix print wrong escaped character, Fix #4

* Rewrite the GraphQLPrintSpek for preetty print test

* Bump hotfix version

* Update build status link

* Migrate kotlin v1.1.1 (#7)

* bump to kotlin v1.1.1

* Add type alias for more readable code

* Change the package name to me.lazmaid.kraph

* Fix build failed dur to hamkrest error

* Update spek version

* Update ENV for release

* Update README

* Refactor arguments (#9)

* WIP

* Split the print logic into sealed class

* Update UTs

* Add exception message

* Refactor

* Add Test Coverage (#11)

* Add Test Coverage

* Update spek version

* Fix test result path

* Add codecov YAML

* Add onlyIf

* Update config

* Fix travis command

* Add coverage badge

* Fix wrong download badge

* Bump version to 0.5.1

* Support boolean type in Argument (#15)

* Add support for boolean type

* Add Tests

* Fix typo in README (#16)

missing "h" in the example call to `println(query.toGrapQueryString())`

* Added basic fragment support (#17)

* improve readme

* Allow using field with a block in place of field object

* Update readme to include new changes

* Cheap implementation of fragment that doesn't use actual GraphQL Fragments

* Add fragment docs to readme

* Fix tests

* Change function to 'defineFragment'

* Update Kotlin and library dependcies (#18)

* Update .gitignore

* Update dependecies

* Add secondary constructor for DataEntry.NonDecimalNUmber

* Add Test for DataEntry classes

* Fix failed UTs

* Added partial request printing functions (#19)

* improve readme

* Allow using field with a block in place of field object

* Update readme to include new changes

* Cheap implementation of fragment that doesn't use actual GraphQL Fragments

* Add fragment docs to readme

* Fix tests

* Add separate methods to print the different parts of the request separately

* Use spaces instead of newlines for request format

* Rewrite printing operations to optionally escape quotes

* update readme a bit

* Change function to 'defineFragment'

* Use an enum to choose print format and write tests to cover all formats

* Add note about variables

* Update version (#20)

* add support for variables (#23)

* add support for variables

* add support for variables

* Added enums support

* add some test for enums support

* add test for GraphQLPrintSpek
VerachadW pushed a commit that referenced this issue Oct 5, 2019
* Fix escaped string array (#6)

* Update Spek version

* Fix print wrong escaped character, Fix #4

* Rewrite the GraphQLPrintSpek for preetty print test

* Bump hotfix version

* Update build status link

* Migrate kotlin v1.1.1 (#7)

* bump to kotlin v1.1.1

* Add type alias for more readable code

* Change the package name to me.lazmaid.kraph

* Fix build failed dur to hamkrest error

* Update spek version

* Update ENV for release

* Update README

* Refactor arguments (#9)

* WIP

* Split the print logic into sealed class

* Update UTs

* Add exception message

* Refactor

* Add Test Coverage (#11)

* Add Test Coverage

* Update spek version

* Fix test result path

* Add codecov YAML

* Add onlyIf

* Update config

* Fix travis command

* Add coverage badge

* Fix wrong download badge

* Bump version to 0.5.1

* Support boolean type in Argument (#15)

* Add support for boolean type

* Add Tests

* Fix typo in README (#16)

missing "h" in the example call to `println(query.toGrapQueryString())`

* Added basic fragment support (#17)

* improve readme

* Allow using field with a block in place of field object

* Update readme to include new changes

* Cheap implementation of fragment that doesn't use actual GraphQL Fragments

* Add fragment docs to readme

* Fix tests

* Change function to 'defineFragment'

* Update Kotlin and library dependcies (#18)

* Update .gitignore

* Update dependecies

* Add secondary constructor for DataEntry.NonDecimalNUmber

* Add Test for DataEntry classes

* Fix failed UTs

* Added partial request printing functions (#19)

* improve readme

* Allow using field with a block in place of field object

* Update readme to include new changes

* Cheap implementation of fragment that doesn't use actual GraphQL Fragments

* Add fragment docs to readme

* Fix tests

* Add separate methods to print the different parts of the request separately

* Use spaces instead of newlines for request format

* Rewrite printing operations to optionally escape quotes

* update readme a bit

* Change function to 'defineFragment'

* Use an enum to choose print format and write tests to cover all formats

* Add note about variables

* Update version (#20)

* add support for variables (#23)

* add support for variables

* add support for variables

* Added alias support for queries and mutations

* Checked errors from CI Build and added an example for usage

* Resolve error with arguments in RequestSpek.kt

* Resolve error in BuilderSpek.kt

* Replace /n on """ in the BuilderSpek.kt

* Change equalTo to requestString

* Change other test mutation with alias

* Added documentation about alias for field and fieldObject

* Resolved conflicts

* Check CI error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants