@skip, @include 지시어

Tags
지시어
skip
설명

참고자료

 

지시어 2가지

@include(if: Boolean): 인자가 true 인 경우에만 이 필드를 결과에 포함합니다. @skip(if: Boolean) 인자가 true 이면 이 필드를 건너뜁니다.

@skip 지시어 예시

# getTodayInsufficientBeadInfo.graphql query GetTodayInsufficientBeadInfo($userId: Int!, $deviceSerial: String!) { todayInsufficientBead(userId: $userId, deviceSerial: $deviceSerial) { cartridgeLineUp { serialNumber nutrientGroup { name @skip(if: $userId === 0) # $userId가 0일 때에는 쿼리를 보내지 않는다. } } bead } }