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 | 115 | apple | czechboy0 | @@ -46,7 +56,18 @@ extension ServerSentEventsDeserializationSequence: AsyncSequence {
var upstream: UpstreamIterator
/// The state machine of the iterator.
- var stateMachine: StateMachine = .init()
+ var stateMachine: StateMachine
+
+ /// A closure that determines whether the g... | ```suggestion
/// A closure that determines whether the given byte chunk should be forwarded to the consumer.
``` |
swift-openapi-runtime | github_2023 | others | 115 | apple | czechboy0 | @@ -46,7 +56,18 @@ extension ServerSentEventsDeserializationSequence: AsyncSequence {
var upstream: UpstreamIterator
/// The state machine of the iterator.
- var stateMachine: StateMachine = .init()
+ var stateMachine: StateMachine
+
+ /// A closure that determines whether the g... | ```suggestion
/// - Returns: `true` if the byte chunk should be forwarded, `false` if this byte chunk is the terminating sequence.
``` |
swift-openapi-runtime | github_2023 | others | 115 | apple | czechboy0 | @@ -46,7 +56,18 @@ extension ServerSentEventsDeserializationSequence: AsyncSequence {
var upstream: UpstreamIterator
/// The state machine of the iterator.
- var stateMachine: StateMachine = .init()
+ var stateMachine: StateMachine
+
+ /// A closure that determines whether the g... | ```suggestion
init(upstream: UpstreamIterator, while predicate: @escaping ((ArraySlice<UInt8>) -> Bool)) {
self.upstream = upstream
```
Also, please add a doc comment for the initializer as well. |
swift-openapi-runtime | github_2023 | others | 115 | apple | czechboy0 | @@ -133,8 +157,16 @@ extension ServerSentEventsDeserializationSequence.Iterator {
/// The current state of the state machine.
private(set) var state: State
+
+ /// A closure that determines whether the given byte sequence is the terminating byte sequence defined by the API.
+ /... | The closure should be added as an associated value to the State enum, rather than being a property next to it. That'll ensure we correctly handle it in all cases, and discard it when not needed anymore. |
swift-openapi-runtime | github_2023 | others | 115 | apple | czechboy0 | @@ -165,6 +197,12 @@ extension ServerSentEventsDeserializationSequence.Iterator {
state = .accumulatingEvent(.init(), buffer: buffer)
// If the last character of data is a newline, strip it.
if event.data?.hasSuffix("\n") ?? false { event.data?.removeLast()... | ```suggestion
// If the last character of data is a newline, strip it.
if event.data?.hasSuffix("\n") ?? false { event.data?.removeLast() }
state = .accumulatingEvent(.init(), buffer: buffer)
... |
swift-openapi-runtime | github_2023 | others | 115 | apple | czechboy0 | @@ -16,17 +16,19 @@ import XCTest
import Foundation
final class Test_ServerSentEventsDecoding: Test_Runtime {
- func _test(input: String, output: [ServerSentEvent], file: StaticString = #filePath, line: UInt = #line)
+ func _test(input: String, output: [ServerSentEvent], file: StaticString = #filePath, line: ... | Do we need `eventCountOffset`? The test always accumulates the sequence in its fullness, and we can just verify the number of expected events passed through (so excluding the terminating event). |
swift-openapi-runtime | github_2023 | others | 115 | apple | czechboy0 | @@ -46,7 +56,22 @@ extension ServerSentEventsDeserializationSequence: AsyncSequence {
var upstream: UpstreamIterator
/// The state machine of the iterator.
- var stateMachine: StateMachine = .init()
+ var stateMachine: StateMachine
+
+ /// A closure that determines whether the g... | Would it be possible to also remove the `predicate` property from the iterator type? I believe it should be enough for it to be owned by the state machine.
So it'd stay in the initializer of the iterator, but wouldn't be persisted as a property on the iterator, only forwarded to the state machine's iterator. |
swift-openapi-runtime | github_2023 | others | 115 | apple | czechboy0 | @@ -79,26 +104,29 @@ extension AsyncSequence where Element == ArraySlice<UInt8>, Self: Sendable {
/// Returns another sequence that decodes each event's data as the provided type using the provided decoder.
///
/// Use this method if the event's `data` field is not JSON, or if you don't want to parse it ... | ```suggestion
/// - Parameter: A closure that determines whether the given byte chunk should be forwarded to the consumer.
``` |
swift-openapi-runtime | github_2023 | others | 115 | apple | czechboy0 | @@ -28,9 +28,19 @@ where Upstream.Element == ArraySlice<UInt8> {
/// The upstream sequence.
private let upstream: Upstream
+ /// A closure that determines whether the given byte chunk should be forwarded to the consumer.
+ /// - Parameter: A byte chunk.
+ /// - Returns: `true` if the byte chunk sho... | ```suggestion
/// - predicate: A closure that determines whether the given byte chunk should be forwarded to the consumer.
```
IIRC the parameter name (not the label) is what's used in docs - try to run the soundness script to verify. |
swift-openapi-runtime | github_2023 | others | 115 | apple | czechboy0 | @@ -156,20 +180,26 @@ extension ServerSentEventsDeserializationSequence.Iterator {
/// - Returns: An action to perform.
mutating func next() -> NextAction {
switch state {
- case .accumulatingEvent(var event, var buffer):
+ case .accumulatingEvent(var event, var buff... | ```suggestion
if let data = event.data, !predicate(ArraySlice(data.utf8)) {
state = .finished
return .returnNil
}
state = .accumulatingEvent(.init(), buffer: buffer, predicate: predicate)
... |
swift-openapi-runtime | github_2023 | others | 107 | apple | czechboy0 | @@ -1,4 +1,4 @@
-// swift-tools-version: 5.9
+// swift-tools-version: 6.0 | This would break existing users on pre-6.0 toolchains, so we can't do it this way. |
swift-openapi-runtime | github_2023 | others | 107 | apple | czechboy0 | @@ -17,7 +17,7 @@ extension URL {
/// Returns the default server URL of "/".
///
/// Specification: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields
- public static let defaultOpenAPIServerURL: Self = {
+ public nonisolated(unsafe) static let defaultOpenAPIServe... | This would be better fixed by Foundation.URL being Sendable on Linux (it already is on Darwin). |
swift-openapi-runtime | github_2023 | others | 107 | apple | czechboy0 | @@ -50,16 +50,16 @@ extension CharacterSet {
/// A character set of unreserved symbols only from RFC 6570 (excludes
/// alphanumeric characters).
- fileprivate static let unreservedSymbols: CharacterSet = .init(charactersIn: "-._~")
+ fileprivate nonisolated(unsafe) static let unreservedSymbols: Chara... | This would be better fixed by Foundation.CharacterSet being Sendable on Linux (it already is on Darwin). |
swift-openapi-runtime | github_2023 | others | 107 | apple | czechboy0 | @@ -342,8 +342,13 @@ extension MultipartFramesToRawPartsSequence {
switch stateMachine.nextFromPartSequence() {
case .returnNil: return nil
case .fetchFrame:
+ let frame : Upstream.AsyncIterator.Element? | Could you break out these async sequence iteration fixes into a separate PR? These I think we'll be able to land soon, but the other ones (CharacterSet and URL), I'd like us to fix in swift-corelibs-foundation instead.
The shape of this fix is correct, but I wonder if we can make the `#if` more selective to the stdl... |
swift-openapi-runtime | github_2023 | others | 112 | apple | simonjbeaumont | @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import XCTest
-@_spi(Generated) import OpenAPIRuntime
+@_spi(Generated) @testable import OpenAPIRuntime | OOI, why was the `@testable` import needed here? Could we write the tests to use only the API? |
swift-openapi-runtime | github_2023 | others | 108 | apple | czechboy0 | @@ -342,8 +342,17 @@ extension MultipartFramesToRawPartsSequence {
switch stateMachine.nextFromPartSequence() {
case .returnNil: return nil
case .fetchFrame:
+ let frame: Upstream.AsyncIterator.Element?
var upstream = upstream
- let f... | While we're here, would you mind creating an extension on `AsyncIteratorProtocol` that adds a utility method for this dance, and call it from these two places you're updating in the PR? It'd take the actor as a parameter. |
swift-openapi-runtime | github_2023 | others | 100 | apple | simonjbeaumont | @@ -61,13 +61,15 @@ extension URIParser {
switch configuration.style {
case .form: return [:]
case .simple: return ["": [""]]
+ case .deepObject: return [:]
}
}
switch (configuration.style, configuration.explode) {
case (.form, tr... | My reading of the OAS is that `deepObject` is only valid with `explode: true`[^0]. If that's the case, we should probably guard against that somehow.
[^0]: https://spec.openapis.org/oas/latest.html#style-examples |
swift-openapi-runtime | github_2023 | others | 100 | apple | simonjbeaumont | @@ -205,6 +207,50 @@ extension URIParser {
}
}
}
+
+ /// Parses the root node assuming the raw string uses the deepObject style
+ /// and the explode parameter is enabled.
+ /// - Returns: The parsed root node.
+ /// - Throws: An error if parsing fails.
+ private mutating f... | Can you give an example for this case? The spec is light on examples and IIUC doesn't have an example that _isn't_ the `object[key]=value` form. |
swift-openapi-runtime | github_2023 | others | 100 | apple | simonjbeaumont | @@ -326,4 +372,35 @@ extension String.SubSequence {
}
return finalize()
}
+
+
+ /// Accumulates characters from the `startingCharacter` character provided,
+ /// until the `endingCharacter` is reached. Moves the underlying startIndex.
+ /// - Parameters:
+ /// - startingChar... | This seems redundant? |
swift-openapi-runtime | github_2023 | others | 100 | apple | simonjbeaumont | @@ -326,4 +372,35 @@ extension String.SubSequence {
}
return finalize()
}
+
+
+ /// Accumulates characters from the `startingCharacter` character provided,
+ /// until the `endingCharacter` is reached. Moves the underlying startIndex.
+ /// - Parameters:
+ /// - startingChar... | Presumably this can now be removed? |
swift-openapi-runtime | github_2023 | others | 100 | apple | simonjbeaumont | @@ -326,4 +372,35 @@ extension String.SubSequence {
}
return finalize()
}
+
+
+ /// Accumulates characters from the `startingCharacter` character provided,
+ /// until the `endingCharacter` is reached. Moves the underlying startIndex.
+ /// - Parameters:
+ /// - startingChar... | This function seems to overlap significantly with `parseUpToCharacterOrEnd(_:)`, the only difference is that we move the index forward to the first occurrence of `startingCharacter` first. Do we need the duplication, or can we implement one in terms of the other? |
swift-openapi-runtime | github_2023 | others | 100 | apple | simonjbeaumont | @@ -387,16 +407,20 @@ final class Test_URICodingRoundtrip: Test_Runtime {
let decodedValue = try decoder.decode(T.self, forKey: key, from: encodedString[...])
XCTAssertEqual(decodedValue, variant.customValue ?? value, "Variant: \(name)", file: file, line: line)
}
- try testVari... | This appears to have disabled a bunch of tests. |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -26,6 +26,11 @@
///
/// Details: https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.2
case simple
+
+ /// The deepObject style.
+ ///
+ /// Details: Should update datatracker | Can you put a link to the RFC please? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -205,6 +207,50 @@ extension URIParser {
}
}
}
+
+ /// Parses the root node assuming the raw string uses the deepObject style
+ /// and the explode parameter is enabled.
+ /// - Returns: The parsed root node.
+ /// - Throws: An error if parsing fails.
+ private mutating f... | ```suggestion
``` |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -180,6 +181,9 @@ extension URISerializer {
case (.simple, _):
keyAndValueSeparator = nil
pairSeparator = ","
+ case (.deepObject, _): | By my reading of the OpenAPI 3.1 specification, deepObject _must_ have a JSON object at the top, so an array would not be supported? https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-examples |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -228,8 +232,15 @@ extension URISerializer {
case (.simple, false):
keyAndValueSeparator = ","
pairSeparator = ","
+ case (.deepObject, _): | I think we should again validate that explode is true, and throw an error on false. |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -228,8 +232,15 @@ extension URISerializer {
case (.simple, false):
keyAndValueSeparator = ","
pairSeparator = ","
+ case (.deepObject, _):
+ keyAndValueSeparator = "="
+ pairSeparator = "&"
}
+ func serializeNestedKey(_ elementKey: Str... | Can you check that we end up percent-escaping the `[` and `]` characters? Technically they should be escaped.
However, when parsing, we should be flexible and support both escaped and unescaped. |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -23,4 +23,12 @@ final class Test_URIEncoder: Test_Runtime {
let encodedString = try encoder.encode(Foo(bar: "hello world"), forKey: "root")
XCTAssertEqual(encodedString, "bar=hello+world")
}
+
+ func testNestedEncoding() throws {
+ struct Foo: Encodable { var bar: String }
+ ... | Are we sure that deepObject uses `+` instead of `%20` for encoding spaces? Can you find it in the RFC? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -103,7 +109,8 @@ final class Test_URISerializer: Test_Runtime {
simpleExplode: "red,green,blue",
simpleUnexplode: "red,green,blue",
formDataExplode: "list=red&list=green&list=blue",
- formDataUnexplode: "list=red,green,blue"
+ ... | Let's figure out what we do with arrays, I think either we don't support them, or they should be something like `list[]=red&...` or `list[0]=red&...` |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -118,7 +125,8 @@ final class Test_URISerializer: Test_Runtime {
simpleExplode: "comma=%2C,dot=.,semi=%3B",
simpleUnexplode: "comma,%2C,dot,.,semi,%3B",
formDataExplode: "comma=%2C&dot=.&semi=%3B",
- formDataUnexplode: "keys=comma,%2C,d... | Ah cool, this answers my question about escaping. Can you add another test case that verifies that we successfully parse strings with the `[` and `]` unescaped? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -302,17 +349,55 @@ extension String.SubSequence {
return finalize(.foundSecondOrEnd)
}
+
/// Accumulates characters until the provided character is found,
/// or the end is reached. Moves the underlying startIndex.
- /// - Parameter character: A character to stop at.
+ /// - Param... | Can we take one more look here? Could you try to revert this part and go back to the original parseUpToCharacterOrEnd(_ character: Character) function, and explain why it can't work for you? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -205,6 +213,45 @@ extension URIParser {
}
}
}
+
+ /// Parses the root node assuming the raw string uses the deepObject style
+ /// and the explode parameter is enabled.
+ /// - Returns: The parsed root node.
+ /// - Throws: An error if parsing fails.
+ private mutating f... | Here you should verify that the first character is `[`, otherwise this is a malformed key. For the rest of the characters, you should be able to use `parseUpToCharacterOrEnd` as originally was. |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -29,7 +29,8 @@ final class Test_URIParser: Test_Runtime {
simpleExplode: .custom("", value: ["": [""]]),
simpleUnexplode: .custom("", value: ["": [""]]),
formDataExplode: "empty=",
- formDataUnexplode: "empty="
+ for... | Shouldn't this have some square brackets? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -51,7 +53,8 @@ final class Test_URIParser: Test_Runtime {
simpleExplode: .custom("fred", value: ["": ["fred"]]),
simpleUnexplode: .custom("fred", value: ["": ["fred"]]),
formDataExplode: "who=fred",
- formDataUnexplode: "who=fred"
+ ... | Shouldn't this have some square brackets? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -62,7 +65,8 @@ final class Test_URIParser: Test_Runtime {
simpleExplode: .custom("Hello%20World", value: ["": ["Hello World"]]),
simpleUnexplode: .custom("Hello%20World", value: ["": ["Hello World"]]),
formDataExplode: "hello=Hello+World",
- ... | Shouldn't this have some square brackets? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -73,7 +77,8 @@ final class Test_URIParser: Test_Runtime {
simpleExplode: .custom("red,green,blue", value: ["": ["red", "green", "blue"]]),
simpleUnexplode: .custom("red,green,blue", value: ["": ["red", "green", "blue"]]),
formDataExplode: "list=red&list=... | Shouldn't this have some square brackets? Or be unsupported, as an array? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -93,7 +98,8 @@ final class Test_URIParser: Test_Runtime {
formDataUnexplode: .custom(
"keys=comma,%2C,dot,.,semi,%3B",
value: ["keys": ["comma", ",", "dot", ".", "semi", ";"]]
- )
+ ),
+ d... | Shouldn't this have some square brackets? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -31,7 +31,8 @@ final class Test_URISerializer: Test_Runtime {
simpleExplode: "",
simpleUnexplode: "",
formDataExplode: "empty=",
- formDataUnexplode: "empty="
+ formDataUnexplode: "empty=",
+ deepO... | Same in this whole file: Shouldn't this have some square brackets? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -140,6 +148,9 @@ final class Test_URISerializer: Test_Runtime {
try testVariant(.simpleUnexplode, testCase.variants.simpleUnexplode)
try testVariant(.formDataExplode, testCase.variants.formDataExplode)
try testVariant(.formDataUnexplode, testCase.variants.formDataUnexplode)
+ ... | Why is this if statement here instead of running the variant unconditionally like the previous few? |
swift-openapi-runtime | github_2023 | others | 100 | apple | czechboy0 | @@ -36,13 +36,16 @@ struct URIParser: Sendable {
}
/// A typealias for the underlying raw string storage.
-private typealias Raw = String.SubSequence
+typealias Raw = String.SubSequence
/// A parser error.
-private enum ParsingError: Swift.Error {
+enum ParsingError: Swift.Error, Equatable { | ```suggestion
enum ParsingError: Swift.Error, Hashable {
```
We should always customize both together (Equatable and Hashable), this does that. |
swift-openapi-runtime | github_2023 | others | 102 | apple | czechboy0 | @@ -144,6 +144,32 @@ extension Converter {
return HTTPBody(data)
}
+ /// Returns a value decoded from a XML body.
+ /// - Parameter body: The body containing the raw XML bytes.
+ /// - Returns: A decoded value.
+ /// - Throws: An error if decoding from the body fails.
+ /// - Throws: An e... | Please add a static let for xml on the `OpenAPIMIMEType` type, and use that here, so that we don't need to copy the raw MIME type for XML 4 times in this file. |
swift-openapi-runtime | github_2023 | others | 102 | apple | czechboy0 | @@ -88,6 +89,7 @@ internal enum RuntimeError: Error, CustomStringConvertible, LocalizedError, Pret
case .invalidBase64String(let string):
return "Invalid base64-encoded string (first 128 bytes): '\(string.prefix(128))'"
case .failedToDecodeStringConvertibleValue(let string): return "Faile... | ```suggestion
case .missingCoderForCustomContentType(let contentType): return "Missing custom coder for content type '\(contentType)'."
``` |
swift-openapi-runtime | github_2023 | others | 102 | apple | czechboy0 | @@ -120,6 +120,30 @@ final class Test_ClientConverterExtensions: Test_Runtime {
try await XCTAssertEqualStringifiedData(body, testStructPrettyString)
XCTAssertEqual(headerFields, [.contentType: "application/json", .contentLength: "23"])
}
+
+ // | client | set | request body | XML | opt... | Reminder: Please adapt the `Converting-between-data-and-Swift-types.md` docs page with the addition of XML in your swift-openapi-generator PR, when it comes to it. |
swift-openapi-runtime | github_2023 | others | 102 | apple | czechboy0 | @@ -105,17 +123,27 @@ public struct Configuration: Sendable {
/// The generator to use when creating mutlipart bodies.
public var multipartBoundaryGenerator: any MultipartBoundaryGenerator
+ public var customCoders: [String: any CustomCoder] | I'm a bit worried about this being too generic and folks assuming it'll override the JSON coders as well (which it won't).
Could you change this to `public var xmlCoder: (any CustomCoder)?` instead? I think it's better to be explicit here. |
swift-openapi-runtime | github_2023 | others | 102 | apple | czechboy0 | @@ -96,6 +96,24 @@ extension JSONDecoder.DateDecodingStrategy {
}
}
+/// A type that allows custom content type encoding and decoding.
+public protocol CustomCoder: Sendable {
+
+ /// Encodes the given value and returns its custom encoded representation.
+ ///
+ /// - parameter value: The value to enco... | Please run the `./scripts/soundness.sh` script and check it doesn't produce any warnings, I think these comments aren't entirely consistent with the rest. |
swift-openapi-runtime | github_2023 | others | 102 | apple | czechboy0 | @@ -105,17 +123,24 @@ public struct Configuration: Sendable {
/// The generator to use when creating mutlipart bodies.
public var multipartBoundaryGenerator: any MultipartBoundaryGenerator
+ /// Custom XML coder for encoding and decoding xml bodies.
+ public var xmlCoder: (any CustomCoder)?
+
... | ```suggestion
/// - xmlCoder: Custom XML coder for encoding and decoding xml bodies. Only required when using XML body payloads.
``` |
swift-openapi-runtime | github_2023 | others | 102 | apple | czechboy0 | @@ -105,17 +123,24 @@ public struct Configuration: Sendable {
/// The generator to use when creating mutlipart bodies.
public var multipartBoundaryGenerator: any MultipartBoundaryGenerator
+ /// Custom XML coder for encoding and decoding xml bodies.
+ public var xmlCoder: (any CustomCoder)?
+
... | You'll also need to add a deprecated version of the 2-param initializer into `Deprecated.swift`, as adding a parameter is technically an API-breaking change, so we also need the previous one, and it'll just call back into this one. Something like:
```swift
extension Configuration {
/// Creates a new payload.
... |
swift-openapi-runtime | github_2023 | others | 94 | apple | simonjbeaumont | @@ -25,14 +25,45 @@ public protocol DateTranscoder: Sendable {
}
/// A transcoder for dates encoded as an ISO-8601 string (in RFC 3339 format).
-public struct ISO8601DateTranscoder: DateTranscoder {
+public struct ISO8601DateTranscoder: DateTranscoder, @unchecked Sendable {
+
+ /// The lock protecting the format... | Maybe if we spell this as `init(options: ISO8601DateFormatter.Options? = nil)`, the optionality and nil-default will imply a default-when-nil, which can also be documented for additional clarity. |
swift-openapi-runtime | github_2023 | others | 94 | apple | simonjbeaumont | @@ -25,14 +25,45 @@ public protocol DateTranscoder: Sendable {
}
/// A transcoder for dates encoded as an ISO-8601 string (in RFC 3339 format).
-public struct ISO8601DateTranscoder: DateTranscoder {
+public struct ISO8601DateTranscoder: DateTranscoder, @unchecked Sendable {
+
+ /// The lock protecting the format... | Do we need to have a stored property for the formatter and consequently have to deal with the locking? Could we instead hold an `IOS8601DateFormatter.Options` and use this when we create the formatter?
Alternatively, I notice that `ISO8601DateFormatter` has [`class func string(from:timeZone:formatOptions:)`](https:... |
swift-openapi-runtime | github_2023 | others | 94 | apple | simonjbeaumont | @@ -25,14 +25,45 @@ public protocol DateTranscoder: Sendable {
}
/// A transcoder for dates encoded as an ISO-8601 string (in RFC 3339 format).
-public struct ISO8601DateTranscoder: DateTranscoder {
+public struct ISO8601DateTranscoder: DateTranscoder, @unchecked Sendable {
+
+ /// The lock protecting the format... | If we don't need it now, let's drop it until we have a need. |
swift-openapi-runtime | github_2023 | others | 94 | apple | simonjbeaumont | @@ -25,14 +25,45 @@ public protocol DateTranscoder: Sendable {
}
/// A transcoder for dates encoded as an ISO-8601 string (in RFC 3339 format).
-public struct ISO8601DateTranscoder: DateTranscoder {
+public struct ISO8601DateTranscoder: DateTranscoder, @unchecked Sendable {
+
+ /// The lock protecting the format... | If we do decide to keep the formatter and still need locking can we pull in the `LockedValueBox` so we don't need to use unchecked sendable? |
swift-openapi-runtime | github_2023 | others | 94 | apple | simonjbeaumont | @@ -44,6 +75,11 @@ public struct ISO8601DateTranscoder: DateTranscoder {
extension DateTranscoder where Self == ISO8601DateTranscoder {
/// A transcoder that transcodes dates as ISO-8601–formatted string (in RFC 3339 format).
public static var iso8601: Self { ISO8601DateTranscoder() }
+
+ /// A transcoder... | Maybe we don't have it, but if we do I think the name is clear enough. OOI, is it a problem to include fractional seconds in `.iso8601`? |
swift-openapi-runtime | github_2023 | others | 91 | apple | simonjbeaumont | @@ -122,3 +125,34 @@ extension RandomAccessCollection where Element: Equatable {
return .noMatch
}
}
+
+/// A value returned by the `longestMatchOfOneOf` method. | ```suggestion
/// A value returned by the `matchOfOneOf` method.
``` |
swift-openapi-runtime | github_2023 | others | 91 | apple | simonjbeaumont | @@ -0,0 +1,236 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | Not a blocker, but I'm wondering if we can do better here with respect to performance. Specifically, this will call `firstIndex(of:)` every time we receive new bytes to find the record separator, which will be O(n) in the current size of the buffer and will search for the record separator through portions of the buffer... |
swift-openapi-runtime | github_2023 | others | 91 | apple | simonjbeaumont | @@ -0,0 +1,451 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | Spec says:
> If the field value does not contain U+0000 NULL, then set the last event ID buffer to the field value. Otherwise, ignore the field.
Are we relying on earlier logic / string parsing for this? |
swift-openapi-runtime | github_2023 | others | 91 | apple | simonjbeaumont | @@ -0,0 +1,451 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | I think that we might be over reaching here and we can simplify even if it means delays. I.e. we can wait for the LF before emitting. It's covered explicitly by the spec:
> Since connections established to remote servers for such resources are expected to be long-lived, UAs should ensure that appropriate buffering i... |
swift-openapi-runtime | github_2023 | others | 90 | apple | simonjbeaumont | @@ -15,3 +15,10 @@ import Foundation
import HTTPTypes
// MARK: - Functionality to be removed in the future
+
+extension UndocumentedPayload {
+ /// Creates a new payload.
+ @available(*, deprecated, renamed: "init(headerFields:body:)") @_disfavoredOverload public init() {
+ self.init(headerFields: [:],... | Do we need to carry this forever now?
Why do we need it, given the new `init(headerFields:body:)` has default parameters?
Can't we do this differently by having the new `init(headerFields:body:)` _not_ have default parameters and just change the implementation of `init()` to call it with the defaults, given that... |
swift-openapi-runtime | github_2023 | others | 88 | apple | simonjbeaumont | @@ -68,15 +68,29 @@ Please report any issues related to this library in the [swift-openapi-generator
- ``Configuration``
- ``DateTranscoder``
- ``ISO8601DateTranscoder``
+- ``MultipartBoundaryGenerator``
+- ``RandomMultipartBoundaryGenerator``
+- ``ConstantMultipartBoundaryGenerator``
+- ``IterationBehavior``
+
+###... | IMO I'd keep HTTPBody here. |
swift-openapi-runtime | github_2023 | others | 77 | apple | simonjbeaumont | @@ -122,24 +122,16 @@ public final class HTTPBody: @unchecked Sendable {
public typealias ByteChunk = ArraySlice<UInt8>
/// Describes how many times the provided sequence can be iterated.
- public enum IterationBehavior: Sendable {
-
- /// The input sequence can only be iterated once.
- ///... | Can we move this to Deprecated.swift so it doesn't get missed in the 1.0.0 sweep? |
swift-openapi-runtime | github_2023 | others | 77 | apple | simonjbeaumont | @@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 LICE... | Some typos.
```suggestion
/// The length, in bytes, of the random boundary suffix.
public let randomNumberSuffixLength: Int
/// The options for the random bytes suffix.
private let values: [UInt8] = Array("0123456789".utf8)
/// Create a new generator.
/// - Parameters:
/// - ... |
swift-openapi-runtime | github_2023 | others | 77 | apple | simonjbeaumont | @@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 LICE... | ```suggestion
let generator = RandomMultipartBoundaryGenerator(boundaryPrefix: "__abcd__", randomNumberSuffixLength: 8)
``` |
swift-openapi-runtime | github_2023 | others | 71 | apple | czechboy0 | @@ -56,7 +56,13 @@ public struct Base64EncodedData: Sendable, Hashable {
/// Initializes an instance of ``Base64EncodedData`` wrapping the provided slice of bytes.
/// - Parameter data: The underlying bytes to wrap.
+ @available(*, deprecated, renamed: "init", message: "Use the init(_ data: ArraySlice<UI... | ```suggestion
@available(*, deprecated, renamed: "init(_:)")
``` |
swift-openapi-runtime | github_2023 | others | 71 | apple | czechboy0 | @@ -56,7 +56,13 @@ public struct Base64EncodedData: Sendable, Hashable {
/// Initializes an instance of ``Base64EncodedData`` wrapping the provided slice of bytes.
/// - Parameter data: The underlying bytes to wrap.
+ @available(*, deprecated, renamed: "init", message: "Use the init(_ data: ArraySlice<UI... | ```suggestion
public init(_ data: ArraySlice<UInt8>) { self.data = data }
/// Initializes an instance of ``Base64EncodedData`` wrapping the provided sequence of bytes.
/// - Parameter data: The underlying bytes to wrap.
public init(_ data: some Sequence<UInt8>) { self.init(ArraySlice(data)) }
... |
swift-openapi-runtime | github_2023 | others | 71 | apple | czechboy0 | @@ -74,7 +80,7 @@ extension Base64EncodedData: Codable {
guard let data = Data(base64Encoded: base64EncodedString, options: options) else {
throw RuntimeError.invalidBase64String(base64EncodedString)
}
- self.init(data: ArraySlice(data))
+ self.init(ArraySlice(data)) | With the change above, this should work by passing `Data` directly.
```suggestion
self.init(data)
``` |
swift-openapi-runtime | github_2023 | others | 71 | apple | czechboy0 | @@ -241,14 +241,14 @@ final class Test_OpenAPIValue: Test_Runtime {
}
func testEncoding_base64_success() throws {
- let encodedData = Base64EncodedData(data: ArraySlice(testStructData))
+ let encodedData = Base64EncodedData(ArraySlice(testStructData)) | ```suggestion
let encodedData = Base64EncodedData(testStructData)
``` |
swift-openapi-runtime | github_2023 | others | 71 | apple | czechboy0 | @@ -241,14 +241,14 @@ final class Test_OpenAPIValue: Test_Runtime {
}
func testEncoding_base64_success() throws {
- let encodedData = Base64EncodedData(data: ArraySlice(testStructData))
+ let encodedData = Base64EncodedData(ArraySlice(testStructData))
let JSONEncoded = try JSONEncod... | ```suggestion
let encodedData = Base64EncodedData(testStructData)
``` |
swift-openapi-runtime | github_2023 | others | 71 | apple | czechboy0 | @@ -257,7 +257,7 @@ final class Test_OpenAPIValue: Test_Runtime {
}
func testEncodingDecodingRoundtrip_base64_success() throws {
- let encodedData = Base64EncodedData(data: ArraySlice(testStructData))
+ let encodedData = Base64EncodedData(ArraySlice(testStructData)) | ```suggestion
let encodedData = Base64EncodedData(testStructData)
``` |
swift-openapi-runtime | github_2023 | others | 71 | apple | czechboy0 | @@ -56,7 +56,13 @@ public struct Base64EncodedData: Sendable, Hashable {
/// Initializes an instance of ``Base64EncodedData`` wrapping the provided slice of bytes.
/// - Parameter data: The underlying bytes to wrap.
+ @available(*, deprecated, renamed: "init", message: "Use the init(_ data: ArraySlice<UI... | While we're at it, let's also add an array literal expressible conformances for byte arrays.
This means you can then do `let value: Base64EncodedData = [0xa, 0xd]`.
```suggestion
extension Base64EncodedData: ExpressibleByArrayLiteral {
init(arrayLiteral elements: UInt8...) {
self.init(elements)
... |
swift-openapi-runtime | github_2023 | others | 71 | apple | czechboy0 | @@ -56,7 +56,23 @@ public struct Base64EncodedData: Sendable, Hashable {
/// Initializes an instance of ``Base64EncodedData`` wrapping the provided slice of bytes.
/// - Parameter data: The underlying bytes to wrap.
+ @available(*, deprecated, renamed: "init(_:)")
+ | ```suggestion
``` |
swift-openapi-runtime | github_2023 | others | 82 | apple | simonjbeaumont | @@ -19,7 +19,7 @@ Add the package dependency in your `Package.swift`:
```swift
.package(
url: "https://github.com/apple/swift-openapi-runtime",
- .upToNextMinor(from: "0.3.0")
+ exact: "1.0.0-alpha.1" | Um, not sure what this is, but looks like we got some non-printable thing in here. |
swift-openapi-runtime | github_2023 | others | 74 | apple | simonjbeaumont | @@ -0,0 +1,380 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | This dance seems odd. Because of it being an `actor`? |
swift-openapi-runtime | github_2023 | others | 73 | apple | simonjbeaumont | @@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 LICE... | How do you feel about making use of the byte chunk here.
```suggestion
typealias Element = HTTPBody.ByteChunk
``` |
swift-openapi-runtime | github_2023 | others | 73 | apple | simonjbeaumont | @@ -0,0 +1,260 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | Needs a better name since the comment suggests emitted _something_ (cf. nothing); specifically the start.
For symmetry with the others, why not, simply `emittedStart`? |
swift-openapi-runtime | github_2023 | others | 70 | apple | MahdiBM | @@ -1,5 +1,9 @@
# Swift OpenAPI Generator Runtime
+[](https://swiftpackageindex.com/apple/swift-openapi-runtime/documentation) | Would you want to add the SSWG badge too perhaps, or have you already thought about it?
With an `img` tag it would look like so:
```
<img src="https://user-images.githubusercontent.com/54685446/201329617-9fd91ab0-35c2-42c2-8963-47b68c6a490a.png" alt="SSWG sandbox">
``` |
swift-openapi-runtime | github_2023 | others | 72 | apple | simonjbeaumont | @@ -0,0 +1,121 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
static let tab: UInt8 = 0x09
``` |
swift-openapi-runtime | github_2023 | others | 72 | apple | simonjbeaumont | @@ -0,0 +1,342 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | ~I assume this is a check for `No whitespace is allowed between the header field-name and colon.`, however, this just finds the first index after the next colon and if it finds one, then it sets that as the start of the header value. FWICT it only returns `.emitError(.missingColonAfterHeaderName)` if there is no colon.... |
swift-openapi-runtime | github_2023 | others | 66 | apple | simonjbeaumont | @@ -70,17 +98,49 @@ extension DecodingError {
/// occurred.
/// - codingPath: The coding path to the decoder that attempted to decode
/// the type.
+ /// - errors: The errors encountered when decoding individual cases.
/// - Throws: An error of type `DecodingError.failedToDecodeAnySchema`... | Should this be `@_spi`? |
swift-openapi-runtime | github_2023 | others | 66 | apple | simonjbeaumont | @@ -189,7 +189,7 @@ extension Encoder {
}
/// A freeform String coding key for decoding undocumented values.
-private struct StringKey: CodingKey, Hashable, Comparable {
+struct StringKey: CodingKey, Hashable, Comparable { | Should this be `@_spi`? |
swift-openapi-runtime | github_2023 | others | 65 | apple | gjcairo | @@ -187,3 +187,115 @@ extension OpenAPIMIMEType: LosslessStringConvertible {
.joined(separator: "; ")
}
}
+
+// MARK: - Internals
+
+extension OpenAPIMIMEType {
+
+ /// The result of a match evaluation between two MIME types.
+ enum Match: Hashable {
+
+ /// The reason why two types are ... | ```suggestion
// Inferred: Parameter values are case-sensitive.
``` |
swift-openapi-runtime | github_2023 | others | 65 | apple | gjcairo | @@ -29,45 +29,52 @@ extension Converter {
return OpenAPIMIMEType(rawValue)
}
- /// Checks whether a concrete content type matches an expected content type.
- ///
- /// The concrete content type can contain parameters, such as `charset`, but
- /// they are ignored in the equality comparison.
... | This may be a needless optimisation, but we could use `Array/max(by:)` ([docs](https://developer.apple.com/documentation/swift/array/max(by:))) instead of sorting, since we're only getting the first option anyways. |
swift-openapi-runtime | github_2023 | others | 65 | apple | gjcairo | @@ -54,6 +55,153 @@ final class Test_CommonConverterExtensions: Test_Runtime {
}
}
+ func testBestContentType() throws {
+ func testCase(
+ received: String?,
+ options: [String],
+ expected expectedChoice: String,
+ file: StaticString = #file,
+ ... | Small nit but maybe pass an empty string/nil when we expect errors to be thrown instead, for clarity? |
swift-openapi-runtime | github_2023 | others | 63 | apple | glbrntt | @@ -90,76 +90,116 @@ import Foundation
serializer: @Sendable (OperationInput) throws -> (HTTPRequest, HTTPBody?),
deserializer: @Sendable (HTTPResponse, HTTPBody?) async throws -> OperationOutput
) async throws -> OperationOutput where OperationInput: Sendable, OperationOutput: Sendable {
- ... | Is this a result of changing formatting options or just a manual fix up? |
swift-openapi-runtime | github_2023 | others | 63 | apple | glbrntt | @@ -64,6 +64,10 @@ public struct ClientError: Error {
/// Will be nil if the error resulted before the response was received.
public var responseBody: HTTPBody?
+ /// A user-facing description of what caused the underlying error
+ /// to be thrown.
+ public var causeDescription: String | Why use a `causeDescription` over wrapping the actual underlying cause in another error which represents the cause description?
For example, with the middleware case, I can imagine something like:
```swift
struct MiddlewareError: Error {
var middlewareType: String
var underlyingError: any Error
var d... |
swift-openapi-runtime | github_2023 | others | 64 | apple | glbrntt | @@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 LICE... | `Sendable` and `Hashable`? |
swift-openapi-runtime | github_2023 | others | 62 | apple | glbrntt | @@ -35,6 +41,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-runtime | github_2023 | others | 60 | apple | czechboy0 | @@ -45,6 +45,7 @@ extension ParameterStyle {
/// Returns the default value of the explode field for the given style
/// - Parameter style: The parameter style.
+ /// - Returns: Bool - True if the style is form, otherwise false | ```suggestion
/// - Returns: `true` if the style is form, otherwise `false`.
``` |
swift-openapi-runtime | github_2023 | others | 60 | apple | czechboy0 | @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import XCTest
-@_spi(Generated)@testable import OpenAPIRuntime
+@_spi(Generated) @testable import OpenAPIRuntime | I think this is because you're using 5.9 swift-format locally, please revert to 5.8 for now, we'll be upgrading to 5.9 swift-format in a dedicated PR in all 4 repos, plus we'll have to bump CI etc. |
swift-openapi-runtime | github_2023 | others | 60 | apple | czechboy0 | @@ -18,6 +18,7 @@ import HTTPTypes
class Test_Runtime: XCTestCase {
+ /// setUp tests | You can remove this as well |
swift-openapi-runtime | github_2023 | others | 58 | apple | dnadoba | @@ -0,0 +1,190 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 really want to copy & paste the documentation for these? It seems DocC doesn't currently auto inherit the documentation but this is more of a tooling problem. |
swift-openapi-runtime | github_2023 | others | 58 | apple | dnadoba | @@ -0,0 +1,190 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | Why is this a static method instead of an instance method? |
swift-openapi-runtime | github_2023 | others | 58 | apple | dnadoba | @@ -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... | This needs to be `@inlineable` to allow proper optimisation |
swift-openapi-runtime | github_2023 | others | 58 | apple | dnadoba | @@ -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... | This might need `@inline(__always)` due to current limitations in the compiler or it otherwise will always allocate.
[Cory has found out that this is necessary a while ago in `swift-collections`.](https://github.com/apple/swift-collections/issues/164) @lukasa do you know if this has changed in newer swift compilers? |
swift-openapi-runtime | github_2023 | others | 58 | apple | dnadoba | @@ -0,0 +1,197 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | `Storage` is implicitly generic because its outer type is generic so this should be `@inlinable` as well. |
swift-openapi-runtime | github_2023 | others | 58 | apple | dnadoba | @@ -0,0 +1,197 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | `@inlinable` is missing. |
swift-openapi-runtime | github_2023 | others | 58 | apple | dnadoba | @@ -0,0 +1,197 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | `@inlinable` missing. |
swift-openapi-runtime | github_2023 | others | 58 | apple | dnadoba | @@ -0,0 +1,197 @@
+//===----------------------------------------------------------------------===//
+//
+// 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... | `@inlinable` missing. |
swift-openapi-runtime | github_2023 | others | 55 | apple | simonjbeaumont | @@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 LICE... | In the past I've been bitten by this method takes options: `Data(base64Encoded:options:)` and that those options change the semantics. I've specifically been bitten with additional whitespace, which many tools consider to be valid, but without the option, this method will return nil.
We should confirm what the OpenA... |
swift-openapi-runtime | github_2023 | others | 55 | apple | simonjbeaumont | @@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 LICE... | Relatedly, we should peruse the `Base64EncodingOptions` and make sure we're doing the nicest thing we can here.
Principle: we should be permissive on input (so long as it doesn't present a security issue) and strict on output. Where "strict" means, likely to be accepted by the greatest number of other tools. |
swift-openapi-runtime | github_2023 | others | 55 | apple | simonjbeaumont | @@ -266,4 +266,13 @@ final class Test_OpenAPIValue: Test_Runtime {
let nestedValue = try XCTUnwrap(nestedDict["nested"] as? Int)
XCTAssertEqual(nestedValue, 2)
}
+
+ func testEncodingDecodingRoundTrip_base64_success() throws {
+ print(String(data: testStructData.base64EncodedData(), enc... | This test is checking that JSON encoder and decoder round trip works for Data, no? |
swift-openapi-runtime | github_2023 | others | 55 | apple | czechboy0 | @@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 LICE... | Please add docs for all public symbols, ideally also with info how to use this type (create and consume). |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.