Skip to content

Commit 1becb8e

Browse files
authored
Add missing availability annotations in public APIs (#85)
### Motivation Fixes #74. This needed to be done before 1.0, as adding these later is an API break. ### Modifications Added a few missing availability annotations to public APIs. ### Result 100% of the public API now has consistent availability. ### Test Plan Tests passed.
1 parent 6bdc0d2 commit 1becb8e

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

Sources/Configuration/ConfigContext.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
/// A value that can be stored in a configuration context.
1616
///
1717
/// Context values support common data types used for configuration metadata.
18+
@available(Configuration 1.0, *)
1819
public enum ConfigContextValue: Sendable, Equatable, Hashable {
1920

2021
/// A string value.
@@ -30,6 +31,7 @@ public enum ConfigContextValue: Sendable, Equatable, Hashable {
3031
case bool(Bool)
3132
}
3233

34+
@available(Configuration 1.0, *)
3335
extension ConfigContextValue: CustomStringConvertible {
3436
// swift-format-ignore: AllPublicDeclarationsHaveDocumentation
3537
public var description: String {
@@ -46,34 +48,39 @@ extension ConfigContextValue: CustomStringConvertible {
4648
}
4749
}
4850

51+
@available(Configuration 1.0, *)
4952
extension ConfigContextValue: ExpressibleByStringLiteral {
5053
// swift-format-ignore: AllPublicDeclarationsHaveDocumentation
5154
public init(stringLiteral value: String) {
5255
self = .string(value)
5356
}
5457
}
5558

59+
@available(Configuration 1.0, *)
5660
extension ConfigContextValue: ExpressibleByIntegerLiteral {
5761
// swift-format-ignore: AllPublicDeclarationsHaveDocumentation
5862
public init(integerLiteral value: Int) {
5963
self = .int(value)
6064
}
6165
}
6266

67+
@available(Configuration 1.0, *)
6368
extension ConfigContextValue: ExpressibleByFloatLiteral {
6469
// swift-format-ignore: AllPublicDeclarationsHaveDocumentation
6570
public init(floatLiteral value: Double) {
6671
self = .double(value)
6772
}
6873
}
6974

75+
@available(Configuration 1.0, *)
7076
extension ConfigContextValue: ExpressibleByBooleanLiteral {
7177
// swift-format-ignore: AllPublicDeclarationsHaveDocumentation
7278
public init(booleanLiteral value: Bool) {
7379
self = .bool(value)
7480
}
7581
}
7682

83+
@available(Configuration 1.0, *)
7784
extension [String: ConfigContextValue] {
7885
/// Creates a sorted string representation of the context, used primarily for sorting and logging.
7986
///

Sources/Configuration/SecretsSpecifier.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
/// secretsSpecifier: .none
7272
/// )
7373
/// ```
74+
@available(Configuration 1.0, *)
7475
public enum SecretsSpecifier<KeyType: Sendable & Hashable, ValueType: Sendable>: Sendable {
7576

7677
/// The library treats all configuration values as secrets.
@@ -103,6 +104,7 @@ public enum SecretsSpecifier<KeyType: Sendable & Hashable, ValueType: Sendable>:
103104
case dynamic(@Sendable (KeyType, ValueType) -> Bool)
104105
}
105106

107+
@available(Configuration 1.0, *)
106108
extension SecretsSpecifier {
107109
/// Determines whether a configuration value should be treated as secret.
108110
///

Sources/Configuration/ValueCoders/ConfigBytesFromStringDecoder.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import Foundation
3434
/// let decoder: ConfigBytesFromStringDecoder = .base64
3535
/// let bytes = decoder.decode("SGVsbG8gV29ybGQ=") // "Hello World" in base64
3636
/// ```
37+
@available(Configuration 1.0, *)
3738
public protocol ConfigBytesFromStringDecoder: Sendable {
3839

3940
/// Decodes a string value into an array of bytes.
@@ -52,12 +53,14 @@ public protocol ConfigBytesFromStringDecoder: Sendable {
5253
///
5354
/// This decoder interprets string configuration values as base64-encoded data
5455
/// and converts them to their binary representation.
56+
@available(Configuration 1.0, *)
5557
public struct ConfigBytesFromBase64StringDecoder: Sendable {
5658

5759
/// Creates a new base64 decoder.
5860
public init() {}
5961
}
6062

63+
@available(Configuration 1.0, *)
6164
extension ConfigBytesFromBase64StringDecoder: ConfigBytesFromStringDecoder {
6265
// swift-format-ignore: AllPublicDeclarationsHaveDocumentation
6366
public func decode(_ value: String) -> [UInt8]? {
@@ -68,6 +71,7 @@ extension ConfigBytesFromBase64StringDecoder: ConfigBytesFromStringDecoder {
6871
}
6972
}
7073

74+
@available(Configuration 1.0, *)
7175
extension ConfigBytesFromStringDecoder where Self == ConfigBytesFromBase64StringDecoder {
7276

7377
/// A decoder that interprets string values as base64-encoded data.
@@ -85,12 +89,14 @@ extension ConfigBytesFromStringDecoder where Self == ConfigBytesFromBase64String
8589
/// The decoder expects strings with an even number of characters, where each
8690
/// pair of characters represents one byte. For example, "48656C6C6F" represents
8791
/// the bytes for "Hello".
92+
@available(Configuration 1.0, *)
8893
public struct ConfigBytesFromHexStringDecoder: Sendable {
8994

9095
/// Creates a new hexadecimal decoder.
9196
public init() {}
9297
}
9398

99+
@available(Configuration 1.0, *)
94100
extension ConfigBytesFromHexStringDecoder: ConfigBytesFromStringDecoder {
95101
// swift-format-ignore: AllPublicDeclarationsHaveDocumentation
96102
public func decode(_ value: String) -> [UInt8]? {
@@ -113,6 +119,7 @@ extension ConfigBytesFromHexStringDecoder: ConfigBytesFromStringDecoder {
113119
}
114120
}
115121

122+
@available(Configuration 1.0, *)
116123
extension ConfigBytesFromStringDecoder where Self == ConfigBytesFromHexStringDecoder {
117124

118125
/// A decoder that interprets string values as hexadecimal-encoded data.

Tests/ConfigurationTests/ReloadingFileProviderTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct ReloadingFileProviderTests {
162162

163163
// Check empty value
164164
let result2 = try provider.value(forKey: ["key1"], type: .string)
165-
#expect(try result2.value == nil)
165+
#expect(result2.value == nil)
166166

167167
// Update to a new valid file
168168
fileSystem.update(

0 commit comments

Comments
 (0)