This includes a large rewrite with a lot more test cases so many more specs should be supported
- Integer, Double and Float enums are now generated
- operation now has
hasFileParam
andisFile
#27 Thanks @dangthaison91 spec.operationsByTag
now also includes operations without tags with an empty string name #28 Thanks @dangthaison91- Operations now include common parameters defined in the path #29 Thanks @dangthaison91
- Added a bunch of test specs which are now validated against
- Added a script that generates and then compiles all test specs
- Removed symbols from generated filenames
- Generate Floats as
Float
notDouble
- Fixed some array query parameters not joining their contents with the collectionFormat seperator (uses comma delimeted by default now if none is provided)
- Arrays and dictionaries of enums are now encoded
- Arrays of models are now encoded
- Support for a default response with no schema
- Support for
[String: Any]
responses - Simple type definitions including enums are generated properly
- Fixed generation of operations without tags
- Enums in responses are now generated
- Overall more solid spec support. For example the whole fake petstore example now generates and compiles properly
- Within templates
tags
is now just a list of all tag names. The previous tag dictionary which containsname
andoperations
has been moved tooperationsByTag
- request response enum cases have been renamed
- fixed not building with Swift Package Manager in certain situations
- fixed array bodies being generated as inline classes
- fix compiler error when operations have no default response
- escape built in Swift Foundation types like Error and Data
- escape filenames in different way to class names
- now uses Stencil includes. Paves the way for recursive nested schemas
- changed how operations are decoded. Paves the way for non json responses
- added APIError.name
- made RequestAuthorizer.authorize completed parameter escaping
- add tag to printed request and service descriptions
Added suite of tests for parsing, generating and compiling templates from a list of specs. Will improve stability and help prevent regressions. Still some work to do in this area
- added SuccessType typealias to APIResponseValue. This lets you map from a response to successful value
- Replaced
CustomDebugStringConvertible
withPrettyPrinted
conformance on Models, so you can specify your ownCustomDebugStringConvertible
. Same string is available atmodel.prettyPrinted
- Moved generated request enums and anonymous schema from APIRequest.Request to one level higher in scope
- A request's response now has a responseResult with either
.success(SuccessValue)
or.failure(FailureValue)
. This is only generated if there is a single schema type for successes responses and a single schema type for failure responses
- Added back
successType
in response context for backwards compatibility with old templates - Updated Alamofire to 4.4.0
- Fixed api name not being replaced in
Decoding.swift
anymore
APIClient.makeRequest
now returns an AlamofireRequest
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
- 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
- Each Request 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 - The actual APIRequest subclass now sits at
MyGetOperation.Request
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)
Models, Requests, Errors and Responses now have CustomStringConvertible and/or CustomDebugStringConvertible conformances
- Path parameters are no longer also encoded as url parameters in the request template
Improved the generation of complicated specs:
- escape all Swift keywords:
- escape and rename invalid characters
- escape symbols starting with numbers
- better support for deeply nested arrays and dictionaries
- fixed nested enums
- Added generated API Client in Swift template #16
- monitoring and modification of requests via request behaviours
- asynchronous authorization of requests
- central place for api options
- configurable Alamofire SessionManager
- Models now have support for
additionalProperties
#15 - Swift template is now Swift Package Manager compatible #17
- New
clean
CI arguement for ignoring dot files #18
- Names and properties in Swift template are now escaped with `` instead of appending
Type
,Enum
...etc
- Swift names and types are now escaped with a greater range of swift keywords
- Operations with multiple path variables now properly generate an operationId. #11 Thanks @HSchultjan
- Operation parameters that contain anonymous schemas (those that don't reference a definition schema but define a schema inline) are now genererated properly as nested structs within the APIRequest #13
Operation
,Definition
,Property
andParameter
, now have araw
property that can be accessed from templates. This represents the raw data that was in the original spec. This lets you access any custom properties you have in your spec
Property
andParameter
have lost theirrawType
andrawName
properties in favour of the above, so they are nowraw.type
andraw.name
- Upgraded Stencil to 0.9
- First official release