184 Commits
Author SHA1 Message Date
Hamilton Chapman 04ccff117f Bump to 0.5.0 keepassium-156 2024-10-31 10:08:23 +00:00
Hamilton Chapman 6e9eb6c8df Bump minimum supported iOS version to 13.0 and macOS version to 10.13 2024-10-31 10:06:14 +00:00
Hamilton Chapman aed2b2ad7a Fix some warnings about encoding and decoding Data and Date types 2024-10-28 17:51:13 +00:00
Hamilton Chapman 074a260da8 Update macOS and iOS CI to use latest devices/OS versions 2024-10-28 17:46:47 +00:00
Maciej Krysztofiak 04735e8757 Fix building for Windows 2024-10-28 17:41:31 +00:00
Frank Lehmann 43aa55bc06 Add test 2024-10-28 17:41:03 +00:00
Frank Lehmann 96f6db8e6e Use encodeVarUint method again 2024-10-28 17:41:03 +00:00
zunda bd4a7807e2 add Sendable 2024-10-28 17:38:34 +00:00
zunda c97ffa5ec1 remove Equatable, Hashable has Equable 2024-10-28 17:38:34 +00:00
Dimitri Bouniol ec24382864 Lowered the fuzzing threshold so we don't overflow the stack on CI 2024-04-02 16:12:40 +01:00
Hamilton Chapman 418dab41b0 Bump minimum support deployment targets for Cocoapods users for iOS and macOS 2024-03-27 11:42:08 +00:00
Hamilton Chapman e34fe26b00 Bump to 0.4.7 2024-03-27 11:29:35 +00:00
Dimitri Bouniol 2b771ddd16 Added the ability to specify a maximum depth for CBOR decoding
Closes #92
2024-03-26 16:12:07 +00:00
Hamilton Chapman edc01765cf Bump to version 0.4.6 2023-02-03 14:58:35 +00:00
Hamilton Chapman d84829daa5 Add a test for the nested optional array of a Codable decoding incorrectly 2022-12-04 09:51:20 -08:00
Ahmed Elmoughazy d5f9b644bb * solving crashing problem when decoding optional UnkeyedContainer.
context:
- calling decodeIfPresent on optional arrays, cause the application to crash because of Force unwrap.
2022-12-04 09:51:20 -08:00
Val Packett d672505284 Update SwiftCBOR.podspec 2022-10-02 01:56:54 +03:00
Val Packett 72491ff257 Add mailmap 2022-10-02 01:56:25 +03:00
Hamilton Chapman 0baf789465 Don't treat [UInt8] as a byte string.
If you want to have something treated as a byte string then you should use
`Data`.

Fixes: #58
2022-08-01 14:37:57 +01:00
unrelentingtech 8f7afa118f podspec: update URL etc 2022-07-25 01:43:18 +03:00
Hamilton Chapman d2de0ba4e6 Update the CBOREncodable protocol to require that a toCBOR function be
implemented. The `encode` function can then rely on a default implementation
that will call `toCBOR()` and then encode the resulting `CBOR` object.
2022-06-28 12:11:01 +01:00
Hamilton Chapman 8aeb9fe6a5 Update the README to reflect the current state of the library.
Fixes: #83
2022-05-04 14:15:45 +01:00
Hamilton Chapman 4907e8bb1e Fix typo in author name in podspec 2022-03-23 10:46:19 +00:00
Hamilton Chapman 98a59c305c Fix for podspec to find the correct source files 2022-03-11 14:04:17 +00:00
Hamilton Chapman 790cf62822 Bump to 0.4.5 and add Ham as author 2022-03-11 14:02:09 +00:00
Hamilton Chapman 5aa8f6c40b Fix Codable-based decoding of indefinite maps and arrays.
We weren't moving the index along for the extra break byte (0xff), but now we
are.

Fixes: #78
2022-03-11 13:57:44 +00:00
Hamilton Chapman a79e0ca348 Fix types being used in typeMismatch errors 2022-03-11 13:57:44 +00:00
Hamilton Chapman 1fb6c0d326 Fix issue when trying to decode a mismatched type as a dictionary or an array
would lead to an empty container being decoded instead of an error being thrown.

We now correctly throw a `DecodingError.typeMismatch` error in cases like this.

Fixes: #59
2022-03-11 13:57:44 +00:00
Hamilton Chapman 36f89e5dad Fix an issue where decoding would fail if there was a property in a
`Decodable`-conforming type that was an optional array (`Optional<Array<T>>`)
and the value was an empty array.
2022-03-11 13:57:44 +00:00
Hamilton Chapman 980cf7b088 Merge pull request #74 from unrelentingtech/hc/restructure
Restructure and update repository to work with modern Swift Package Manager conventions - **means no more Carthage support**
2021-12-15 18:19:17 +00:00
Hamilton Chapman 80a90c3a60 Restructure and update repository to work with modern Swift Package Manager
conventions.
2021-12-15 18:10:44 +00:00
Hamilton Chapman 16d351e8b4 Merge pull request #76 from unrelentingtech/hc/option-forbid-non-string-map-keys
Add an option to forbid non-String map keys.
2021-12-15 17:53:07 +00:00
Hamilton Chapman dca8f0dcbb Add an option to forbid non-String map keys.
The current encoding APIs are generally non-throwing and so in a lot of places
we'd end up with a change to a throwing API if the various `encodeMap`
implementations were turned into throwing functions (some of them already are
though).

For now I've decided to leave this as are and use a `try!` in the cases where
the current `encodeMap` implementation is non-throwing. This will therefore lead
to runtime errors but I think this is fine for now given that the option to
forbid non-String map keys is opt-in.

It might be useful in the future to either change most/all of the
`encode`-relevant functions to be throwing. Either that or perhaps there could
be throwing versions to live alongside the non-throwing versions that currently
exist.
2021-12-15 17:44:19 +00:00
Hamilton Chapman a19ae35300 Merge pull request #75 from unrelentingtech/hc/date-option
Fix `Date` {en,de}coding and add an option to encode `Date`s as maps
2021-12-09 18:16:47 +00:00
Hamilton Chapman c954801a62 Fix Date encoding and decoding.
Also add support for another encoding and decoding option: `dateStrategy`. This
option accepts a value of type `DateStrategy`. The default value is
`taggedAsEpochTimestamp`, which is what the existing behaviour was. This means
`Date`s are encoded as tagged values, where the tag is `1` and the value is an
epoch timestamp.

The other value possible as a `dateStrategy` is `.annotatedMap`. This will
encode a `Date` as a map that looks like this:

```json
{
  "__type": "date_epoch_timestamp",
  "__value": 123456789
}
```

This is potentially useful for interacting with CBOR implementations that don't
support tagged values.
2021-12-09 18:05:14 +00:00
Hamilton Chapman 32ad6c3b31 Merge pull request #73 from unrelentingtech/hc/foundation-support
`Codable`-related fixes
2021-12-09 18:04:52 +00:00
Hamilton Chapman 536133df37 Tweak GitHub CI test.yml 2021-12-08 18:50:41 +00:00
Hamilton Chapman 9e069a4945 Move macOS-only Foundation types into macOS-only test 2021-12-08 18:12:22 +00:00
Hamilton Chapman e67e12915c Import Foundation where necessary 2021-12-08 17:53:17 +00:00
Hamilton Chapman 2f53e6096d Update project file and add missing comma in tests 2021-12-08 17:49:18 +00:00
Hamilton Chapman 316dfe2fbb Introduce CBOROptions which currently is only used to allow a user to specify
if they want map keys to be encoded as strings, where possible. This is relevant
for types such as those found in `Foundation` that conform to `Codable` and
whose coding keys can be encoded as either an `Int` or a `String`.
2021-12-01 15:57:06 +00:00
Hamilton Chapman e0977d1b19 Fixed issues with the encoding and decoding of more types that conform to
`Codable`.

Also now allows options to be specified that will control the encoding of the
keys in maps where they could be encoded as either an `Int` or ` String`. A new
option called `useStringKeys` is exposed which allows the user to request map
keys be encoded as `String`s
2021-12-01 15:50:14 +00:00
Hamilton Chapman c1854d50f4 Merge pull request #72 from unrelentingtech/hc/enum-fix
Fix the decoding of `Codable` enums
2021-11-25 14:40:10 +00:00
Hamilton Chapman 98f404bd1d Update GitHub actions to use macOS 11 (so a newer Xcode version) and a newer iOS
version
2021-11-24 17:48:47 +00:00
Hamilton Chapman 301b3fb8a0 Fix the decoding of Codable enums 2021-11-24 15:08:24 +00:00
Hamilton Chapman 338f489c3d Merge pull request #71 from unrelentingtech/hc/xcsheme-update
Update the xcscheme to hopefully make it stop getting updated on every build
2021-10-27 11:40:02 +01:00
Hamilton Chapman 0ab3001bf2 Update the xcscheme to hopefully make it stop getting updated on every build 2021-10-27 11:10:45 +01:00
Hamilton Chapman f977c72dac Merge pull request #70 from unrelentingtech/hc/encode-any-codable-support
Add support for encoding `Codable` objects to `CBOREncoder`'s `encodeAny`
2021-10-20 12:57:51 +01:00
Hamilton Chapman c233a2845a Add support for encoding Codable objects to CBOREncoder's encodeAny 2021-10-20 12:43:28 +01:00
Hamilton Chapman 895c9aa84c Bump to version 0.4.4 2021-09-22 15:33:36 +01:00