Skip to content

Commit

Permalink
Up to swift6
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Nov 11, 2024
1 parent 22be3c5 commit 8b5fd34
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 30 deletions.
51 changes: 28 additions & 23 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
// swift-tools-version: 5.9
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

private extension PackageDescription.Target.Dependency {
static let openAPIRuntime: Self = .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime")
static let openAPIURLSession: Self = .product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession")
static let factory: Self = .product(name: "Factory", package: "Factory")
static let oversizeModels: Self = .product(name: "OversizeModels", package: "OversizeModels")
}
import Foundation
import PackageDescription

private extension PackageDescription.Target.PluginUsage {
static let openAPIGenerator: Self = .plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator")
}
let commonDependencies: [PackageDescription.Package.Dependency] = [
.package(url: "https://github.com/apple/swift-openapi-generator", .upToNextMinor(from: "1.4.0")),
.package(url: "https://github.com/apple/swift-openapi-runtime", .upToNextMinor(from: "1.6.0")),
.package(url: "https://github.com/apple/swift-openapi-urlsession", .upToNextMinor(from: "1.0.2")),
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")),
]

import PackageDescription
let remoteDependencies: [PackageDescription.Package.Dependency] = commonDependencies + [
.package(url: "https://github.com/oversizedev/OversizeModels.git", .upToNextMajor(from: "0.1.0")),
]

let localDependencies: [PackageDescription.Package.Dependency] = commonDependencies + [
.package(name: "OversizeModels", path: "../OversizeModels"),
]


var dependencies: [PackageDescription.Package.Dependency] = remoteDependencies

if ProcessInfo.processInfo.environment["BUILD_MODE"] == "DEV" {
dependencies = localDependencies
}

let package = Package(
name: "OversizeNetwork",
Expand All @@ -28,22 +40,15 @@ let package = Package(
targets: ["OversizeNetwork"]
),
],
dependencies: [
.package(url: "https://github.com/apple/swift-openapi-generator", .upToNextMinor(from: "1.2.1")),
.package(url: "https://github.com/apple/swift-openapi-runtime", .upToNextMinor(from: "1.4.0")),
.package(url: "https://github.com/apple/swift-openapi-urlsession", .upToNextMinor(from: "1.0.1")),
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")),
.package(url: "https://github.com/oversizedev/OversizeModels.git", .upToNextMajor(from: "0.1.0")),
//.package(name: "OversizeModels", path: "../OversizeModels"),
],
dependencies: dependencies,
targets: [
.target(
name: "OversizeNetwork",
dependencies: [
.openAPIRuntime,
.openAPIURLSession,
.oversizeModels,
.factory,
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
.product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
.product(name: "Factory", package: "Factory"),
.product(name: "OversizeModels", package: "OversizeModels"),
] /* ,
plugins: [
.openAPIGenerator,
Expand Down
61 changes: 55 additions & 6 deletions Sources/OversizeNetwork/GeneratedSources/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ extension APIProtocol {

/// Server URLs defined in the OpenAPI document.
public enum Servers {
public enum Server1 {
public static func url() throws -> Foundation.URL {
try Foundation.URL(
validatingOpenAPIServerURL: "https://cdn.oversize.design",
variables: []
)
}
}
@available(*, deprecated, renamed: "Servers.Server1.url")
public static func server1() throws -> Foundation.URL {
try Foundation.URL(
validatingOpenAPIServerURL: "https://cdn.oversize.design",
Expand Down Expand Up @@ -317,7 +326,7 @@ public enum Components {
/// - Remark: Generated from `#/components/schemas/AppDetail/termsDate`.
public var termsDate: Swift.String
/// - Remark: Generated from `#/components/schemas/AppDetail/termsAdditionsPayload`.
@frozen public enum termsAdditionsPayloadPayload: String, Codable, Hashable, Sendable {
@frozen public enum termsAdditionsPayloadPayload: String, Codable, Hashable, Sendable, CaseIterable {
case yandexAds = "yandexAds"
case adMob = "adMob"
case firebaseAnalytics = "firebaseAnalytics"
Expand Down Expand Up @@ -438,7 +447,7 @@ public enum Components {
/// - Remark: Generated from `#/components/schemas/AppDetailBlock`.
public struct AppDetailBlock: Codable, Hashable, Sendable {
/// - Remark: Generated from `#/components/schemas/AppDetailBlock/design`.
@frozen public enum designPayload: String, Codable, Hashable, Sendable {
@frozen public enum designPayload: String, Codable, Hashable, Sendable, CaseIterable {
case cards = "cards"
case cardFeatures = "cardFeatures"
}
Expand All @@ -453,7 +462,7 @@ public enum Components {
/// - Remark: Generated from `#/components/schemas/AppDetailBlock/color`.
public var color: Swift.String?
/// - Remark: Generated from `#/components/schemas/AppDetailBlock/grid`.
@frozen public enum gridPayload: String, Codable, Hashable, Sendable {
@frozen public enum gridPayload: String, Codable, Hashable, Sendable, CaseIterable {
case grid1_2 = "grid1_2"
}
/// - Remark: Generated from `#/components/schemas/AppDetailBlock/grid`.
Expand Down Expand Up @@ -510,15 +519,15 @@ public enum Components {
/// - Remark: Generated from `#/components/schemas/AppDetailFeature/description`.
public var description: Swift.String?
/// - Remark: Generated from `#/components/schemas/AppDetailFeature/alignment`.
@frozen public enum alignmentPayload: String, Codable, Hashable, Sendable {
@frozen public enum alignmentPayload: String, Codable, Hashable, Sendable, CaseIterable {
case left = "left"
case center = "center"
case right = "right"
}
/// - Remark: Generated from `#/components/schemas/AppDetailFeature/alignment`.
public var alignment: Components.Schemas.AppDetailFeature.alignmentPayload?
/// - Remark: Generated from `#/components/schemas/AppDetailFeature/textSize`.
@frozen public enum textSizePayload: String, Codable, Hashable, Sendable {
@frozen public enum textSizePayload: String, Codable, Hashable, Sendable, CaseIterable {
case small = "small"
case medium = "medium"
case large = "large"
Expand Down Expand Up @@ -598,7 +607,7 @@ public enum Components {
/// - Remark: Generated from `#/components/schemas/SpecialOffer/accentColor`.
public var accentColor: Swift.String?
/// - Remark: Generated from `#/components/schemas/SpecialOffer/effect`.
@frozen public enum effectPayload: String, Codable, Hashable, Sendable {
@frozen public enum effectPayload: String, Codable, Hashable, Sendable, CaseIterable {
case snow = "snow"
}
/// - Remark: Generated from `#/components/schemas/SpecialOffer/effect`.
Expand Down Expand Up @@ -822,6 +831,14 @@ public enum Operations {
///
/// HTTP response code: `404 notFound`.
case notFound(Operations.fetchApps.Output.NotFound)
/// Apps not found
///
/// - Remark: Generated from `#/paths//config/apps-short.json/get(fetchApps)/responses/404`.
///
/// HTTP response code: `404 notFound`.
public static var notFound: Self {
.notFound(.init())
}
/// The associated value of the enum case if `self` is `.notFound`.
///
/// - Throws: An error if `self` is not `.notFound`.
Expand Down Expand Up @@ -959,6 +976,14 @@ public enum Operations {
///
/// HTTP response code: `404 notFound`.
case notFound(Operations.fetchInfo.Output.NotFound)
/// Info not found
///
/// - Remark: Generated from `#/paths//config/info.json/get(fetchInfo)/responses/404`.
///
/// HTTP response code: `404 notFound`.
public static var notFound: Self {
.notFound(.init())
}
/// The associated value of the enum case if `self` is `.notFound`.
///
/// - Throws: An error if `self` is not `.notFound`.
Expand Down Expand Up @@ -1096,6 +1121,14 @@ public enum Operations {
///
/// HTTP response code: `404 notFound`.
case notFound(Operations.fetchSpecialOffers.Output.NotFound)
/// Offers not found
///
/// - Remark: Generated from `#/paths//config/special-offers.json/get(fetchSpecialOffers)/responses/404`.
///
/// HTTP response code: `404 notFound`.
public static var notFound: Self {
.notFound(.init())
}
/// The associated value of the enum case if `self` is `.notFound`.
///
/// - Throws: An error if `self` is not `.notFound`.
Expand Down Expand Up @@ -1255,6 +1288,14 @@ public enum Operations {
///
/// HTTP response code: `404 notFound`.
case notFound(Operations.fetchAppById.Output.NotFound)
/// App not found
///
/// - Remark: Generated from `#/paths//config/apps/{appId}.json/get(fetchAppById)/responses/404`.
///
/// HTTP response code: `404 notFound`.
public static var notFound: Self {
.notFound(.init())
}
/// The associated value of the enum case if `self` is `.notFound`.
///
/// - Throws: An error if `self` is not `.notFound`.
Expand Down Expand Up @@ -1392,6 +1433,14 @@ public enum Operations {
///
/// HTTP response code: `404 notFound`.
case notFound(Operations.fetchAds.Output.NotFound)
/// Apps not found
///
/// - Remark: Generated from `#/paths//config/ads.json/get(fetchAds)/responses/404`.
///
/// HTTP response code: `404 notFound`.
public static var notFound: Self {
.notFound(.init())
}
/// The associated value of the enum case if `self` is `.notFound`.
///
/// - Throws: An error if `self` is not `.notFound`.
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeNetwork/NetworkService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public struct NetworkService {
public init() {
self.init(
underlyingClient: Client(
serverURL: try! Servers.server1(),
serverURL: try! Servers.Server1.url(),
transport: URLSessionTransport()
)
)
Expand Down

0 comments on commit 8b5fd34

Please sign in to comment.