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 ②
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 ೞӝ
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