feat : @GraphQLName 어노테이션 예제 코드 추가
This commit is contained in:
@@ -2,9 +2,11 @@ package com.banjjoknim.graphqlkotlin.person
|
|||||||
|
|
||||||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription
|
import com.expediagroup.graphql.generator.annotations.GraphQLDescription
|
||||||
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
|
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
|
||||||
|
import com.expediagroup.graphql.generator.annotations.GraphQLName
|
||||||
import com.expediagroup.graphql.server.operations.Query
|
import com.expediagroup.graphql.server.operations.Query
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
class PersonQuery(
|
class PersonQuery(
|
||||||
@@ -37,4 +39,8 @@ class PersonQuery(
|
|||||||
fun findPerson(@GraphQLIgnore @Autowired personRepository: PersonRepository, name: String): Person? {
|
fun findPerson(@GraphQLIgnore @Autowired personRepository: PersonRepository, name: String): Person? {
|
||||||
return personRepository.findPerson(name)
|
return personRepository.findPerson(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GraphQLDescription("@GraphQLName example")
|
||||||
|
@GraphQLName("somePerson")
|
||||||
|
fun randomPerson(name: String): Person = Person(name = name, age = Random.nextLong())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user