GraphQL Korea Meetup (06/13/2020)

1. Relay with Python

๋ฐœํ‘œ์ž: ์žฌํ˜„๋‹˜~~~~!!! ใ…Ž_ใ…Ž

"์˜ˆ์ธก๊ฐ€๋Šฅํ•œ ์ผ๊ด€์„ฑ์ด ์ฃผ๋Š” ๋œป๋ฐ–์˜ ํšจ์œจ์„ฑ"

Graphene

  • ORM ๋ฐฉ์‹์œผ๋กœ ์ •์˜ํ•˜๋ฉด GraphQL Schema๋กœ ๋ฐ”๊พธ์–ด ์คŒ

  • GraphQL ์„ ๊ฐ์ฒดํ™”ํ•ด์„œ ์ž˜ ๋งŒ๋“ค์–ด์ค€๋‹ค!

Relay

Graphene ์€ Relay ๋ฅผ ์ง€์›ํ•œ๋‹ค

Relay

: GraphQL ๊ธฐ๋ฐ˜ ๋ฐ์ดํ„ฐ ์ค‘์‹ฌ React application์„ ๊ตฌ์ถ•ํ•˜๊ธฐ ์œ„ํ•œ JavaScript framework

  • Node

    • graphene.relay ์—์„œ ์ œ๊ณตํ•˜๋Š” interface

    • ID! field ํ•˜๋‚˜๋งŒ์„ ๊ฐ–๋Š”๋‹ค

  • Connection

    • slicing๊ณผ pagination์„ ์ œ๊ณตํ•˜๋Š” ํ–ฅ์ƒ๋œ ๋ฒ„์ „์˜ ๋ฆฌ์ŠคํŠธ

      • Graph์— ๋ถ„์‚ฐ๋˜์–ด ์žˆ๋Š” ๊ฐ ์ ์„ Node๋ผ๊ณ  ํ•˜๋ฉฐ, ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ํ•˜๋‚˜์˜ ๊ฐœ์ฒด๋ฅผ ์˜๋ฏธํ•˜๊ณ ,

      • ์„œ๋กœ ์—ฐ๊ด€๋œ Node ๋ฅผ ์—ฐ๊ฒฐํ•˜๋Š” ์„ ์€ Edge ๋ผ๊ณ  ํ•œ๋‹ค

        • GraphQL์—์„œ ๊ฐ Node ์˜ ์ฃผ์†Œ๋ฅผ Cursor๋ผ๊ณ  ํ•˜๊ณ ,

          • Connection์€ Cursor๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœํ•œ pagination design pattern

    • ex)

      • relay.Connection

      • relay.ConnectionField

  • Mutations

    • ๋ฐ์ดํ„ฐ ์ˆ˜์ • ์ž‘์—…์„ ํ•˜๋Š” Mutation์„ Graphene์—์„œ๋Š” subclass relay.ClientIDMutation์„ ํ†ตํ•ด ์‰ฝ๊ฒŒ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค

Graphene-Django

Docs

  • GraphQL์„ Django ์—์„œ ์‰ฝ๊ฒŒ ์ ์šฉ ๊ฐ€๋Šฅํ•˜๋„๋ก ๋„์™€์คŒ

2. GraphQL์„ ์–ธ์–ด๋กœ์จ ๋‹ค๋ฃจ๋Š” ๋ฐฉ๋ฒ•

๋ฐœํ‘œ์ž: ๊น€ํ˜œ์„ฑ๋‹˜

"์˜ค๋Š˜ ๋‚  GraphQL์€ API ๊ตฌํ˜„ ๋ฟ ์•„๋‹ˆ๋ผ ๊ฐ•๋ ฅํ•œ "๋ชจ๋ธ๋ง ์–ธ์–ด"๋กœ์จ ํ™œ์•ฝํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. GraphQL ์–ธ์–ด๋ฅผ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๋‹ค๋ฃจ๋Š” ๋ฐฉ๋ฒ•๊ณผ ์ด๋ฅผ ํ™•์žฅํ•˜๋Š” ๋‹ค์–‘ํ•œ ์‚ฌ๋ก€๋“ค์„ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค."

Document

  • GraphQL AST ์˜ ์ตœ์ƒ์œ„ ๋…ธ๋“œ

  • ํ•˜์œ„์— ๋Œ€ํ•œ ๋‹ค์–‘ํ•œ Definition์„ ํฌํ•จํ•˜๊ณ  ์žˆ์Œ

Definition

  • Executable Definition

    • Query / Mutation / Fragment etc.

  • Other Definition

    • Client ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์นœ์ˆ™ํ•œ ๊ทธ ๋ถ€๋ถ„..ใ…Ž

SDL (Schema Definition Language)

๊ฐ•๋ ฅํ•œ ๋ฒ”์šฉ ๋ชจ๋ธ๋ง ์–ธ์–ด

  • ๋ฐฉํ–ฅ์„ฑ ์ˆœํ™˜ ๊ทธ๋ž˜ํ”„

  • ํƒ€์ž… ์‹œ์Šคํ…œ ๊ธฐ๋ฐ˜ ๊ฒ€์ฆ

  • Interface / Union ์„ ํ†ตํ•œ ๋‹คํ˜•์„ฑ ์ง€์›

  • ํ™•์žฅ ๊ฐ€๋Šฅ์„ฑ

  • ๋งคํฌ๋กœ

Schema vs ExecutableSchema

  • ๋ช‡ ๊ฐ€์ง€ ์ „์ฒ˜๋ฆฌ ์ž‘์—…์„ ๊ฑฐ์ณ ๋Ÿฐํƒ€์ž„ ์„ ์ถ”๊ฐ€ํ•จ

    • Resolvers

    • Directives

      • GraphQL Document ์ฒ˜๋ฆฌ๊ธฐ์— ์ถ”๊ฐ€์ ์ธ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ๋Š” ์ง€์‹œ์ž

        • Standard (@deprecated, @include, @skip)

        • Schema Directive

          • ex) @deprecated

        • Operational Directive

          • ex) @include, @skip

+

๋Š๋‚€์ 

  • GraphQL ์— ๊ด€์‹ฌ์ด ๋” ์ƒ๊ฒผ๋‹ค!!!!!!

  • ๋” ๊นŠ๊ฒŒ ๊ณต๋ถ€ํ•ด๋ด์•ผ๊ฒ ๋‹ค ๋„˜ ์žฌ๋ฐŒ๋‹ค!

Last updated