repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
swift-openapi-runtime | github_2023 | others | 35 | apple | gjcairo | @@ -320,23 +383,49 @@ extension Converter {
func getOptionalQueryItems<T>(
in queryParameters: [URLQueryItem],
+ style: ParameterStyle?,
+ explode: Bool?,
name: String,
as type: [T].Type,
convert: (String) throws -> T
) throws -> [T]? {
- let untypedV... | I'm sorry for the late comment, but in theory I assume it would be possible to have values with commas in them. Would the commas be escaped or percent-encoded in this case? Just want to make sure this split doesn't split the string at incorrect places. |
swift-openapi-runtime | github_2023 | others | 29 | apple | gjcairo | @@ -17,31 +17,68 @@ extension Converter {
// MARK: Miscs
- /// Validates that the Content-Type header field (if present)
- /// is compatible with the provided content-type substring.
+ /// Returns the content-type header from the provided header fields, if
+ /// present.
+ /// - Parameter header... | Nit:
```suggestion
/// - expected: The expected content type, can contain wildcards.
``` |
swift-openapi-runtime | github_2023 | others | 29 | apple | simonjbeaumont | @@ -17,31 +17,53 @@ extension Converter {
// MARK: Miscs
- /// Validates that the Content-Type header field (if present)
- /// is compatible with the provided content-type substring.
+ /// Returns the MIME type from the content-type header, if present.
+ /// - Parameter headerFields: The header fie... | Nit: This is called `isValidContentType` but it's really a test that matches. It's not really about validity of the received content type? Really it's `validateContentTypeMatches(...)` or similar? |
swift-openapi-runtime | github_2023 | others | 29 | apple | simonjbeaumont | @@ -17,31 +17,53 @@ extension Converter {
// MARK: Miscs
- /// Validates that the Content-Type header field (if present)
- /// is compatible with the provided content-type substring.
+ /// Returns the MIME type from the content-type header, if present.
+ /// - Parameter headerFields: The header fie... | So this is going to return false if the expected input to the function is not a valid mimetype? Can't we just have this function take a `MIMEType` for `expected`? |
swift-openapi-runtime | github_2023 | others | 29 | apple | simonjbeaumont | @@ -0,0 +1,156 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | In the RFC, this does have some more structure. Maybe we don't care about this at this time, but there are at least codified special values:
https://datatracker.ietf.org/doc/html/rfc2045#section-5.1 |
swift-openapi-runtime | github_2023 | others | 29 | apple | simonjbeaumont | @@ -0,0 +1,156 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | If it's `fileprivate` why do we need it to be `soar_` prefixed? |
swift-openapi-runtime | github_2023 | others | 29 | apple | simonjbeaumont | @@ -0,0 +1,156 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Are we being overly permissive here? I skimmed the RFC and it the only thing I can interpret requirements about uniqueness of parameters is this:
> After the media type and subtype names, the remainder
of the header field is simply a set of parameters, specified in an
attribute=value notation. The ordering ... |
swift-openapi-runtime | github_2023 | others | 29 | apple | simonjbeaumont | @@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Is it possible to construct `*/json` currently? If so, should it be possible? |
swift-openapi-runtime | github_2023 | others | 29 | apple | simonjbeaumont | @@ -0,0 +1,170 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Nit: could use maxSplits here. |
swift-openapi-runtime | github_2023 | others | 25 | apple | simonjbeaumont | @@ -139,9 +139,9 @@ public struct OpenAPIValueContainer: Codable, Equatable, Hashable, Sendable {
try container.encode(value)
case let value as String:
try container.encode(value)
- case let value as [OpenAPIValueContainer?]:
+ case let value as [Sendable?]:
... | ```suggestion
case let value as [String: (any Sendable)?]:
```
And elsewhere |
swift-openapi-runtime | github_2023 | others | 22 | apple | FranzBusch | @@ -229,10 +229,11 @@ public protocol ClientMiddleware: Sendable {
/// - operationID: The identifier of the OpenAPI operation.
/// - next: A closure that calls the next middleware, or the transport.
/// - Returns: An HTTP response.
+ @preconcurrency | We should not add this and any of the other `@preconcurrency` attributes. Just marking the closure as `@Sendable` seems all we need. |
swift-openapi-runtime | github_2023 | others | 22 | apple | FranzBusch | @@ -47,20 +82,12 @@ extension HeaderField {
/// Use this to avoid leaking sensitive tokens into application logs.
public static var redactedHeaderFields: Set<String> { | This is actually a bit surprising to me. This is a global static which can be set to redact header fields? This sounds to be like something that should be rather passed in a configuration struct. @czechboy0 @simonjbeaumont is this something you considered before? |
swift-openapi-runtime | github_2023 | others | 22 | apple | simonjbeaumont | @@ -17,6 +17,40 @@ import Foundation
@preconcurrency import Foundation
#endif
+/// A protected-by-locks storage for ``redactedHeaderFields``.
+private class RedactedHeadersStorage: @unchecked Sendable {
+ /// The underlying storage of ``redactedHeaderFields``,
+ /// protected by a lock.
+ private var _lock... | ```suggestion
```
Isn't this implicit? |
swift-openapi-runtime | github_2023 | others | 22 | apple | simonjbeaumont | @@ -30,7 +30,7 @@ services:
test:
<<: *common
- command: /bin/bash -xcl "swift $${SWIFT_TEST_VERB-test} $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-}"
+ command: /bin/bash -xcl "swift $${SWIFT_TEST_VERB-test} $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-} -Xswiftc -str... | To follow the convention here we should probably replace this with...
```suggestion
command: /bin/bash -xcl "swift $${SWIFT_TEST_VERB-test} $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-} $${STRICT_CONCURRENCY_ARG-}"
```
...and then specify it in:
- `docker/docker-compose.2204.58.yaml`
- `do... |
swift-openapi-runtime | github_2023 | others | 22 | apple | FranzBusch | @@ -11,7 +11,11 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
+#if canImport(Darwin)
import Foundation
+#else
+@preconcurrency import Foundation | For all the places where we do this could we specify what type we are importing here by doing `import struct Foundation.URL`. This way we know what we need to make `Sendable` and it narrows down the preconcurrency import a bit more |
swift-openapi-runtime | github_2023 | others | 22 | apple | czechboy0 | @@ -327,7 +327,7 @@ public struct OpenAPIObjectContainer: Codable, Equatable, Hashable, Sendable {
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
- try container.encode(value.mapValues(OpenAPIValueContainer.init))
+ try container.encode(valu... | Can you confirm that before this change, this is also the initializer that was picked? I have a suspicion that we previously used the validated initializer, but would have to double check. |
swift-openapi-runtime | github_2023 | others | 22 | apple | czechboy0 | @@ -13,6 +13,7 @@ services:
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 | 👏 |
swift-openapi-runtime | github_2023 | others | 22 | apple | simonjbeaumont | @@ -19,7 +19,7 @@ RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile
# swift-format
ARG swiftformat_version=508.0.0
RUN git clone --branch $swiftformat_version --depth 1 https://github.com/apple/swift-format $HOME/.tools/swift-format-source
-RUN cd $HOME/.tools/swift-format-source && swift build -c releas... | This is us building `swift-format` for the formatting we do in the CI pipeline. This isn't where we want to be adding this.
This should be added to the `docker-compose.yaml` for the `integration-test` "service". |
swift-openapi-runtime | github_2023 | others | 19 | apple | czechboy0 | @@ -207,7 +207,7 @@ public protocol ClientTransport: Sendable {
/// ) async throws -> Response {
/// var request = request
/// request.headerFields.append(.init(
-/// name: "Authorization", value: "Bearer \(token)"
+/// name: "Authorization", value: "Be... | ```suggestion
/// name: "Authorization", value: "Bearer \(bearerToken)"
```
We generally omit the `self.` unless required by the compiler. |
swift-openapi-runtime | github_2023 | others | 18 | apple | czechboy0 | @@ -17,7 +17,7 @@ import PackageDescription
let package = Package(
name: "swift-openapi-runtime",
platforms: [
- .macOS(.v13), .iOS(.v16), .tvOS(.v16), .watchOS(.v9),
+ .macOS(.v10_15), .iOS(.v12), .tvOS(.v13), .watchOS(.v6), | ```suggestion
.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6),
```
Let's keep the OS versions aligned. |
swift-openapi-runtime | github_2023 | others | 18 | apple | czechboy0 | @@ -22,11 +22,21 @@ extension Converter {
) throws -> String {
var renderedString = template
for parameter in parameters {
- renderedString.replace(
- "{}",
- with: parameter.description,
- maxReplacements: 1
- )
+ if #... | Please check aligned watchOS and tvOS versions as well. |
swift-openapi-runtime | github_2023 | others | 18 | apple | czechboy0 | @@ -22,11 +22,21 @@ extension Converter {
) throws -> String {
var renderedString = template
for parameter in parameters {
- renderedString.replace(
- "{}",
- with: parameter.description,
- maxReplacements: 1
- )
+ if #... | ```suggestion
if let range = renderedString.range(of: "{}") {
renderedString = renderedString.replacingOccurrences(
of: "{}",
with: parameter.description,
range: range
)
}
```
Actually, let's j... |
swift-openapi-runtime | github_2023 | others | 17 | apple | czechboy0 | @@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+##===----------------------------------------------------------------------===##
+##
+## This source file is part of the SwiftOpenAPIGenerator open source project
+##
+## Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+## Licensed under Apache License ... | We have a few options here:
- clone main (the behavior proposed in this PR)
- clone the latest release
- clone the oldest "compatible" release (probably could be computed by taking the major.minor from latest release, and setting patch to 0) |
swift-openapi-runtime | github_2023 | others | 12 | apple | simonjbeaumont | @@ -281,17 +285,32 @@ public extension Converter {
/// - Parameters:
/// - type: Type used to decode the data.
/// - data: Encoded body data.
+ /// - strategy: A hint about which coding strategy to use.
/// - transform: Closure for transforming the Decodable type into a final type.
/... | Should we consider changing the semantics here to be stricter?
Specifically, if `bodyGetRequired(...)` is called with `strategy: .string` then I think it should attempt to use that strategy and fail if that wasn't the right choice.
Right now it looks like if we ask for `.string` but the type is not `_StringParam... |
swift-openapi-runtime | github_2023 | others | 12 | apple | simonjbeaumont | @@ -83,20 +83,25 @@ extension Converter {
/// - Parameters:
/// - type: Type used to decode the data.
/// - data: Encoded body data.
- /// - transform: Closure for transforming the Decodable type into a final type.
+ /// - strategy: A hint about which coding strategy to use.
+ /// - tr... | AFAICT this still has fallback semantics if called with `.string` when `T` does _not_ conform to `_StringParameterConvertible`, which IMO would be a bug in our generated code. As we discussed in the other thread, we think this method should be stricter since we have the more lenient method for backwards compatibility s... |
swift-openapi-runtime | github_2023 | others | 12 | apple | simonjbeaumont | @@ -139,9 +144,11 @@ extension Converter {
) throws -> Data {
let body = transform(value)
headerFields.add(name: "content-type", value: body.contentType)
- if let value = value as? _StringParameterConvertible {
+ if let value = value as? _StringParameterConvertible,
+ bod... | Ditto about strictness. |
swift-openapi-runtime | github_2023 | others | 9 | apple | simonjbeaumont | @@ -90,7 +90,18 @@ extension Converter {
from data: Data,
transforming transform: (T) -> C
) throws -> C {
- let decoded = try decoder.decode(type, from: data)
+ let decoded: T
+ if let myType = T.self as? _StringParameterConvertible.Type {
+ guard
+ ... | So I think you can put this back the way it was and avoid all the dynamic type checking by using an overload with a generic where clause like this:
```swift
public func bodyGet<T: Decodable, C>(
_ type: T.Type,
from data: Data,
transforming transform: (T) -> C
) throws -> C where... |
swift-openapi-runtime | github_2023 | others | 9 | apple | weissi | @@ -90,7 +90,18 @@ extension Converter {
from data: Data,
transforming transform: (T) -> C
) throws -> C {
- let decoded = try decoder.decode(type, from: data)
+ let decoded: T
+ if let myType = T.self as? _StringParameterConvertible.Type {
+ guard
+ ... | Please avoid String(data:encoding:), especially in networked software as it has 2 failure modes (return nil or insert replacement characters for invalid UTF8 -- which one it chooses depends on what's broken).
The correct and faster way is `String(decoding: data, as: UTF8.self)` which also doesn't require Foundation an... |
swift-openapi-runtime | github_2023 | others | 9 | apple | weissi | @@ -128,6 +139,12 @@ extension Converter {
) throws -> Data {
let body = transform(value)
headerFields.add(name: "content-type", value: body.contentType)
+ if let value = value as? _StringParameterConvertible {
+ guard let data = value.description.data(using: .utf8) else { | Same here, the correct and fast way is `Data(value.utf8)` which can't fail and is faster. You should audit your code to make sure `String(data` and `data(using` aren't present |
swift-openapi-runtime | github_2023 | others | 10 | apple | czechboy0 | @@ -90,19 +90,27 @@ extension Converter {
from data: Data,
transforming transform: (T) -> C
) throws -> C {
- let decoded: T
- if let myType = T.self as? _StringParameterConvertible.Type {
- guard
- let stringValue = String(data: data, encoding: .utf8),
- ... | ```suggestion
public func bodyGet<T: Decodable & _StringParameterConvertible, C>(
``` |
swift-openapi-runtime | github_2023 | others | 10 | apple | czechboy0 | @@ -126,6 +134,27 @@ extension Converter {
)
}
+ /// Provides an optional serialized value for the body value.
+ /// - Parameters:
+ /// - value: Encodable value to turn into data.
+ /// - headerFields: Headers container where to add the Content-Type header.
+ /// - transform: Closu... | ```suggestion
public func bodyAddOptional<T: Encodable & _StringParameterConvertible, C>(
``` |
swift-openapi-runtime | github_2023 | others | 10 | apple | czechboy0 | @@ -139,15 +168,28 @@ extension Converter {
) throws -> Data {
let body = transform(value)
headerFields.add(name: "content-type", value: body.contentType)
- if let value = value as? _StringParameterConvertible {
- guard let data = value.description.data(using: .utf8) else {
- ... | ```suggestion
public func bodyAddRequired<T: Encodable & _StringParameterConvertible, C>(
``` |
swift-openapi-runtime | github_2023 | others | 10 | apple | czechboy0 | @@ -139,15 +168,28 @@ extension Converter {
) throws -> Data {
let body = transform(value)
headerFields.add(name: "content-type", value: body.contentType)
- if let value = value as? _StringParameterConvertible {
- guard let data = value.description.data(using: .utf8) else {
- ... | ```suggestion
) throws -> Data {
``` |
swift-openapi-runtime | github_2023 | others | 4 | apple | simonjbeaumont | @@ -23,6 +23,7 @@ CURRENT_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPO_ROOT="$(git -C "${CURRENT_SCRIPT_DIR}" rev-parse --show-toplevel)"
swift package --package-path "${REPO_ROOT}" plugin generate-documentation \
+ --product OpenAPIRuntime \ | So that we can use the same script in other repos, I suggest we make this a parameter to the script, preferably as an environment variable...
```bash
log "Checking required environment variables..."
test -n "${DOCC_TARGET:-}" || fatal "DOCC_TARGET unset"
```
Then if we need this to run for multiple targets (wh... |
swift-openapi-runtime | github_2023 | others | 3 | apple | simonjbeaumont | @@ -1,9 +1,34 @@
# Swift OpenAPI Generator Runtime
-This library provides common abstractions and helper functions used by all
-client and server code generated by [Swift OpenAPI Generator][0].
+This library provides common abstractions and helper functions used by all client and server code generated by [Swift Open... | This isn't quite right. You don't use the types here to instantiate the client or the server. The `Client` and `Server` types are generated. It's more that this library is a dependency of those types.
```suggestion
This library contains the common types and abstractions required by projects adopting [Swift OpenAPI ... |
swift-openapi-runtime | github_2023 | others | 3 | apple | simonjbeaumont | @@ -1,9 +1,34 @@
# Swift OpenAPI Generator Runtime
-This library provides common abstractions and helper functions used by all
-client and server code generated by [Swift OpenAPI Generator][0].
+This library provides common abstractions and helper functions used by all client and server code generated by [Swift Open... | Do you think it makes sense to include this snippet because this is not an intended use case. I think we should show the generator plugin in here too (maybe without a transport, e.g. for a project that just generates the types? |
swift-openapi-runtime | github_2023 | others | 3 | apple | simonjbeaumont | @@ -1,9 +1,34 @@
# Swift OpenAPI Generator Runtime
-This library provides common abstractions and helper functions used by all
-client and server code generated by [Swift OpenAPI Generator][0].
+This library provides common abstractions and helper functions used by all client and server code generated by [Swift Open... | 👍 |
swift-openapi-runtime | github_2023 | others | 3 | apple | simonjbeaumont | @@ -4,14 +4,31 @@ Use and extend your client and server code generated by Swift OpenAPI Generato
## Overview
-
This library provides common abstractions and helper functions used by all client and server code generated by [Swift OpenAPI Generator][0].
-### Supported Use Cases
+### Supported use cases
1. Use ... | Does the style guide suggest something more directive, e.g.:
```suggestion
Add the package dependency in your `Package.swift`:
``` |
swift-openapi-runtime | github_2023 | others | 3 | apple | simonjbeaumont | @@ -1,9 +1,38 @@
# Swift OpenAPI Generator Runtime
-This library provides common abstractions and helper functions used by all
-client and server code generated by [Swift OpenAPI Generator][0].
+This library provides common abstractions and helper functions used by all client and server code generated by [Swift Open... | ```suggestion
This library provides common abstractions and helper functions used by the client and server code generated by [Swift OpenAPI Generator][0].
``` |
swift-openapi-runtime | github_2023 | others | 3 | apple | simonjbeaumont | @@ -1,9 +1,38 @@
# Swift OpenAPI Generator Runtime
-This library provides common abstractions and helper functions used by all
-client and server code generated by [Swift OpenAPI Generator][0].
+This library provides common abstractions and helper functions used by all client and server code generated by [Swift Open... | I think these paragraphs are dense because you're using the numbered list. Can we break them out into nested headings?
```suggestion
The next step depends on your use case.
### Using Swift OpenAPI Generator for code generation
The generated code depends on types from this library. Check out the adoption guide... |
app-store-server-library-swift | github_2023 | others | 84 | apple | izanger | @@ -1,5 +1,15 @@
# Changelog
+## Version 3.0.0
+- Incorporate changes for App Store Server API v1.15 and App Store Server Notifications v2.15 [https://github.com/apple/app-store-server-library-swift/pull/82]
+- Add verified chain caching to improve performance [https://github.com/apple/app-store-server-library-swift... | Extra "to" |
app-store-server-library-swift | github_2023 | others | 84 | apple | izanger | @@ -1,5 +1,15 @@
# Changelog
+## Version 3.0.0
+- Incorporate changes for App Store Server API v1.15 and App Store Server Notifications v2.15 [https://github.com/apple/app-store-server-library-swift/pull/82]
+- Add verified chain caching to improve performance [https://github.com/apple/app-store-server-library-swift... | NotificationDate -> NotificationData |
app-store-server-library-swift | github_2023 | others | 84 | apple | izanger | @@ -1,5 +1,15 @@
# Changelog
+## Version 3.0.0
+- Incorporate changes for App Store Server API v1.15 and App Store Server Notifications v2.15 [https://github.com/apple/app-store-server-library-swift/pull/82]
+- Add verified chain caching to improve performance [https://github.com/apple/app-store-server-library-swift... | - Wrong link
- Suggest Made -> Make to match tense of other bullets |
app-store-server-library-swift | github_2023 | others | 58 | apple | dimitribouniol | @@ -1,5 +1,10 @@
# Changelog
+## Version 2.1.0 | 😉
```suggestion
## Version 2.2.0
``` |
app-store-server-library-swift | github_2023 | others | 38 | apple | izanger | @@ -1,13 +1,20 @@
# Changelog
+## Version 1.1.0
+- Support App Store Server Notifications v2.10 [https://github.com/apple/app-store-server-library-swift/pull/37]
+- Require appAppleId in SignedDataVerifier for the Production environment [https://github.com/apple/app-store-server-library-swift/pull/35]
+
+## Version ... | Wrong link |
app-store-server-library-swift | github_2023 | others | 38 | apple | izanger | @@ -1,13 +1,20 @@
# Changelog
+## Version 1.1.0
+- Support App Store Server Notifications v2.10 [https://github.com/apple/app-store-server-library-swift/pull/37]
+- Require appAppleId in SignedDataVerifier for the Production environment [https://github.com/apple/app-store-server-library-swift/pull/35] | Add a shoutout |
app-store-server-library-swift | github_2023 | others | 35 | apple | alexanderjordanbaker | @@ -57,11 +57,12 @@ import AppStoreServerLibrary
let bundleId = "com.example"
let appleRootCAs = loadRootCAs() // Specific implementation may vary
+let appAppleId: String? = nil // For production environments, it's required | This is an Int64?, also could you please use the phrase "appAppleId must be provided for the Production environment" |
app-store-server-library-swift | github_2023 | others | 21 | apple | izanger | @@ -318,63 +318,282 @@ public class AppStoreServerAPIClient {
public enum APIResult<T> {
case success(response: T)
- case failure(statusCode: Int?, rawApiError: Int64?, apiError: APIError?, causedBy: Error?)
+ case failure(statusCode: Int?, rawApiError: Int64?, apiError: APIError?, errorMessage: String?, ... | Suggest a rename to `invalidRequestIdentifier` |
app-store-server-library-swift | github_2023 | others | 15 | apple | alexanderjordanbaker | @@ -150,31 +149,22 @@ final class AppStoreOIDPolicy: VerifierPolicy {
final class Requester: OCSPRequester {
func query(request: [UInt8], uri: String) async -> X509.OCSPRequesterQueryResult {
- let url = URL(string: uri)!
- var urlRequest = URLRequest(url: url)
- urlRequest.httpMethod = "PO... | Why is this not a terminalError? If we are unable to read data from the OCSP response, wouldn't that be an unrecoverable error? |
app-store-server-library-node | github_2023 | others | 199 | apple | alexanderjordanbaker | @@ -134,6 +134,14 @@ const signature = signatureCreator.createSignature(productId, subscriptionOfferI
console.log(signature)
```
+## Local Development | @hakusai22 Sorry for the slow reply, could we remove this piece? To provide contribution instructions, we'd need to do a fuller type of description and make sure it is applicable across all the languages, reference the contribution guidelines, etc. |
app-store-server-library-node | github_2023 | others | 164 | apple | mnMomma | @@ -76,7 +76,8 @@ const verifiedNotification = await verifier.verifyAndDecodeNotification(notifica
console.log(verifiedNotification)
```
-### Receipt Usage
+### Receipt Usage (For Legacy App Receipts)
+If you use an App Receipt from [Original StoreKit](https://developer.apple.com/documentation/storekit/in-app_purch... | Help with running this |
app-store-server-library-node | github_2023 | others | 115 | apple | riyazpanjwani | @@ -26,6 +26,15 @@ yarn add @apple/app-store-server-library
[Documentation](https://apple.github.io/app-store-server-library-node/)
[WWDC Video](https://developer.apple.com/videos/play/wwdc2023/10143/)
+
+### Obtaining an In-App Purchase key from App Store Connect
+
+To use the App Store Server API or creation prom... | nit: create? or of? |
app-store-server-library-node | github_2023 | others | 62 | apple | alexanderjordanbaker | @@ -1,6 +1,6 @@
{
"name": "@apple/app-store-server-library",
- "version": "1.0.0",
+ "version": "1.0.1", | If you are going to bump the version, please also bump the version in the user agent string as well |
app-store-server-library-node | github_2023 | others | 40 | apple | izanger | @@ -58,7 +58,7 @@ try {
### Verification Usage
```typescript
-import { SignedDataVerifier } from "@apple/app-store-server-library/dist/jwt_verification"
+import { SignedDataVerifier } from from "@apple/app-store-server-library" | Double `from`? |
app-store-server-library-node | github_2023 | typescript | 23 | apple | alexanderjordanbaker | @@ -367,48 +367,312 @@ export class APIException extends Error {
}
}
+/**
+ * Error codes that App Store Server API responses return.
+ *
+ * {@link https://developer.apple.com/documentation/appstoreserverapi/error_codes Error Codes} | Please update this to use a lowercase c to match the documentation |
swift-openapi-urlsession | github_2023 | others | 50 | apple | czechboy0 | @@ -193,7 +193,18 @@ extension URLRequest {
}
self.init(url: url)
self.httpMethod = request.method.rawValue
- for header in request.headerFields { setValue(header.value, forHTTPHeaderField: header.name.canonicalName) } | Would it also get fixed if we used the `addValue` API instead? https://developer.apple.com/documentation/foundation/urlrequest/2011522-addvalue |
swift-openapi-urlsession | github_2023 | others | 38 | apple | simonjbeaumont | @@ -10,12 +10,12 @@ Use the transport with client code generated by [Swift OpenAPI Generator](https:
### Supported platforms and minimum versions
-| macOS | Linux | iOS | tvOS | watchOS |
-| :-: | :-: | :-: | :-: | :-: |
-| ✅ 10.15+ | ✅ | ✅ 13+ | ✅ 13+ | ✅ 6+ |
+| macOS | Linux ... | ```suggestion
Note: Streaming support only available on macOS 12+, iOS 15+, tvOS 15+,
watchOS 8+, and visionOS 1+. For streaming support on Linux, please use the [AsyncHTTPClient
``` |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -0,0 +1,162 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Will this result in an error visible to the adopter? |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -0,0 +1,162 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Is it guaranteed that `requestBody` isn't nil here? |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -0,0 +1,162 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | What's the threading story here? Do we not need locks because the delegate calls are guaranteed to be called on a serial queue? |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -0,0 +1,162 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Will we surface this error to the adopter? |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -0,0 +1,162 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Do we need this if we're inside the `#if canImport(Darwin)` here? |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -0,0 +1,286 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Same as in the previous file, will these Linux imports be used if we're `#if` on Darwin? |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -0,0 +1,286 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Can you add a string to the crash (here and in the rest of the file)? |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -0,0 +1,286 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | ```suggestion
debug("Output stream delegate ignoring duplicate openCompleted event.")
``` |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -73,8 +73,21 @@ public struct URLSessionTransport: ClientTransport {
/// Creates a new configuration with the provided session.
/// - Parameter session: The URLSession used for performing HTTP operations.
- /// If none is provided, the system uses the shared URLSession.
- public... | 👍 |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -73,8 +73,21 @@ public struct URLSessionTransport: ClientTransport {
/// Creates a new configuration with the provided session.
/// - Parameter session: The URLSession used for performing HTTP operations.
- /// If none is provided, the system uses the shared URLSession.
- public... | ```suggestion
init(session: URLSession = .shared, implementation: Implementation) {
```
This way `.init()` won't be ambiguous. |
swift-openapi-urlsession | github_2023 | others | 24 | apple | czechboy0 | @@ -205,6 +218,69 @@ extension URLSessionTransportError: CustomStringConvertible {
case .notHTTPResponse(let response):
return "Received a non-HTTP response, of type: \(String(describing: type(of: response)))"
case .noResponse(let url): return "Received a nil response for \(url?.absoluteS... | Why is this here? |
swift-openapi-urlsession | github_2023 | others | 24 | apple | guoye-zhang | @@ -0,0 +1,286 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Is `openOutputStream` still useful? I think it's always true now |
swift-openapi-urlsession | github_2023 | others | 24 | apple | guoye-zhang | @@ -73,8 +73,23 @@ public struct URLSessionTransport: ClientTransport {
/// Creates a new configuration with the provided session.
/// - Parameter session: The URLSession used for performing HTTP operations.
- /// If none is provided, the system uses the shared URLSession.
- public... | My preference is to not expose `requestBodyStreamBufferSize`. It is an extremely confusing parameter that does not reflect buffering done in CFNetwork and Network framework. We could have gotten away with not using bounded stream pair if NSStream subclassing were easier in Swift, and it will likely be unnecessary in th... |
swift-openapi-urlsession | github_2023 | others | 24 | apple | guoye-zhang | @@ -0,0 +1,191 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Do we prefer NSLock or NIOLock? I think both are used in some files |
swift-openapi-urlsession | github_2023 | others | 24 | apple | guoye-zhang | @@ -0,0 +1,191 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the SwiftOpenAPIGenerator open source project
+//
+// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
+// Licensed under Apache License v2.0
+//
+// See LIC... | Returning nil is sufficient, no need to do both |
swift-openapi-urlsession | github_2023 | others | 19 | apple | glbrntt | @@ -37,6 +43,13 @@ for SCRIPT_PATH in "${SCRIPT_PATHS[@]}"; do
fi
done
+log "Running swift-format..."
+bash ${CURRENT_SCRIPT_DIR}/run-swift-format.sh $FIX_FORMAT > /dev/null | ```suggestion
bash "${CURRENT_SCRIPT_DIR}"/run-swift-format.sh $FIX_FORMAT > /dev/null
``` |
swift-openapi-urlsession | github_2023 | others | 28 | apple | czechboy0 | @@ -164,7 +164,8 @@ final class BidirectionalStreamingURLSessionDelegate: NSObject, URLSessionTaskDe
{
callbackLock.withLock {
debug("Task delegate: didReceive response")
- self.responseContinuation?.resume(returning: response)
+ responseContinuation?.resume(returning: r... | I remember someone recently mentioning that we should be careful about resuming continuations within locked sections. I wonder if we could make this a little safer by returning the continuation from `withLock` and resuming it outside the locked section? Same below.
Still approving the PR, just a thought in case you ... |
swift-openapi-urlsession | github_2023 | others | 26 | apple | czechboy0 | @@ -230,10 +231,17 @@ var debugLoggingEnabled: Bool {
get { _debugLoggingEnabled.withLockedValue { $0 } }
set { _debugLoggingEnabled.withLockedValue { $0 = newValue } }
}
-func debug(_ items: Any..., separator: String = " ", terminator: String = "\n") {
+private let _standardErrorLock = LockStorage.create(va... | Where's the `LockStorage` type coming from? |
swift-openapi-urlsession | github_2023 | others | 15 | apple | simonjbeaumont | @@ -138,40 +145,74 @@ internal enum URLSessionTransportError: Error {
case noResponse(url: URL?)
}
-extension OpenAPIRuntime.Response {
- init(from urlResponse: URLResponse, body: Data) throws {
+extension HTTPResponse {
+ static func response( | The guidance suggests that type-preserving conversions are `init(...)`. |
swift-openapi-urlsession | github_2023 | others | 15 | apple | simonjbeaumont | @@ -138,40 +145,74 @@ internal enum URLSessionTransportError: Error {
case noResponse(url: URL?)
}
-extension OpenAPIRuntime.Response {
- init(from urlResponse: URLResponse, body: Data) throws {
+extension HTTPResponse {
+ static func response(
+ method: HTTPRequest.Method,
+ urlResponse: UR... | Is this the right thing to do when we cannot convert the header? Should we instead throw? |
swift-openapi-urlsession | github_2023 | others | 15 | apple | simonjbeaumont | @@ -138,40 +145,74 @@ internal enum URLSessionTransportError: Error {
case noResponse(url: URL?)
}
-extension OpenAPIRuntime.Response {
- init(from urlResponse: URLResponse, body: Data) throws {
+extension HTTPResponse {
+ static func response(
+ method: HTTPRequest.Method,
+ urlResponse: UR... | I realise we left room in the transport API to provide a nil body. But we should consider which of these is more important:
- URLSessionTransport should have the same semantics as if I used URLSession directly.
- All transports should have similar semantics.
The latter is hard to police. Consequently, should thi... |
swift-openapi-urlsession | github_2023 | others | 15 | apple | simonjbeaumont | @@ -138,40 +145,74 @@ internal enum URLSessionTransportError: Error {
case noResponse(url: URL?)
}
-extension OpenAPIRuntime.Response {
- init(from urlResponse: URLResponse, body: Data) throws {
+extension HTTPResponse {
+ static func response(
+ method: HTTPRequest.Method,
+ urlResponse: UR... | Isn't it this `.canonicalName` that's causing the conversion that meant you needed to change the tests? ISTR that they had other properties that didn't do this? |
swift-openapi-urlsession | github_2023 | others | 15 | apple | simonjbeaumont | @@ -27,41 +27,54 @@ import Foundation
@preconcurrency import class FoundationNetworking.URLSessionConfiguration
#endif
@testable import OpenAPIURLSession
+import HTTPTypes
class URLSessionTransportTests: XCTestCase {
- func testRequestConversion() throws {
- let request = OpenAPIRuntime.Request(
- ... | Can't we move the `.canonicalName` to the test when doing the conversion as a normalization before the equality check? |
swift-openapi-urlsession | github_2023 | others | 7 | apple | czechboy0 | @@ -18,7 +18,7 @@ import PackageDescription
let package = Package(
name: "swift-openapi-urlsession",
platforms: [
- .macOS(.v13), .iOS(.v16), .tvOS(.v16), .watchOS(.v9),
+ .macOS(.v11), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), | For consistency, did you try bumping macOS back to `10.15`, so that all the OS's are aligned? |
swift-openapi-urlsession | github_2023 | others | 7 | apple | czechboy0 | @@ -90,7 +90,18 @@ public struct URLSessionTransport: ClientTransport {
}
private func invokeSession(_ urlRequest: URLRequest) async throws -> (Data, URLResponse) {
- #if canImport(FoundationNetworking)
+ #if canImport(FoundationNetworking)
+ return try await performDataTask(with: urlReques... | Should this also include the macOS, tvOS, and watchOS versions aligned with iOS 15? |
swift-openapi-urlsession | github_2023 | others | 7 | apple | simonjbeaumont | @@ -90,7 +90,18 @@ public struct URLSessionTransport: ClientTransport {
}
private func invokeSession(_ urlRequest: URLRequest) async throws -> (Data, URLResponse) {
- #if canImport(FoundationNetworking)
+ #if canImport(FoundationNetworking)
+ return try await performDataTask(with: urlReques... | I'm not sure I understand the motivation behind this method selection, but I might have misunderstood something.
Firstly, [`URLSession.dataTask(with:completionHandler:)`](https://developer.apple.com/documentation/foundation/urlsession/1407613-datatask) is not deprecated and is available back to macOS 10.9.
Second... |
swift-openapi-urlsession | github_2023 | others | 7 | apple | czechboy0 | @@ -4,6 +4,11 @@ A client transport that uses the [URLSession](https://developer.apple.com/docume
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 |
+ | ... | Good catch – can you please also add this to https://github.com/apple/swift-openapi-urlsession/blob/main/Sources/OpenAPIURLSession/Documentation.docc/Documentation.md? |
swift-openapi-urlsession | github_2023 | others | 7 | apple | czechboy0 | @@ -178,6 +178,8 @@ extension URLSessionTransportError: CustomStringConvertible {
"Invalid request URL from request path: \(request.path), query: \(request.query ?? "<nil>") relative to base URL: \(baseURL.absoluteString)"
case .notHTTPResponse(let response):
return "Received a no... | ```suggestion
return "Received a nil response for \(url?.absoluteString ?? "<nil URL>")"
```
Nit: to make it easier to catch when the URL is nil. |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -86,3 +91,178 @@ def query_iterator_indices(block_mask_map: np.ndarray, *, padding: int = 0) -> K
kv_block_offset=jnp.asarray(index_offset),
kv_block_offset_size=jnp.asarray(index_offset_size),
)
+
+
+class BaseFlashAttention(Configurable):
+ """Common interface for FlashAttention for all b... | Keep some of these as required? `is_decoding=False` doesn't seem like a universal default. |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -86,3 +91,178 @@ def query_iterator_indices(block_mask_map: np.ndarray, *, padding: int = 0) -> K
kv_block_offset=jnp.asarray(index_offset),
kv_block_offset_size=jnp.asarray(index_offset_size),
)
+
+
+class BaseFlashAttention(Configurable):
+ """Common interface for FlashAttention for all b... | ```suggestion
``` |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -86,3 +91,178 @@ def query_iterator_indices(block_mask_map: np.ndarray, *, padding: int = 0) -> K
kv_block_offset=jnp.asarray(index_offset),
kv_block_offset_size=jnp.asarray(index_offset_size),
)
+
+
+class BaseFlashAttention(Configurable):
+ """Common interface for FlashAttention for all b... | ```suggestion
self, *, query: Tensor, key: Tensor, value: Tensor, bias: BaseAttentionBias
``` |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -86,3 +91,178 @@ def query_iterator_indices(block_mask_map: np.ndarray, *, padding: int = 0) -> K
kv_block_offset=jnp.asarray(index_offset),
kv_block_offset_size=jnp.asarray(index_offset_size),
)
+
+
+class BaseFlashAttention(Configurable):
+ """Common interface for FlashAttention for all b... | ```suggestion
self,
*,
```
(If kwargs are prohibited somewhere, please leave a comment.) |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -86,3 +91,178 @@ def query_iterator_indices(block_mask_map: np.ndarray, *, padding: int = 0) -> K
kv_block_offset=jnp.asarray(index_offset),
kv_block_offset_size=jnp.asarray(index_offset_size),
)
+
+
+class BaseFlashAttention(Configurable):
+ """Common interface for FlashAttention for all b... | Here we can define a `default_config` which sets `is_decoding=True`. |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -86,3 +91,178 @@ def query_iterator_indices(block_mask_map: np.ndarray, *, padding: int = 0) -> K
kv_block_offset=jnp.asarray(index_offset),
kv_block_offset_size=jnp.asarray(index_offset_size),
)
+
+
+class BaseFlashAttention(Configurable):
+ """Common interface for FlashAttention for all b... | Retain typing/returns and add a docstring referring users to the parent.
(Please apply elsewhere.) |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -772,63 +789,168 @@ def call_kernel(
flash_attention.defvjp(_mha_forward, _mha_backward)
-# Interface to cuDNN's dot product attention.
-# TODO(kelvin-zou): Add support for segment IDs.
-def cudnn_dot_product_attention(
- query: Tensor,
- key: Tensor,
- value: Tensor,
- bias: Optional[Tensor] = None... | Why do we need the attribute? |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -772,63 +789,168 @@ def call_kernel(
flash_attention.defvjp(_mha_forward, _mha_backward)
-# Interface to cuDNN's dot product attention.
-# TODO(kelvin-zou): Add support for segment IDs.
-def cudnn_dot_product_attention(
- query: Tensor,
- key: Tensor,
- value: Tensor,
- bias: Optional[Tensor] = None... | nit --
```suggestion
self._log_unsupported("Multi-step decoding is not supported.")
return False
``` |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -772,63 +789,168 @@ def call_kernel(
flash_attention.defvjp(_mha_forward, _mha_backward)
-# Interface to cuDNN's dot product attention.
-# TODO(kelvin-zou): Add support for segment IDs.
-def cudnn_dot_product_attention(
- query: Tensor,
- key: Tensor,
- value: Tensor,
- bias: Optional[Tensor] = None... | Comment on block size in relation to gpu_block_size? |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -177,7 +177,7 @@ def _compute_attention(
backend=backend,
softmax_scale=1.0,
is_decoding=is_decoding,
- block_size=cfg.tpu_block_size,
+ tpu_block_size=cfg.tpu_block_size, | Can we leave a TODO to decouple the naming from specific platforms? |
axlearn | github_2023 | python | 1,058 | apple | markblee | @@ -214,3 +218,37 @@ def _mha_backward(
flash_attention.defvjp(_mha_forward, _mha_backward)
+
+
+class NeuronFlashAttention(BaseFlashAttention):
+ """Wraps the Neuron attention kernel."""
+
+ def is_supported(self, query, key, value, bias):
+ # TODO(hanzhi-zhou): neuron may error out for unsupported s... | What is the reason not to do so? |
axlearn | github_2023 | python | 1,041 | apple | changlan | @@ -168,10 +169,160 @@ class ForwardMode(enum.Enum):
class KVState(NamedTuple):
- """Represents key/value projections, of shape [batch, source_length, num_kv_heads, head_dim]."""
+ """Represents key/value projections.
+
+ Fields:
+ k_proj: [batch, source_length, num_kv_heads, per_head_dim], Project... | nit: Could you please add more details on the semantics of paddings? |
axlearn | github_2023 | python | 1,041 | apple | changlan | @@ -168,10 +169,160 @@ class ForwardMode(enum.Enum):
class KVState(NamedTuple):
- """Represents key/value projections, of shape [batch, source_length, num_kv_heads, head_dim]."""
+ """Represents key/value projections.
+
+ Fields:
+ k_proj: [batch, source_length, num_kv_heads, per_head_dim], Project... | Is this same as `key_positions`? Why use different names? |
axlearn | github_2023 | python | 1,041 | apple | changlan | @@ -2013,16 +2003,46 @@ def init_states(
query and .probs is of shape [batch, num_heads, target_length, source_length].
Otherwise, if initializing cache from scratch, output will be None.
"""
- return self._forward_for_mode(
+ if key is not None:
+ if ... | Is this true when we use splash attention? |
axlearn | github_2023 | python | 1,041 | apple | changlan | @@ -1758,6 +1734,7 @@ def _forward_for_mode(
query: A Tensor or TensorSpec of shape [batch, target_length, target_dim].
key: An optional Tensor of shape [batch, source_length, source_dim].
value: An optional Tensor of shape [batch, source_length, source_dim].
+ paddin... | nit: add more comments on the semantics of paddings? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.