Expose GraphQL field with different name (#12289)
This commit is contained in:
parent
97b2c4d6ea
commit
aef4affc28
|
@ -14,6 +14,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
|||
- [Spring Boot and Caffeine Cache](https://www.baeldung.com/spring-boot-caffeine-cache)
|
||||
- [Spring Boot and Togglz Aspect](https://www.baeldung.com/spring-togglz)
|
||||
- [Getting Started with GraphQL and Spring Boot](https://www.baeldung.com/spring-graphql)
|
||||
- [Expose GraphQL Field with Different Name](https://www.baeldung.com/expose-graphql-field-with-different-name)
|
||||
- More articles: [[next -->]](/spring-boot-modules/spring-boot-libraries-2)
|
||||
|
||||
### GraphQL sample queries
|
||||
|
|
|
@ -12,4 +12,9 @@ public class PostResolver implements GraphQLResolver<Post> {
|
|||
public Author getAuthor(Post post) {
|
||||
return authorDao.getAuthor(post.getAuthorId()).orElseThrow(RuntimeException::new);
|
||||
}
|
||||
|
||||
public Author getFirst_author(Post post) {
|
||||
return authorDao.getAuthor(post.getAuthorId()).orElseThrow(RuntimeException::new);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ type Post {
|
|||
text: String!
|
||||
category: String
|
||||
author: Author!
|
||||
first_author: Author!
|
||||
}
|
||||
|
||||
type Author {
|
||||
|
|
Loading…
Reference in New Issue