Comments (4)
Hi @sumeet30, can you clarify with a code example and error message? Are you talking about the codegen, generated code, operation execution? What's the transport/endpoint being used... all of those impact, we may need to check if encoding matches content-type, etc
from sgqlc.
Hi @barbieri This issue i am facing is with operation execution. I have generate code using Graphql schema file. Now when i am trying to perform operation execution, then the Chinese characters passed as input getting converted to codes.
Example: The input class object to operation like "Create(name=测试混乱, description=This is test, tags=['test'])" getting converted to below and passed to server.
mutation {
Template {
create(input: {name: "\u6d4b\u8bd5\u6df7\u4e71", description: "This is test",tags: ["test"]}) {
name
description
}
}
}
from sgqlc.
@barbieri Could you please help?
from sgqlc.
@sumeet30 I'd recommend you to go with variables, it's not that good to pass the explicit values in your query, as the servers can't cache and so on. So please try with something like below, take a look at https://sgqlc.readthedocs.io/en/latest/sgqlc.types.html#sgqlc.types.Variable https://sgqlc.readthedocs.io/en/latest/sgqlc.endpoint.http.html#synchronous-http-endpoint and https://spec.graphql.org/October2021/#sec-Validation.Variables
from sgqlc.types import Variable
my_query = op.create(input=Variable('a'))
endpoint(my_query, variables={'a': {'name': '测试混乱', 'description': 'This is test', 'tags': ['test']}})
This will send your document with input: $a
and the actual value is sent in the JSON body, field variables
, as in the HTTP GraphQL convention see https://graphql.org/learn/serving-over-http/#post-request
The __json_dump_args__
you must set on your scalars, so you'd need to change the String scalar, which is not that good.
However, what's the error the server is sending? The GraphQL document allows for unicode escaping, see https://spec.graphql.org/October2021/#StringCharacter
from sgqlc.
Related Issues (20)
- HTTP endpoint class should allow compression of the data using gzip HOT 1
- Code Completion In Pycharm HOT 7
- Nested jsonb in insert mutation HOT 6
- Fragment Operation with inline and nested fragments "Unknown fragments..." error HOT 4
- Enums should be nullable on input HOT 1
- Issues with operation generator HOT 3
- Best practice to construct nested query variables
- 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte HOT 1
- Nested Nodes aren't being appended to the Query HOT 4
- Add support for `UUID` Type HOT 3
- Connections in requests session are closed after each request HOT 2
- Way to add new properties to object types and print with __to_json_value__() HOT 3
- python -m sgqlc.introspection is failing with apollo/server": "^4.3.2 HOT 1
- Operation output graphql-core compatible Document AST HOT 8
- Operation codegen does not find variables with DataHub graphql code HOT 3
- Add support for the GraphQL-WS Subprotocol
- Supporting a few schemas HOT 1
- Failed tests in sgqlc/types/__init__.py and sgqlc/operation/__init__.py
- Allow updating Operation name and args after its initialization HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sgqlc.