diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..548a1a8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,6 @@ +blank_issues_enabled: false +contact_links: + - name: 🐞 Open an issue on the Swift OpenAPI Generator repository + url: https://github.com/apple/swift-openapi-generator/issues + about: > + Issues for all repositories in the Swift OpenAPI Generator project are centralized in the swift-openapi-generator repository. diff --git a/Package.swift b/Package.swift index 6d83659..c1d69ba 100644 --- a/Package.swift +++ b/Package.swift @@ -25,7 +25,7 @@ let swiftSettings: [SwiftSetting] = [ let package = Package( name: "swift-openapi-async-http-client", platforms: [ - .macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), + .macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1) ], products: [ .library( @@ -36,7 +36,8 @@ let package = Package( dependencies: [ .package(url: "https://github.com/apple/swift-nio", from: "2.58.0"), .package(url: "https://github.com/swift-server/async-http-client.git", from: "1.19.0"), - .package(url: "https://github.com/apple/swift-openapi-runtime", exact: "1.0.0-alpha.1"), + .package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"), + .package(url: "https://github.com/apple/swift-http-types", from: "1.0.0"), .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"), ], targets: [ @@ -44,6 +45,7 @@ let package = Package( name: "OpenAPIAsyncHTTPClient", dependencies: [ .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"), + .product(name: "HTTPTypes", package: "swift-http-types"), .product(name: "AsyncHTTPClient", package: "async-http-client"), .product(name: "NIOFoundationCompat", package: "swift-nio"), ], diff --git a/README.md b/README.md index fde930f..c8224ce 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # AsyncHTTPClient Transport for Swift OpenAPI Generator [![](https://img.shields.io/badge/docc-read_documentation-blue)](https://swiftpackageindex.com/swift-server/swift-openapi-async-http-client/documentation) +[![](https://img.shields.io/github/v/release/swift-server/swift-openapi-async-http-client)](https://github.com/swift-server/swift-openapi-async-http-client/releases) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fswift-server%2Fswift-openapi-async-http-client%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/swift-server/swift-openapi-async-http-client) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fswift-server%2Fswift-openapi-async-http-client%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/swift-server/swift-openapi-async-http-client) @@ -9,37 +10,28 @@ A client transport that uses the [HTTPClient](https://swiftpackageindex.com/swif Use the transport with client code generated by [Swift OpenAPI Generator](https://github.com/apple/swift-openapi-generator). ## Supported platforms and minimum versions -| macOS | Linux | iOS | tvOS | watchOS | -| :-: | :-: | :-: | :-: | :-: | -| ✅ 10.15+ | ✅ | ✅ 13+ | ✅ 13+ | ✅ 6+ | +| macOS | Linux | iOS | tvOS | watchOS | visionOS | +| :-: | :-: | :-: | :-: | :-: | :-: | +| ✅ 10.15+ | ✅ | ✅ 13+ | ✅ 13+ | ✅ 6+ | ✅ 1+ | ## Usage Add the package dependency in your `Package.swift`: ```swift -.package( - url: "https://github.com/swift-server/swift-openapi-async-http-client", - exact: "1.0.0-alpha.1" -), +.package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.0.0"), ``` -Note that this repository does not have a 1.0 tag yet, so the API is not stable. - Next, in your target, add `OpenAPIAsyncHTTPClient` to your dependencies: ```swift .target(name: "MyTarget", dependencies: [ .product(name: "OpenAPIAsyncHTTPClient", package: "swift-openapi-async-http-client"), -], +]), ``` Then, to get started, check out `AsyncHTTPClientTransport`. -## Reporting issues - -Please report any issues related to this library in the [swift-openapi-generator](https://github.com/apple/swift-openapi-generator/issues) repository. - ## Documentation To learn more, check out the full [documentation](https://swiftpackageindex.com/swift-server/swift-openapi-async-http-client/documentation). diff --git a/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift b/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift index 6694a42..d16220e 100644 --- a/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift +++ b/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift @@ -35,17 +35,11 @@ import protocol Foundation.LocalizedError /// /// let transport = AsyncHTTPClientTransport() /// -/// Create the base URL of the server to call using your client. If the server -/// URL was defined in the OpenAPI document, you find a generated method for it -/// on the `Servers` type, for example: -/// -/// let serverURL = try Servers.server1() -/// /// Instantiate the `Client` type generated by the Swift OpenAPI Generator for /// your provided OpenAPI document. For example: /// /// let client = Client( -/// serverURL: serverURL, +/// serverURL: URL(string: "https://example.com/")!, /// transport: transport /// ) /// @@ -53,8 +47,7 @@ import protocol Foundation.LocalizedError /// example, if the OpenAPI document contains an HTTP operation with /// the identifier `checkHealth`, call it from Swift with: /// -/// let response = try await client.checkHealth(.init()) -/// // ... +/// let response = try await client.checkHealth() /// /// ### Provide a custom Client /// @@ -135,7 +128,7 @@ public struct AsyncHTTPClientTransport: ClientTransport { /// Creates a new transport. /// - Parameter configuration: A set of configuration values used by the transport. - public init(configuration: Configuration) { + public init(configuration: Configuration = .init()) { self.init(configuration: configuration, requestSender: AsyncHTTPRequestSender()) } diff --git a/Sources/OpenAPIAsyncHTTPClient/Documentation.docc/Documentation.md b/Sources/OpenAPIAsyncHTTPClient/Documentation.docc/Documentation.md index 123bc69..f4eb007 100644 --- a/Sources/OpenAPIAsyncHTTPClient/Documentation.docc/Documentation.md +++ b/Sources/OpenAPIAsyncHTTPClient/Documentation.docc/Documentation.md @@ -9,37 +9,28 @@ A client transport that uses the [HTTPClient](https://swiftpackageindex.com/swif Use the transport with client code generated by [Swift OpenAPI Generator](https://github.com/apple/swift-openapi-generator). ### Supported platforms and minimum versions -| macOS | Linux | iOS | tvOS | watchOS | -| :-: | :-: | :-: | :-: | :-: | -| ✅ 10.15+ | ✅ | ✅ 13+ | ✅ 13+ | ✅ 6+ | +| macOS | Linux | iOS | tvOS | watchOS | visionOS | +| :-: | :-: | :-: | :-: | :-: | :-: | +| ✅ 10.15+ | ✅ | ✅ 13+ | ✅ 13+ | ✅ 6+ | ✅ 1+ | ### Usage Add the package dependency in your `Package.swift`: ```swift -.package( - url: "https://github.com/swift-server/swift-openapi-async-http-client", - exact: "1.0.0-alpha.1" -), +.package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.0.0"), ``` -Note that this repository does not have a 1.0 tag yet, so the API is not stable. - Next, in your target, add `OpenAPIAsyncHTTPClient` to your dependencies: ```swift .target(name: "MyTarget", dependencies: [ .product(name: "OpenAPIAsyncHTTPClient", package: "swift-openapi-async-http-client"), -], +]), ``` Then, to get started, check out ``AsyncHTTPClientTransport``. -### Reporting issues - -Please report any issues related to this library in the [swift-openapi-generator](https://github.com/apple/swift-openapi-generator/issues) repository. - ## Topics ### Usage diff --git a/docker/docker-compose.2204.590.yaml b/docker/docker-compose.2204.590.yaml new file mode 100644 index 0000000..4a6bf8d --- /dev/null +++ b/docker/docker-compose.2204.590.yaml @@ -0,0 +1,19 @@ +version: "3" + +services: + runtime-setup: + image: &image swift-openapi-ahc:22.04-5.9.0 + build: + args: + ubuntu_version: "jammy" + swift_version: "5.9.0" + + test: + image: *image + environment: + - WARN_AS_ERROR_ARG=-Xswiftc -warnings-as-errors + - IMPORT_CHECK_ARG=--explicit-target-dependency-import-check error + - STRICT_CONCURRENCY_ARG=-Xswiftc -strict-concurrency=complete + + shell: + image: *image