Skip to content

Enable documentation comment validation in swift-format #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .swift-format
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"prioritizeKeepingFunctionOutputTogether" : false,
"respectsExistingLineBreaks" : true,
"rules" : {
"AllPublicDeclarationsHaveDocumentation" : false,
"AllPublicDeclarationsHaveDocumentation" : true,
"AlwaysUseLowerCamelCase" : false,
"AmbiguousTrailingClosureOverload" : true,
"BeginDocumentationCommentWithOneLineSummary" : false,
Expand Down Expand Up @@ -50,7 +50,7 @@
"UseSynthesizedInitializer" : true,
"UseTripleSlashForDocumentationComments" : true,
"UseWhereClausesInForLoops" : false,
"ValidateDocumentationComments" : false
"ValidateDocumentationComments" : true
},
"spacesAroundRangeFormationOperators" : false,
"tabWidth" : 8,
Expand Down
17 changes: 13 additions & 4 deletions Sources/OpenAPIURLSession/URLSessionTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public struct URLSessionTransport: ClientTransport {
public var session: URLSession

/// Creates a new configuration with the provided session.
/// - Parameters:
/// - session: The URLSession used for performing HTTP operations.
/// - Parameter session: The URLSession used for performing HTTP operations.
/// If none is provided, the system uses the shared URLSession.
public init(session: URLSession = .shared) {
self.session = session
Expand All @@ -84,12 +83,20 @@ public struct URLSessionTransport: ClientTransport {
public var configuration: Configuration

/// Creates a new URLSession-based transport.
/// - Parameters:
/// - configuration: A set of configuration values used by the transport.
/// - Parameter configuration: A set of configuration values used by the transport.
public init(configuration: Configuration = .init()) {
self.configuration = configuration
}

/// Asynchronously sends an HTTP request and returns the response and body.
///
/// - Parameters:
/// - request: The HTTP request to be sent.
/// - body: The HTTP body to include in the request (optional).
/// - baseURL: The base URL for the request.
/// - operationID: An optional identifier for the operation or request.
/// - Returns: A tuple containing the HTTP response and an optional HTTP response body.
/// - Throws: An error if there is a problem sending the request or processing the response.
public func send(
_ request: HTTPRequest,
body: HTTPBody?,
Expand Down Expand Up @@ -218,10 +225,12 @@ extension URLRequest {
}

extension URLSessionTransportError: LocalizedError {
/// A custom error description for `URLSessionTransportError`.
public var errorDescription: String? { description }
}

extension URLSessionTransportError: CustomStringConvertible {
/// A custom textual representation for `URLSessionTransportError`.
public var description: String {
switch self {
case let .invalidRequestURL(path: path, method: method, baseURL: baseURL):
Expand Down
9 changes: 9 additions & 0 deletions Tests/OpenAPIURLSessionTests/Locking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,18 @@ public final class LockedValueBox<Value: Sendable>: @unchecked Sendable {
return lock
}()
private var value: Value
/// Initializes a new `LockedValueBox` instance with the provided initial value.
///
/// - Parameter value: The initial value to store in the `LockedValueBox`.
public init(_ value: Value) {
self.value = value
}
/// Perform an operation on the value in a synchronized manner.
///
/// - Parameter work: A closure that takes an inout reference to the wrapped value and returns a result.
///
/// - Returns: The result of the provided closure.
/// - Returns: The result of the closure passed to `work`.
public func withValue<R>(_ work: (inout Value) throws -> R) rethrows -> R {
lock.lock()
defer {
Expand Down