Skip to content

Commit 3062c69

Browse files
committed
Fix docs
1 parent 330beec commit 3062c69

12 files changed

+48
-119
lines changed

Sources/SwiftProtobuf/AsyncMessageSequence.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,9 @@ extension AsyncSequence where Element == UInt8 {
2424
/// - extensions: An ``ExtensionMap`` used to look up and decode any extensions in
2525
/// messages encoded by this sequence, or in messages nested within these messages.
2626
/// - partial: If `false` (the default), after decoding a message, ``Message/isInitialized-6abgi`
27-
/// will be checked to ensure all fields are present. If any are missing,
28-
/// ``SwiftProtobufError/BinaryDecoding/missingRequiredFields`` will be thrown.
27+
/// will be checked to ensure all fields are present.
2928
/// - options: The ``BinaryDecodingOptions`` to use.
3029
/// - Returns: An asynchronous sequence of messages read from the `AsyncSequence` of bytes.
31-
/// - Throws: ``SwiftProtobufError`` for errors in the framing of the messages in the sequence
32-
/// or while decoding messages.
3330
@inlinable
3431
public func binaryProtobufDelimitedMessages<M: Message>(
3532
of messageType: M.Type = M.self,
@@ -70,12 +67,9 @@ public struct AsyncMessageSequence<
7067
/// - extensions: An ``ExtensionMap`` used to look up and decode any extensions in
7168
/// messages encoded by this sequence, or in messages nested within these messages.
7269
/// - partial: If `false` (the default), after decoding a message, ``Message/isInitialized-6abgi``
73-
/// will be checked to ensure all fields are present. If any are missing,
74-
/// ``SwiftProtobufError/BinaryDecoding/missingRequiredFields`` will be thrown.
70+
/// will be checked to ensure all fields are present.
7571
/// - options: The ``BinaryDecodingOptions`` to use.
7672
/// - Returns: An asynchronous sequence of messages read from the `AsyncSequence` of bytes.
77-
/// - Throws: ``SwiftProtobufError`` for errors in the framing of the messages in the sequence
78-
/// or while decoding messages.
7973
public init(
8074
base: Base,
8175
extensions: (any ExtensionMap)? = nil,

Sources/SwiftProtobuf/BinaryDelimited.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public enum BinaryDelimited {
4545
/// - partial: If `false` (the default), this method will check
4646
/// ``Message/isInitialized-6abgi`` before encoding to verify that all required
4747
/// fields are present. If any are missing, this method throws
48-
/// ``SwiftProtobufError/BinaryStreamDecoding/missingRequiredFields``.
49-
/// - Throws: ``SwiftProtobufError`` if encoding fails or some writing errors occur; or the
50-
/// underlying `OutputStream.streamError` for a stream error.
48+
/// ``BinaryDelimited/Error/missingRequiredFields``.
49+
/// - Throws: ``BinaryDelimited/Error`` if encoding fails or some writing errors occur; or the
50+
/// underlying `OutputStream.streamError` for a stream error.
5151
public static func serialize(
5252
message: any Message,
5353
to stream: OutputStream,
@@ -100,11 +100,11 @@ public enum BinaryDelimited {
100100
/// - partial: If `false` (the default), this method will check
101101
/// ``Message/isInitialized-6abgi`` after decoding to verify that all required
102102
/// fields are present. If any are missing, this method throws
103-
/// ``SwiftProtobufError/BinaryStreamDecoding/missingRequiredFields``.
103+
/// ``BinaryDecodingError/missingRequiredFields``.
104104
/// - options: The ``BinaryDecodingOptions`` to use.
105105
/// - Returns: The message read.
106-
/// - Throws: ``SwiftProtobufError`` if decoding fails, and for some reading errors; or the
107-
/// underlying `InputStream.streamError` for a stream error.
106+
/// - Throws: ``BinaryDelimited/Error`` or ``SwiftProtobufError`` if decoding fails,
107+
/// some reading errors; or the underlying `InputStream.streamError` for a stream error.
108108
public static func parse<M: Message>(
109109
messageType: M.Type,
110110
from stream: InputStream,
@@ -141,10 +141,10 @@ public enum BinaryDelimited {
141141
/// - partial: If `false` (the default), this method will check
142142
/// ``Message/isInitialized-6abgi`` after decoding to verify that all required
143143
/// fields are present. If any are missing, this method throws
144-
/// ``SwiftProtobufError/BinaryStreamDecoding/missingRequiredFields``.
144+
/// ``BinaryDelimited/Error/missingRequiredFields``.
145145
/// - options: The BinaryDecodingOptions to use.
146-
/// - Throws: ``SwiftProtobufError`` if decoding fails, and for some reading errors; or the
147-
/// underlying `InputStream.streamError` for a stream error.
146+
/// - Throws: ``BinaryDelimited/Error`` or ``SwiftProtobufError`` if decoding fails,
147+
/// and for some reading errors; or the underlying `InputStream.streamError` for a stream error.
148148
public static func merge<M: Message>(
149149
into message: inout M,
150150
from stream: InputStream,

Sources/SwiftProtobuf/Google_Protobuf_Any+Extensions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ extension Google_Protobuf_Any {
3232
/// - partial: If `false` (the default), this method will check
3333
/// ``Message/isInitialized-6abgi`` before encoding to verify that all required
3434
/// fields are present. If any are missing, this method throws
35-
/// ``SwiftProtobufError/BinaryEncoding/missingRequiredFields``.
35+
/// ``BinaryEncodingError/missingRequiredFields``.
3636
/// - typePrefix: The prefix to be used when building the `type_url`.
3737
/// Defaults to "type.googleapis.com".
38-
/// - Throws: ``SwiftProtobufError/BinaryEncoding/missingRequiredFields`` if
38+
/// - Throws: ``BinaryEncodingError/missingRequiredFields`` if
3939
/// `partial` is false and `message` wasn't fully initialized.
4040
public init(
4141
message: any Message,
@@ -59,7 +59,7 @@ extension Google_Protobuf_Any {
5959
/// - extensions: An ``ExtensionMap`` used to look up and decode any
6060
/// extensions in this message or messages nested within this message's
6161
/// fields.
62-
/// - Throws: ``SwiftProtobufError`` on failure.
62+
/// - Throws: ``TextFormatDecodingError`` on failure.
6363
public init(
6464
textFormatString: String,
6565
options: TextFormatDecodingOptions = TextFormatDecodingOptions(),

Sources/SwiftProtobuf/Message+AnyAdditions.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ extension Message {
3232
/// extensions in this message or messages nested within this message's
3333
/// fields.
3434
/// - Parameter options: The BinaryDecodingOptions to use.
35-
/// - Throws: `SwiftProtobufError` on failure.
35+
/// - Throws: an instance of ``AnyUnpackError``, ``JSONDecodingError``, or
36+
/// ``BinaryDecodingError`` on failure.
3637
public init(
3738
unpackingAny: Google_Protobuf_Any,
3839
extensions: (any ExtensionMap)? = nil,

Sources/SwiftProtobuf/Message+BinaryAdditions.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ extension Message {
2323
/// - partial: If `false` (the default), this method will check
2424
/// `Message.isInitialized` before encoding to verify that all required
2525
/// fields are present. If any are missing, this method throws.
26-
/// ``SwiftProtobufError/BinaryEncoding/missingRequiredFields``.
26+
/// ``BinaryEncodingError/missingRequiredFields``.
2727
/// - options: The ``BinaryEncodingOptions`` to use.
2828
/// - Returns: A ``SwiftProtobufContiguousBytes`` instance containing the binary serialization
2929
/// of the message.
3030
///
31-
/// - Throws: ``SwiftProtobufError`` if encoding fails.
31+
/// - Throws: ``SwiftProtobufError`` or ``BinaryEncodingError`` if encoding fails.
3232
public func serializedBytes<Bytes: SwiftProtobufContiguousBytes>(
3333
partial: Bool = false,
3434
options: BinaryEncodingOptions = BinaryEncodingOptions()
@@ -85,9 +85,9 @@ extension Message {
8585
/// - partial: If `false` (the default), this method will check
8686
/// ``Message/isInitialized-6abgi`` after decoding to verify that all required
8787
/// fields are present. If any are missing, this method throws
88-
/// ``SwiftProtobufError/BinaryDecoding/missingRequiredFields``.
88+
/// ``BinaryDecodingError/missingRequiredFields``.
8989
/// - options: The ``BinaryDecodingOptions`` to use.
90-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
90+
/// - Throws: ``BinaryDecodingError`` if decoding fails.
9191
@inlinable
9292
public init<Bytes: SwiftProtobufContiguousBytes>(
9393
serializedBytes bytes: Bytes,
@@ -115,9 +115,9 @@ extension Message {
115115
/// - partial: If `false` (the default), this method will check
116116
/// ``Message/isInitialized-6abgi`` after decoding to verify that all required
117117
/// fields are present. If any are missing, this method throws
118-
/// ``SwiftProtobufError/BinaryDecoding/missingRequiredFields``.
118+
/// ``BinaryDecodingError/missingRequiredFields``.
119119
/// - options: The ``BinaryDecodingOptions`` to use.
120-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
120+
/// - Throws: ``BinaryDecodingError`` if decoding fails.
121121
@inlinable
122122
public mutating func merge<Bytes: SwiftProtobufContiguousBytes>(
123123
serializedBytes bytes: Bytes,

Sources/SwiftProtobuf/Message+BinaryAdditions_Data.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ extension Message {
2727
/// - partial: If `false` (the default), this method will check
2828
/// ``Message/isInitialized-6abgi`` after decoding to verify that all required
2929
/// fields are present. If any are missing, this method throws
30-
/// ``SwiftProtobufError/BinaryDecoding/missingRequiredFields``.
30+
/// ``BinaryDecodingError/missingRequiredFields``.
3131
/// - options: The ``BinaryDecodingOptions`` to use.
32-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
32+
/// - Throws: ``BinaryDecodingError`` if decoding fails.
3333
@inlinable
3434
public init(
3535
serializedData data: Data,
@@ -57,9 +57,9 @@ extension Message {
5757
/// - partial: If `false` (the default), this method will check
5858
/// ``Message/isInitialized-6abgi`` after decoding to verify that all required
5959
/// fields are present. If any are missing, this method throws
60-
/// ``SwiftProtobufError/BinaryDecoding/missingRequiredFields``.
60+
/// ``BinaryDecodingError/missingRequiredFields``.
6161
/// - options: The ``BinaryDecodingOptions`` to use.
62-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
62+
/// - Throws: ``BinaryDecodingError`` if decoding fails.
6363
@inlinable
6464
public mutating func merge(
6565
serializedData data: Data,
@@ -77,10 +77,10 @@ extension Message {
7777
/// - partial: If `false` (the default), this method will check
7878
/// ``Message/isInitialized-6abgi`` before encoding to verify that all required
7979
/// fields are present. If any are missing, this method throws
80-
/// ``SwiftProtobufError/BinaryEncoding/missingRequiredFields``.
80+
/// ``BinaryEncodingError/missingRequiredFields``.
8181
/// - options: The `BinaryEncodingOptions` to use.
8282
/// - Returns: A `Data` instance containing the binary serialization of the message.
83-
/// - Throws: ``SwiftProtobufError`` if encoding fails.
83+
/// - Throws: ``BinaryEncodingError`` if encoding fails.
8484
public func serializedData(
8585
partial: Bool = false,
8686
options: BinaryEncodingOptions = BinaryEncodingOptions()

Sources/SwiftProtobuf/Message+JSONAdditions.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extension Message {
2424
/// - Returns: A string containing the JSON serialization of the message.
2525
/// - Parameters:
2626
/// - options: The JSONEncodingOptions to use.
27-
/// - Throws: ``SwiftProtobufError`` if encoding fails.
27+
/// - Throws: ``JSONEncodingError`` if encoding fails.
2828
public func jsonString(
2929
options: JSONEncodingOptions = JSONEncodingOptions()
3030
) throws -> String {
@@ -43,7 +43,7 @@ extension Message {
4343
/// - Returns: A `SwiftProtobufContiguousBytes` containing the JSON serialization of the message.
4444
/// - Parameters:
4545
/// - options: The JSONEncodingOptions to use.
46-
/// - Throws: ``SwiftProtobufError`` if encoding fails.
46+
/// - Throws: ``JSONEncodingError`` if encoding fails.
4747
public func jsonUTF8Bytes<Bytes: SwiftProtobufContiguousBytes>(
4848
options: JSONEncodingOptions = JSONEncodingOptions()
4949
) throws -> Bytes {
@@ -63,7 +63,7 @@ extension Message {
6363
///
6464
/// - Parameter jsonString: The JSON-formatted string to decode.
6565
/// - Parameter options: The JSONDecodingOptions to use.
66-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
66+
/// - Throws: ``JSONDecodingError`` if decoding fails.
6767
public init(
6868
jsonString: String,
6969
options: JSONDecodingOptions = JSONDecodingOptions()
@@ -77,7 +77,7 @@ extension Message {
7777
/// - Parameter jsonString: The JSON-formatted string to decode.
7878
/// - Parameter extensions: An ExtensionMap for looking up extensions by name
7979
/// - Parameter options: The JSONDecodingOptions to use.
80-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
80+
/// - Throws: ``JSONDecodingError`` if decoding fails.
8181
public init(
8282
jsonString: String,
8383
extensions: (any ExtensionMap)? = nil,
@@ -100,7 +100,7 @@ extension Message {
100100
/// - Parameter jsonUTF8Bytes: The JSON-formatted data to decode, represented
101101
/// as UTF-8 encoded text.
102102
/// - Parameter options: The JSONDecodingOptions to use.
103-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
103+
/// - Throws: ``JSONDecodingError`` if decoding fails.
104104
public init<Bytes: SwiftProtobufContiguousBytes>(
105105
jsonUTF8Bytes: Bytes,
106106
options: JSONDecodingOptions = JSONDecodingOptions()
@@ -116,7 +116,7 @@ extension Message {
116116
/// as UTF-8 encoded text.
117117
/// - Parameter extensions: The extension map to use with this decode
118118
/// - Parameter options: The JSONDecodingOptions to use.
119-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
119+
/// - Throws: ``JSONDecodingError`` if decoding fails.
120120
public init<Bytes: SwiftProtobufContiguousBytes>(
121121
jsonUTF8Bytes: Bytes,
122122
extensions: (any ExtensionMap)? = nil,

Sources/SwiftProtobuf/Message+JSONAdditions_Data.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension Message {
2222
/// - Parameter jsonUTF8Data: The JSON-formatted data to decode, represented
2323
/// as UTF-8 encoded text.
2424
/// - Parameter options: The JSONDecodingOptions to use.
25-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
25+
/// - Throws: ``JSONDecodingError`` if decoding fails.
2626
public init(
2727
jsonUTF8Data: Data,
2828
options: JSONDecodingOptions = JSONDecodingOptions()
@@ -37,7 +37,7 @@ extension Message {
3737
/// as UTF-8 encoded text.
3838
/// - Parameter extensions: The extension map to use with this decode
3939
/// - Parameter options: The JSONDecodingOptions to use.
40-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
40+
/// - Throws: ``JSONDecodingError`` if decoding fails.
4141
public init(
4242
jsonUTF8Data: Data,
4343
extensions: (any ExtensionMap)? = nil,
@@ -54,7 +54,7 @@ extension Message {
5454
/// - Returns: A Data containing the JSON serialization of the message.
5555
/// - Parameters:
5656
/// - options: The JSONEncodingOptions to use.
57-
/// - Throws: ``SwiftProtobufError`` if encoding fails.
57+
/// - Throws: ``JSONDecodingError`` if encoding fails.
5858
public func jsonUTF8Data(
5959
options: JSONEncodingOptions = JSONEncodingOptions()
6060
) throws -> Data {

Sources/SwiftProtobuf/Message+JSONArrayAdditions.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extension Message {
2525
/// - Parameters:
2626
/// - collection: The list of messages to encode.
2727
/// - options: The JSONEncodingOptions to use.
28-
/// - Throws: ``SwiftProtobufError`` if encoding fails.
28+
/// - Throws: ``JSONEncodingError`` if encoding fails.
2929
public static func jsonString<C: Collection>(
3030
from collection: C,
3131
options: JSONEncodingOptions = JSONEncodingOptions()
@@ -43,7 +43,7 @@ extension Message {
4343
/// - Parameters:
4444
/// - collection: The list of messages to encode.
4545
/// - options: The JSONEncodingOptions to use.
46-
/// - Throws: ``SwiftProtobufError`` if encoding fails.
46+
/// - Throws: ``JSONEncodingError`` if encoding fails.
4747
public static func jsonUTF8Bytes<C: Collection, Bytes: SwiftProtobufContiguousBytes>(
4848
from collection: C,
4949
options: JSONEncodingOptions = JSONEncodingOptions()
@@ -64,7 +64,7 @@ extension Message {
6464
///
6565
/// - Parameter jsonString: The JSON-formatted string to decode.
6666
/// - Parameter options: The JSONDecodingOptions to use.
67-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
67+
/// - Throws: ``JSONDecodingError`` if decoding fails.
6868
public static func array(
6969
fromJSONString jsonString: String,
7070
options: JSONDecodingOptions = JSONDecodingOptions()
@@ -80,7 +80,7 @@ extension Message {
8080
/// - Parameter jsonString: The JSON-formatted string to decode.
8181
/// - Parameter extensions: The extension map to use with this decode
8282
/// - Parameter options: The JSONDecodingOptions to use.
83-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
83+
/// - Throws: ``JSONDecodingError`` if decoding fails.
8484
public static func array(
8585
fromJSONString jsonString: String,
8686
extensions: any ExtensionMap = SimpleExtensionMap(),
@@ -103,7 +103,7 @@ extension Message {
103103
/// - Parameter jsonUTF8Bytes: The JSON-formatted data to decode, represented
104104
/// as UTF-8 encoded text.
105105
/// - Parameter options: The JSONDecodingOptions to use.
106-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
106+
/// - Throws: ``JSONDecodingError`` if decoding fails.
107107
public static func array<Bytes: SwiftProtobufContiguousBytes>(
108108
fromJSONUTF8Bytes jsonUTF8Bytes: Bytes,
109109
options: JSONDecodingOptions = JSONDecodingOptions()
@@ -121,7 +121,7 @@ extension Message {
121121
/// as UTF-8 encoded text.
122122
/// - Parameter extensions: The extension map to use with this decode
123123
/// - Parameter options: The JSONDecodingOptions to use.
124-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
124+
/// - Throws: ``JSONDecodingError`` if decoding fails.
125125
public static func array<Bytes: SwiftProtobufContiguousBytes>(
126126
fromJSONUTF8Bytes jsonUTF8Bytes: Bytes,
127127
extensions: any ExtensionMap = SimpleExtensionMap(),

Sources/SwiftProtobuf/Message+JSONArrayAdditions_Data.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extension Message {
2323
/// - Parameter jsonUTF8Data: The JSON-formatted data to decode, represented
2424
/// as UTF-8 encoded text.
2525
/// - Parameter options: The JSONDecodingOptions to use.
26-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
26+
/// - Throws: ``JSONDecodingError`` if decoding fails.
2727
public static func array(
2828
fromJSONUTF8Data jsonUTF8Data: Data,
2929
options: JSONDecodingOptions = JSONDecodingOptions()
@@ -41,7 +41,7 @@ extension Message {
4141
/// as UTF-8 encoded text.
4242
/// - Parameter extensions: The extension map to use with this decode
4343
/// - Parameter options: The JSONDecodingOptions to use.
44-
/// - Throws: ``SwiftProtobufError`` if decoding fails.
44+
/// - Throws: ``JSONDecodingError`` if decoding fails.
4545
public static func array(
4646
fromJSONUTF8Data jsonUTF8Data: Data,
4747
extensions: any ExtensionMap = SimpleExtensionMap(),
@@ -61,7 +61,7 @@ extension Message {
6161
/// - Parameters:
6262
/// - collection: The list of messages to encode.
6363
/// - options: The JSONEncodingOptions to use.
64-
/// - Throws: ``SwiftProtobufError`` if encoding fails.
64+
/// - Throws: ``JSONEncodingError`` if encoding fails.
6565
public static func jsonUTF8Data<C: Collection>(
6666
from collection: C,
6767
options: JSONEncodingOptions = JSONEncodingOptions()

0 commit comments

Comments
 (0)