You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
InvalidSyntaxError while runnig spring boot app based on graphql-dgs-spring-boot-starter
Below are some details/expectations.
Expected behavior:
Application is up and running with successfully generated classes from defined schema
Actual behavior:
Application is failing on startup with not meaningful error message
Steps to reproduce:
I'm a using graphql-dgs-platform-dependencies:6.0.1 with spring-boot 3.+ (3.05), java 17 and code generation plugin ('com.netflix.dgs.codegen' version "5.7.0") for home examples.
Code generation is passed successfully application is failed at startup with the following unclear error:
There are problems with the GraphQL Schema:
* InvalidSyntaxError{ message=Invalid Syntax : offending token '"name"' at line 2 column 3 ,offendingToken="name" ,locations=[SourceLocation{line=2, column=3}] ,sourcePreview={
"name": "Untitled GraphQL Schema",
"schemaPath": "schema.graphql",
"extensions": {
"endpoints": {
}
Absolutely same schema is working fine with spring-boot-starter-graphql based spring boot app v3.0.5 and java 17 (there is only difference in graphql-java version - 19.5 vs 19.3 in spring-boot-starter-graphql) with hand written classes corresponding to schema types.
To my mind if schema is incorrect code generation should fail, isn't it?
Here is schema:
type Query {
category(id: String): Category
categoryByName(name: String): Category
categories: [Category]
recipe(id: String): Recipe
recipes: [Recipe]
}
type Mutation {
addRecipe(description: String): Recipe
addRecipeWithPayload(recipeDto: RecipeDto): Recipe
addCategory(name: String): Category
}
type Category {
id: ID
name: String
recipes: [Recipe]
}
type Recipe {
id: ID
description: String
prepTime: Int
cookTime: Int
servings: Int
source: String
url: String
notes: String
difficulty: Difficulty
category: Category
}
input RecipeDto {
description: String
prepTime: Int
cookTime: Int
servings: Int
source: String
url: String
notes: String
difficulty: Difficulty
categoryId: String
}
enum Difficulty {
EASY, MODERATE, KIND_OF_HARD, HARD
}
Full source code can be found here
Working solution without netflix platform/starters - here.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I faced with the following issue:
Below are some details/expectations.
Expected behavior:
Application is up and running with successfully generated classes from defined schema
Actual behavior:
Application is failing on startup with not meaningful error message
Steps to reproduce:
graphql-dgs-platform-dependencies:6.0.1with spring-boot 3.+ (3.05), java 17 and code generation plugin ('com.netflix.dgs.codegen' version "5.7.0") for home examples.Absolutely same schema is working fine with
spring-boot-starter-graphqlbased spring boot app v3.0.5 and java 17 (there is only difference ingraphql-javaversion - 19.5 vs 19.3 in spring-boot-starter-graphql) with hand written classes corresponding to schema types.To my mind if schema is incorrect code generation should fail, isn't it?
Here is schema:
Full source code can be found here
Working solution without netflix platform/starters - here.
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions