Releases: mczachurski/Swiftgger
Releases · mczachurski/Swiftgger
Support for dictionaries in response/request body
Now we can use dictionaries in request/response body. For example:
let openAPIBuilder = OpenAPIBuilder(
title: "Swiftgger OpenAPI document",
version: "1.0.0",
description: "OpenAPI documentation for test structure purposes",
authorizations: [
.basic(description: "Basic authorization"),
.apiKey(description: "Api key authorization"),
.jwt(description: "JWT authorization"),
.oauth2(description: "OAuth authorization", flows: [
.implicit(APIAuthorizationFlow(authorizationUrl: "https://oauth2.com", tokenUrl: "https://oauth2.com/token", scopes: [:]))
]),
.openId(description: "OpenIdConnect authorization", openIdConnectUrl: "https//opeind.com")
]
)
.add([
APIObject(object: Fuel(level: 90, type: "GAS", productionDate: Date(), parameters: ["power", "speed"])),
])
.add(APIController(name: "VehiclesController", description: "Contoller for vehicles", actions: [
APIAction(method: .get,
route: "/vehicles/tags",
summary: "Get vehicle associated tags",
description: "GET action for downloading vehicle associated tags.",
responses: [
APIResponse(code: "200", description: "Vehicle tags", type: .dictionary(String.self)),
APIResponse(code: "401", description: "Unauthorized")
]
),
APIAction(method: .get,
route: "/vehicles/fuels",
summary: "Get vehicle associated fuels",
description: "GET action for downloading vehicle associated fuels.",
responses: [
APIResponse(code: "200", description: "Vehicle fuels", type: .dictionary(Fuel.self)),
APIResponse(code: "401", description: "Unauthorized")
]
)
]))
let openAPIDocument = openAPIBuilder.built()
Above code will produce response which in Swagger is displayed like on below image.
Support for key encoding strategy
In the release we have mainly to changes:
- Support of simple value types in request/response body
- Support for coding keys support and key encoding strategy
Both changes introduces breaking changes.
Fixes in OpenAPI data structures and UUID support
Version contains fixes in OpenAPI data structures and UUID support. Also first implementation of Swift
file generator has been added. Now we can basically generate Swift
files with model classes.
Suport for Property Wrappers
1.4.2 #16 Fix list of required properties with .
Support of custom API Key name and location
1.4.1 Add support for custom API Keys names/locations
Nested objects and examples improvements
1.4.0 Fix link to OpenAPI specification
Support for custom object names
New version add posibilities to rename object names. We can hide internal class names and show more user friendly names:
APIObject(object: SpaceshipDTO(name: "Star Trek", speed: 923211), customName: "Spaceship")
Support for OpenAPI DataTypes
Merge pull request #3 from eneko/master Add support for OpenAPI DataTypes