mirror of
https://github.com/apple/swift-http-structured-headers
synced 2026-11-24 04:37:50 +00:00
Migrate to GitHub Actions (#42)
Migrate CI to use GitHub Actions. Motivation: To migrate to GitHub actions and centralised infrastructure. Modifications: Changes of note: * Adopt swift-format using rules from SwiftNIO * Remove scripts and docker files which are no longer needed Result: Feature parity with old CI.
This commit is contained in:
1 parent
b0bf94fb2d
commit
8b35bf45bf
41 files changed
+625
-757
No files matched your search
@@ -77,7 +77,8 @@ extension BareInnerListDecoder: UnkeyedDecodingContainer {
|
||||
}
|
||||
}
|
||||
|
||||
mutating func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type) throws -> KeyedDecodingContainer<NestedKey> where NestedKey: CodingKey {
|
||||
mutating func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type) throws -> KeyedDecodingContainer<NestedKey>
|
||||
where NestedKey: CodingKey {
|
||||
// This is a request to decode a full item. We decode the next entry and increment the index.
|
||||
guard !self.isAtEnd else {
|
||||
throw StructuredHeaderError.indexOutOfRange
|
||||
|
||||
@@ -62,6 +62,18 @@ extension BareItemDecoder: SingleValueDecodingContainer {
|
||||
try self._decodeFixedWidthInteger(type)
|
||||
}
|
||||
|
||||
#if compiler(>=6.0)
|
||||
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
|
||||
func decode(_ type: UInt128.Type) throws -> UInt128 {
|
||||
try self._decodeFixedWidthInteger(type)
|
||||
}
|
||||
|
||||
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
|
||||
func decode(_ type: Int128.Type) throws -> Int128 {
|
||||
try self._decodeFixedWidthInteger(type)
|
||||
}
|
||||
#endif
|
||||
|
||||
func decode(_ type: UInt.Type) throws -> UInt {
|
||||
try self._decodeFixedWidthInteger(type)
|
||||
}
|
||||
@@ -114,9 +126,11 @@ extension BareItemDecoder: SingleValueDecodingContainer {
|
||||
throw StructuredHeaderError.invalidTypeForItem
|
||||
}
|
||||
|
||||
return Decimal(sign: pseudoDecimal.mantissa > 0 ? .plus : .minus,
|
||||
exponent: Int(pseudoDecimal.exponent),
|
||||
significand: Decimal(pseudoDecimal.mantissa.magnitude))
|
||||
return Decimal(
|
||||
sign: pseudoDecimal.mantissa > 0 ? .plus : .minus,
|
||||
exponent: Int(pseudoDecimal.exponent),
|
||||
significand: Decimal(pseudoDecimal.mantissa.magnitude)
|
||||
)
|
||||
}
|
||||
|
||||
func decodeNil() -> Bool {
|
||||
|
||||
@@ -60,7 +60,10 @@ extension DictionaryKeyedContainer: KeyedDecodingContainerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func nestedContainer<NestedKey: CodingKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> {
|
||||
func nestedContainer<NestedKey: CodingKey>(
|
||||
keyedBy type: NestedKey.Type,
|
||||
forKey key: Key
|
||||
) throws -> KeyedDecodingContainer<NestedKey> {
|
||||
try self.decoder.push(_StructuredHeaderCodingKey(key, keyDecodingStrategy: self.decoder.keyDecodingStrategy))
|
||||
defer {
|
||||
self.decoder.pop()
|
||||
|
||||
@@ -65,7 +65,10 @@ extension KeyedInnerListDecoder: KeyedDecodingContainerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func nestedContainer<NestedKey: CodingKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> {
|
||||
func nestedContainer<NestedKey: CodingKey>(
|
||||
keyedBy type: NestedKey.Type,
|
||||
forKey key: Key
|
||||
) throws -> KeyedDecodingContainer<NestedKey> {
|
||||
try self.decoder.push(_StructuredHeaderCodingKey(key, keyDecodingStrategy: self.decoder.keyDecodingStrategy))
|
||||
defer {
|
||||
self.decoder.pop()
|
||||
|
||||
@@ -65,7 +65,10 @@ extension KeyedItemDecoder: KeyedDecodingContainerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func nestedContainer<NestedKey: CodingKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> {
|
||||
func nestedContainer<NestedKey: CodingKey>(
|
||||
keyedBy type: NestedKey.Type,
|
||||
forKey key: Key
|
||||
) throws -> KeyedDecodingContainer<NestedKey> {
|
||||
try self.decoder.push(_StructuredHeaderCodingKey(key, keyDecodingStrategy: self.decoder.keyDecodingStrategy))
|
||||
defer {
|
||||
self.decoder.pop()
|
||||
|
||||
@@ -65,7 +65,10 @@ extension KeyedTopLevelListDecoder: KeyedDecodingContainerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func nestedContainer<NestedKey: CodingKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> {
|
||||
func nestedContainer<NestedKey: CodingKey>(
|
||||
keyedBy type: NestedKey.Type,
|
||||
forKey key: Key
|
||||
) throws -> KeyedDecodingContainer<NestedKey> {
|
||||
try self.decoder.push(_StructuredHeaderCodingKey(key, keyDecodingStrategy: self.decoder.keyDecodingStrategy))
|
||||
defer {
|
||||
self.decoder.pop()
|
||||
|
||||
@@ -60,7 +60,10 @@ extension ParametersDecoder: KeyedDecodingContainerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func nestedContainer<NestedKey: CodingKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> {
|
||||
func nestedContainer<NestedKey: CodingKey>(
|
||||
keyedBy type: NestedKey.Type,
|
||||
forKey key: Key
|
||||
) throws -> KeyedDecodingContainer<NestedKey> {
|
||||
try self.decoder.push(_StructuredHeaderCodingKey(key, keyDecodingStrategy: self.decoder.keyDecodingStrategy))
|
||||
defer {
|
||||
self.decoder.pop()
|
||||
|
||||
@@ -46,7 +46,10 @@ extension StructuredFieldValueDecoder {
|
||||
/// - data: The bytes of the structured header field.
|
||||
/// - throws: If the header field could not be parsed, or could not be decoded.
|
||||
/// - returns: An object of type `StructuredField`.
|
||||
public func decode<StructuredField: StructuredFieldValue, BaseData: RandomAccessCollection>(_ type: StructuredField.Type = StructuredField.self, from data: BaseData) throws -> StructuredField where BaseData.Element == UInt8 {
|
||||
public func decode<StructuredField: StructuredFieldValue, BaseData: RandomAccessCollection>(
|
||||
_ type: StructuredField.Type = StructuredField.self,
|
||||
from data: BaseData
|
||||
) throws -> StructuredField where BaseData.Element == UInt8 {
|
||||
switch StructuredField.structuredFieldType {
|
||||
case .item:
|
||||
return try self.decodeItemField(from: data)
|
||||
@@ -64,7 +67,10 @@ extension StructuredFieldValueDecoder {
|
||||
/// - data: The bytes of the structured header field.
|
||||
/// - throws: If the header field could not be parsed, or could not be decoded.
|
||||
/// - returns: An object of type `StructuredField`.
|
||||
private func decodeDictionaryField<StructuredField: Decodable, BaseData: RandomAccessCollection>(_ type: StructuredField.Type = StructuredField.self, from data: BaseData) throws -> StructuredField where BaseData.Element == UInt8 {
|
||||
private func decodeDictionaryField<StructuredField: Decodable, BaseData: RandomAccessCollection>(
|
||||
_ type: StructuredField.Type = StructuredField.self,
|
||||
from data: BaseData
|
||||
) throws -> StructuredField where BaseData.Element == UInt8 {
|
||||
let parser = StructuredFieldValueParser(data)
|
||||
let decoder = _StructuredFieldDecoder(parser, keyDecodingStrategy: self.keyDecodingStrategy)
|
||||
try decoder.parseDictionaryField()
|
||||
@@ -78,7 +84,10 @@ extension StructuredFieldValueDecoder {
|
||||
/// - data: The bytes of the structured header field.
|
||||
/// - throws: If the header field could not be parsed, or could not be decoded.
|
||||
/// - returns: An object of type `StructuredField`.
|
||||
private func decodeListField<StructuredField: Decodable, BaseData: RandomAccessCollection>(_ type: StructuredField.Type = StructuredField.self, from data: BaseData) throws -> StructuredField where BaseData.Element == UInt8 {
|
||||
private func decodeListField<StructuredField: Decodable, BaseData: RandomAccessCollection>(
|
||||
_ type: StructuredField.Type = StructuredField.self,
|
||||
from data: BaseData
|
||||
) throws -> StructuredField where BaseData.Element == UInt8 {
|
||||
let parser = StructuredFieldValueParser(data)
|
||||
let decoder = _StructuredFieldDecoder(parser, keyDecodingStrategy: self.keyDecodingStrategy)
|
||||
try decoder.parseListField()
|
||||
@@ -92,7 +101,10 @@ extension StructuredFieldValueDecoder {
|
||||
/// - data: The bytes of the structured header field.
|
||||
/// - throws: If the header field could not be parsed, or could not be decoded.
|
||||
/// - returns: An object of type `StructuredField`.
|
||||
private func decodeItemField<StructuredField: Decodable, BaseData: RandomAccessCollection>(_ type: StructuredField.Type = StructuredField.self, from data: BaseData) throws -> StructuredField where BaseData.Element == UInt8 {
|
||||
private func decodeItemField<StructuredField: Decodable, BaseData: RandomAccessCollection>(
|
||||
_ type: StructuredField.Type = StructuredField.self,
|
||||
from data: BaseData
|
||||
) throws -> StructuredField where BaseData.Element == UInt8 {
|
||||
let parser = StructuredFieldValueParser(data)
|
||||
let decoder = _StructuredFieldDecoder(parser, keyDecodingStrategy: self.keyDecodingStrategy)
|
||||
try decoder.parseItemField()
|
||||
@@ -120,7 +132,10 @@ class _StructuredFieldDecoder<BaseData: RandomAccessCollection> where BaseData.E
|
||||
|
||||
var keyDecodingStrategy: StructuredFieldValueDecoder.KeyDecodingStrategy?
|
||||
|
||||
init(_ parser: StructuredFieldValueParser<BaseData>, keyDecodingStrategy: StructuredFieldValueDecoder.KeyDecodingStrategy?) {
|
||||
init(
|
||||
_ parser: StructuredFieldValueParser<BaseData>,
|
||||
keyDecodingStrategy: StructuredFieldValueDecoder.KeyDecodingStrategy?
|
||||
) {
|
||||
self.parser = parser
|
||||
self._codingStack = []
|
||||
self.keyDecodingStrategy = keyDecodingStrategy
|
||||
|
||||
@@ -77,7 +77,8 @@ extension TopLevelListDecoder: UnkeyedDecodingContainer {
|
||||
}
|
||||
}
|
||||
|
||||
mutating func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type) throws -> KeyedDecodingContainer<NestedKey> where NestedKey: CodingKey {
|
||||
mutating func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type) throws -> KeyedDecodingContainer<NestedKey>
|
||||
where NestedKey: CodingKey {
|
||||
// This is a request to decode a full item. We decode the next entry and increment the index.
|
||||
guard !self.isAtEnd else {
|
||||
throw StructuredHeaderError.indexOutOfRange
|
||||
|
||||
Reference in new issue
Block a user