Upgrade to Pro — share decks privately, control downloads, hide ads and more …

우린 같은 같은 곳을 바라 보고 있나요?

Arawn Park
November 30, 2022

우린 같은 같은 곳을 바라 보고 있나요?

Let'Swift 2022에서 발표한 "우린 같은 같은 곳을 바라 보고 있나요?" 의 장표입니다.

시간이 흐르면서 망가지는 계약(API)에 대한 고민과 해법에 대한 견해를 공유합니다.


Arawn Park

November 30, 2022

Other Decks in Programming


  1. ߅ਊӂ ਋ܽ э਷ Ҕਸ ߄ۄ ࠁҊ ੓աਃ? न܉ೡ ࣻ ੓ח

    APIী ؀ೠ Ҋ޹җ ೧ߨਸ ଺ইࢲ-
  2. https://flic.kr/p/2jmXLKR ૑Ә਷ഈস੄द؀

  3. ௿ۄ੉঱౟৬ ࢲߡח যڌѱഈসೡөਃ https://flic.kr/p/6e1FDq

  4. https://flic.kr/p/irZCsH ప௼झಖ੘ࢿ੉ഈস੄द੘੉঻ҵਃ

  5. ప௼झಖ਷ যڌѱ ੘ࢿ೧ਃ https://eng.lyft.com/awesome-tech-specs-86eea8e45bb9

  6. https://flic.kr/p/R3ScWi ૑Әࠗఢ "1*ী ૘઺೧ࠁભ

  7. ਫ਼Ӭ"1*оޤભ https://www.manning.com/books/the-design-of-web-apis

  8. Consumer Provider HTTP Client HTTP Server ਃ୒ 3FRVFTU ਽׹ 3FTQPOTF

    3&45"1*BLB3&45GVMPS8FC"1*PS)551"1* ੗ਗ(RESOURCE) - URI ೯ਤ(Verb) - HTTP Method ಴അ(Representations) )551೐۽ష௒ӝ߈ ਢӝࣿ੉о૓न܉ࢿ ഛ੢ࢿਸӒ؀۽੉য߉ই࠙࢑ஹೊ౴ী੸೤ೠ"1*ٜ݅ࣻ੓חߑߨਵ۽੗ਗ 3&4063$& 63* ೯ਤ 7FSC )551.&5)0% ಴അ 3FQSFTFOUBUJPOT ਵ۽ҳࢿغয੓׮ ࢲ࠺झઁҕ੗੢গա֎౟ਕ௼૑ো١ਸҊ۰೧ঠೠ׮
  9. Consumer Provider RPC Stub RPC Server ਃ୒ 3FRVFTU ਽׹ 3FTQPOTF

    Shared Library ਗѺ೐۽द੷ഐ୹3FNPUF1SPDFEVSF$BMM31$ ۽ஸ೐۽द੷աݫࣗ٘ܳഐ୹ೞ٠ਗѺदझమীࢲ࠺झܳࢎਊೡࣻ੓חߑߨਵ۽֎౟ਕ௼ܳ੉ਊೠ׮חੋ૑بহ੉ਗѺदझమীࢲ࠺झܳऔѱా೤ೞҊ ࢎਊೡࣻ੓׮ ೞ૑݅فदझమръѾ೤੉ੌযդ׮য়ېػӝࣿэ૑݅ҳӖীࢲҕѐೠH31$੄҃਋ъ۱ೠࢿמҗ׮নೠ೒ۖಬਸ૑ਗೞחبҳ۽୭Ӕ௾ҙबਸ੉ՑҊ੓׮
  10. "1*٣੗ੋࠗఠୃӡѱਃ https://careerfoundry.com/en/blog/ui-design/8-sites-with-great-ui/

  11. https://flic.kr/p/4QGtMD ҅ডী੄ೠࢸ҅%FTJHOCZ$POUSBDU ܳ Ҋ۰ೞݶજইਃ

  12. https://flic.kr/p/2mv5Gg5 "1*ݺࣁܳ੘ࢿೞח بҳٜਸঌইࠊਃ

  13. https://beestat.io/ NOTION

  14. https://www.postman.com/ POSTMAN

  15. *%-*OUFSGBDF%FTDSJQUJPO-BOHVBHF ਸ ࢎਊ೧ࠁݶযڄөਃ https://bannortoys.com/products/wooden-shape-sorter

  16. https://www.openapis.org/ OpenAPI Specification

  17. https://buf.build/ Protocol Buffers

  18. Ӓ۽ࠗఠѐਘറ https://flic.kr/p/9dQRes

  19. ৈӟয٣  աח־ҳ https://shorturl.at/dnsWY

  20. Ҋ޹੄द੘ https://www.flickr.com/photos/absent/2157057475/

  21. ࣁо૑ই੉٣য https://flic.kr/p/6go4zT

  22. Tech spec IDL repo swift code kotlin code etc go/python/..

    Generator "1*ݺࣁ۽௏٘ࢤࢿೞӝ
  23. ❯ create-api generate schema.json --config-option module=PetstoreKit --output PetstoreKit Generating code

    for schema.json... import Foundation import Get import PetstoreKit public class PetstoreWebClient { let api: APIClient public init() { self.api = APIClient( baseURL: URL(string: "https://letswift.kr/2022/petstore") ) } public func findPets(by status: Paths.Pet.FindByStatus.Status) async throws -> [Pet] { let request = Paths.pet.findByStatus.get(status: status) let response = try await api.send(request) return response.value } } IDL repo swift package CreateAPI $SFBUF"1*۽4XJGU௏٘ࢤࢿೞӝ ① Using the Code ②
  24. import Foundation import PetstoreKit import SwiftGRPC public class PetstoreGrpcClient {

    let client: PetstoreServiceClient public init() { self.client = PetstoreServiceClient.init( address: "letswift.kr:80", secure: false ) } public func findPets(by status: FindPetsByStatusRequestStatus) async throws -> [Pet] { let request = FindPetsByStatusRequest.init(status: status) let response = try await client.findPetsByStatus(request) return response.pets } } IDL repo petstore.grpc.swift, petsotre.pb.swift gRPC Swift H31$۽4XJGU௏٘ࢤࢿೞӝ Using the Code ② ❯ protoc schema.proto \ --swift_out=Visibility=Public:./PetstoreKit/Sources --grpc-swift_out=Visibility=Public,Client=true,Server=false:./PetstoreKit/Sources ①
  25. envoy mobile edge Servers Client ݽ߄ੌਸਤೠ FOWPZNPCJMF Tech spec IDL

    repo generated code Generator Using the Code
  26. Client GraphQL API { "user": { "id": 2022, "name": "Arawn

    Park", "address": { "city": "Firenze", "street": "Piazza del Duomo" } } } query { user (id: 2022) { id name address { city street } } } HTTP Request HTTP Response ௪ܻझః݃ഛੋ੉оמೠ(SBQI2-
  27. Consumer Provider Unit tests Unit tests Required interactions are captured

    into a contract between systems Contract is shared amongst teams to enable collaboration, using tools like Pactflow Requests in contract replayed against provider API and verified against consumer s expectations Consumer unit tests its behaviour against provider mock Provider tests mock out any other systems, so it can be tested in isolation ① ② ③ ④ ⑤ ҅ডపझ౟$POUSBDU5FTU ೞӝ
  28. 1BDUGMPX۽ೞח҅ডపझ౟ Consumer Provider Ý GET /users/2022 { "user": { "id":

    2022, "name": "Arawn Park" } } GET /users/2022 { "user": { "id": 2022, "name": "Arawn Park" } } Testing a consumer using a Pact mock provider ① mock provider simulated consumer Testing a provider using a Pact simulated consumer ② Contract
  29. ਋ܽэ਷Ҕਸ ߄ۄࠁҊ੓աਃ https://imaggeo.egu.eu/view/1251/

  30. ੿ࣁ৔ ੉زѤ ъ؀ӏ ӒܻҊ׼Ӕ݃௄J04ୀఠ https://flic.kr/p/29cXbAf

  31. None
  32. ଵҊ੗ܐ - The Design of Web APIs - Create API

    - gRPC Swift - Next Generation Client APIs in Envoy Mobile - Move Fast and Consumer Driven Contract Test Things - How Pact contract testing works