Skip to content

0.5.0

Compare
Choose a tag to compare
@yonaskolb yonaskolb released this 15 May 17:34
· 580 commits to master since this release

Added

  • APIClient.makeRequest now returns an Alamofire Request if one was created, so requests can now be cancelled
  • All operation responses are now generated, not just the successful one, meaning you get access to typed errors

Template Changes

Model
  • Properties in a model subclass initialiser will now be ordered so that all required properties come first, instead of parent and then child's properties
  • Now provides a CustomDebugStringConvertible conformance that pretty prints all nested values
APIRequest
  • Each APIRequest now has a typed Response enum that includes all it's responses in the spec. Each case has the decoded schema as an associated enum if specified
APIClient

The APIClient.makeRequest complete closure parameter has changed from DataResponse to APIResponse which:

  • replaces result value with the new response enum
  • has result error of APIError enum via antitypical/Result which has cases for:
    • unexpectedStatusCode(statusCode: Int, data: Data)
    • jsonDeserializationError(JSONUtilsError)
    • decodingError(DecodingError)
    • invalidBaseURL(String)
    • authorizationError(AuthorizationError)
    • networkError(Error)
    • unknownError(Error)
Descriptions

Models, Requests, Errors and Responses now have CustomStringConvertible and/or CustomDebugStringConvertible conformances

Fixed

  • Path parameters are no longer also encoded as url parameters in the request template