From 7fc60bbe38728ba905afc87c7b7348b4fb1ec5a2 Mon Sep 17 00:00:00 2001 From: Yonas Kolb Date: Fri, 24 Aug 2018 18:48:37 +1000 Subject: [PATCH] Update to 3.0.0 --- CHANGELOG.md | 1 + Makefile | 2 +- Sources/SwagGen/main.swift | 2 +- Sources/SwagGenKit/CodeFormatter.swift | 4 ++-- Sources/SwagGenKit/Utilities.swift | 4 ++-- Tests/SwagGenKitTests/GeneratorTests.swift | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e2238dc1..d834feafa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Change Log +## Master ## [3.0.0](https://github.com/yonaskolb/SwagGen/compare/2.1.2...3.0.0) diff --git a/Makefile b/Makefile index dfe42dd60..ec09226b4 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ TOOL_NAME = swaggen -VERSION = 2.1.2 +VERSION = 3.0.0 PREFIX = /usr/local INSTALL_PATH = $(PREFIX)/bin/$(TOOL_NAME) diff --git a/Sources/SwagGen/main.swift b/Sources/SwagGen/main.swift index bd573b0cd..fed24c5bb 100644 --- a/Sources/SwagGen/main.swift +++ b/Sources/SwagGen/main.swift @@ -3,7 +3,7 @@ import PathKit import SwagGenKit import SwiftCLI -let version = "2.1.2" +let version = "3.0.0" let generateCommand = GenerateCommand() let cli = CLI(name: "swaggen", version: version, description: "Swagger code generator", commands: [generateCommand]) cli.goAndExit() diff --git a/Sources/SwagGenKit/CodeFormatter.swift b/Sources/SwagGenKit/CodeFormatter.swift index bc967bd94..a4678f9e0 100644 --- a/Sources/SwagGenKit/CodeFormatter.swift +++ b/Sources/SwagGenKit/CodeFormatter.swift @@ -180,7 +180,7 @@ public class CodeFormatter { return context } - + func getOperationContext(_ operation: Swagger.Operation) -> Context { var context: Context = [:] @@ -218,7 +218,7 @@ public class CodeFormatter { context["formParams"] = operation.getParameters(type: .formData).map(getParameterContext) context["headerParams"] = operation.getParameters(type: .header).map(getParameterContext) context["hasFileParam"] = params.contains { $0.metadata.type == .file } - + let securityRequirements = operation.securityRequirements ?? spec.securityRequirements context["securityRequirement"] = securityRequirements?.first.flatMap(getSecurityRequirementContext) context["securityRequirements"] = securityRequirements?.map(getSecurityRequirementContext) diff --git a/Sources/SwagGenKit/Utilities.swift b/Sources/SwagGenKit/Utilities.swift index 12412d8bb..fded1d1cb 100644 --- a/Sources/SwagGenKit/Utilities.swift +++ b/Sources/SwagGenKit/Utilities.swift @@ -69,7 +69,7 @@ extension String { var index = 0 let components = self.components(separatedBy: seperator) if uppercased() == self { - return components.map { $0.lowercased().mapFirstChar { $0.uppercased()} }.joined(separator: "") + return components.map { $0.lowercased().mapFirstChar { $0.uppercased() } }.joined(separator: "") } return components .map { string in @@ -106,7 +106,7 @@ extension String { } private var hasSeparator: Bool { - return separators.contains(where: { contains($0)}) + return separators.contains(where: { contains($0) }) } private var isAcronym: Bool { diff --git a/Tests/SwagGenKitTests/GeneratorTests.swift b/Tests/SwagGenKitTests/GeneratorTests.swift index 478bd1f81..f5b714b70 100644 --- a/Tests/SwagGenKitTests/GeneratorTests.swift +++ b/Tests/SwagGenKitTests/GeneratorTests.swift @@ -1,7 +1,7 @@ import Foundation -import XCTest import Spectre @testable import SwagGenKit +import XCTest public func testGenerator() {