netflix / dgs-examples-java Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Sorry if I'm wrong.
I noticed the method below it's seems like can not properly treat the block string (ex: description : """abc""" with triple ")
String com.netflix.graphql.dgs.client.codegen.GraphQLQueryRequest.serialize()
The value of string like ""abc"" will be treated as "\"\"abc\"\"" after serialize().
Any solution I can treat the block string properly with the DGS framework?
I am having a class Foo & Boo
public class Foo{
String a;
}
public class Boo extends Foo{
String b;
}
Boo will be my output object in .graphqls
I am able to get the response of Boo in this. But if I wanted to get the a also as the output of above query then how can we define the type and graphqls.
Is there any support present in dgs framework.
If you change this line to
.reviews().submittedDate()
The ObjectMapper cannot deserialize the date.
Error deserializing data from '{"data":{"shows":[{"title":"mock title","reviews":[{"submittedDate":"2021-04-15T11:37:22.424887-04:00","username":"DGS User","starScore":5},{"submittedDate":"2021-04-15T11:37:22.424953-04:00","username":"DGS User 2","starScore":3}]}]}}' with JsonPath 'data.shows[*]' and target class java.util.List<com.example.demo.generated.types.Show>
DgsQueryExecutionDataExtractionException(ex=com.jayway.jsonpath.spi.mapper.MappingException: java.lang.IllegalArgumentException: Cannot construct instance of `java.time.OffsetDateTime` (no Creators, like default constructor, exist): no String-argument constructor/factory method to deserialize from String value ('2021-04-15T11:37:22.424887-04:00')
To avoid the N+1 problem, I defined a DataLoader, for example ReviewsDataLoader. After I do a mutation, I call the query method again. The "load" method in the ReviewsDataLoader is called multiple times. ReviewsDataLoader not work. I don't know how to solve this problem.
2022-02-25 16:26:45.961 WARN 9220 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dgsQueryExecutor' defined in class path resource [com/netflix/graphql/dgs/autoconfig/DgsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'dgsQueryExecutor' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schema' defined in class path resource [com/netflix/graphql/dgs/autoconfig/DgsAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [graphql.schema.GraphQLSchema]: Factory method 'schema' threw exception; nested exception is SchemaProblem{errors=[InvalidSyntaxError{ message=Invalid Syntax : offending token '' at line 1 column 1 ,offendingToken= ,locations=[SourceLocation{line=1, column=1}] ,sourcePreview=}]}
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-02-25 16:26:46.345 ERROR 9220 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
There are problems with the GraphQL Schema:
* InvalidSyntaxError{ message=Invalid Syntax : offending token '' at line 1 column 1 ,offendingToken= ,locations=[SourceLocation{line=1, column=1}] ,sourcePreview=}
what is the best way to dump the I got as a response from the execution?
dgsQueryExecutor.execute but no matter what it returns a linked hash map, which therefore
lose the order when I try to convert it back to JSON with?
I have the impression there must be an obvious vai to dump the response... and I am looking for it :)
Is it possible to add a test case for uploading an artwork according to mutation "addArtwork(showId: Int!, upload: Upload!): [Image]!"?
Provide a basic integration with Spring Security that can be used to document how you can get the Authentication reference in a data fetcher .
I added mysql to this repo here, and now DgsSchemaProvider is not finding my datafetcher DgsComponents.
Request failed when some value has the line break like \n in it.
It's a bug, or my code missing necessary escape porcess?
I tried escape the \n to \\n in json value. But ther sever side treated the \\n to \n as string instead of line breaker. It's server side's fault?
client.reactiveExecuteQuery(queryRequest.serialize())
client is a instance of [WebClientGraphQLClient]
com.netflix.graphql.dgs.client.GraphQLClientException: 400 BAD_REQUEST "GraphQL server org.springframework.web.reactive.function.client.DefaultWebClient@59d42d75 responded with status code 400: '{"errors":[{"message":"Syntax Error: Unterminated string.","locations":[{"line":1,"column":107}],"extensions":{"code":"GRAPHQL_PARSE_FAILED"}}]} '. The request sent to the server was {"query":"mutation {createProduct(input: {categoryId:\"puaRCidQs8nVVNcXWbpgoZ\", condition:BRAND_NEW, description:\"サイズ\nS ( 身幅:60cm 着丈:119cm 肩幅:45cm 袖丈:66cm) M ( 身幅:62cm 着丈:120cm 肩幅:46cm 袖丈:67cm) L ( 身幅:64cm 着丈:121cm 肩幅:47cm 袖丈:68cm) XL ( 身幅:66cm 着丈:122cm 肩幅:48cm 袖丈:69cm) XXL ( 身幅:68cm 着丈:123cm 肩幅:49cm 袖丈:70cm)\n素材\n表地:ポリエステル100% 裏地:ポリエステル100% 中わた:ポリエステル100% その他:ポリエステル87%、ポリウレタン13%\n生産国\nベトナム\n\", imageUrls:[\"https://stc.milleporte.com/EVENTS/221105UNDE/web/960/4580637165083_1.jpg\", \"https://stc.milleporte.com/EVENTS/221105UNDE/web/960/4580637165083_2.jpg\"], name:\"UA LONG COAT WORD LOGO ブラック\", price:10460, shippingDuration:FOUR_TO_SEVEN_DAYS, shippingFromStateId:\"jp11\", shippingMethod:UNDECIDED, shippingPayer:SELLER, status:OPENED, variants:[{janCode:\"\", name:\"XL\", skuCode:\"16830662\", stockQuantity:1 }] }){ product { id variants { skuCode id } } } }","variables":{},"operationName":null}"
WebClientGraphQLClient.class
@Suppress("BlockingMethodInNonBlockingContext") val serializedRequest = GraphQLClients.objectMapper.writeValueAsString( Request( query, variables, operationName ) )
I noticed some strange behavior I think in the the code above.
if the LF (\n) in json value, the result of serializedRequest is \n.
if the escaped LF (\n) in json value, the result of serializedRequest is \\n.
I expect result of serializedRequest is \n. (Since the server side can't parse the json which \n in it well, \n is OK.)
How can I do this? Can I customize the ObjectMapper above?
We should have an example of using a custom directives for both Input and Output types.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.